Re: [PATCH] Updated ATM patch for 2.4.19-pre4

From: Francois Romieu (romieu@cogenit.fr)
Date: Sun Mar 24 2002 - 16:06:22 EST


[thread starts at:
http://www.cs.Helsinki.FI/linux/linux-kernel/2002-11/1311.html]

The following patch applies on top of Maksim's one. It:
- adds a missing include (hunk #1);
- turns a cast fiesta into the equivalent list_entry (hunk #2);
- unregisters net_device once it isn't needed for bridging (hunk #3);
- compiles and stands a kill-br2684ctl-before-ifconfig-down test: nas0
  disappeared as it should.

Without the patch an oops happens, see:
<URL:http://www.cogenit.fr/linux/atm/oopses/text-6>

Comments welcome.

--- net/atm/br2684.c.orig Sat Mar 23 21:21:41 2002
+++ net/atm/br2684.c Sun Mar 24 21:42:30 2002
@@ -15,6 +15,7 @@ Author: Marcell GAL, 2000, XDSL Ltd, Hun
 #include <linux/etherdevice.h>
 #include <net/arp.h>
 #include <linux/rtnetlink.h>
+#include <linux/ip.h>
 #include <linux/atmbr2684.h>
 
 #include "ipcommon.h"
@@ -97,8 +98,7 @@ static LIST_HEAD(br2684_devs);
 
 static inline struct br2684_dev *BRPRIV(const struct net_device *net_dev)
 {
- return (struct br2684_dev *) ((char *) (net_dev) -
- (unsigned long) (&((struct br2684_dev *) 0)->net_dev));
+ return list_entry(net_dev, struct br2684_dev, net_dev);
 }
 
 static inline struct br2684_dev *list_entry_brdev(const struct list_head *le)
@@ -410,6 +410,13 @@ static void br2684_push(struct atm_vcc *
 
         if (skb == NULL) { /* skb==NULL means VCC is being destroyed */
                 br2684_close_vcc(brvcc);
+ if (list_empty(&brdev->brvccs)) {
+ read_lock(&devs_lock);
+ list_del(&brdev->br2684_devs);
+ read_unlock(&devs_lock);
+ unregister_netdev(&brdev->net_dev);
+ kfree(brdev);
+ }
                 return;
         }
 

-- 
Ueimor
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Mar 31 2002 - 22:00:08 EST