[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-kernel
Subject:    appletalk module miscounting (was: MOD_USE_COUNT < 0 ?)
From:       a sun <asun () zoology ! washington ! edu>
Date:       1997-11-29 0:54:21
[Download RAW message or body]


you're getting negative module counts because the fix hasn't been
merged in from davem's cvs tree yet. in any case, i've appended the
patch i use to get things to work. the actual cvs tree has other fixes
which aren't reflected in this patch. apply to linux/net/appletalk and
things should just work.

-a

--- aarp.c.save	Sat Nov 29 00:31:56 1997
+++ aarp.c	Sat Nov 29 00:40:24 1997
@@ -828,11 +828,9 @@
 }
 
 
-#ifdef MODULE
 
 /*
  * Remove the AARP entries associated with a device.
- * Called from cleanup_module() in ddp.c.
  */
 void aarp_device_down(struct device *dev)
 {
@@ -847,6 +845,7 @@
 	return;
 }
 
+#ifdef MODULE
 /*
  * General module cleanup. Called from cleanup_module() in ddp.c.
  */
--- ddp.c.save	Sat Nov 29 00:40:14 1997
+++ ddp.c	Sat Nov 29 00:40:24 1997
@@ -268,12 +268,12 @@
 			*iface = tmp->next;
 			kfree_s(tmp, sizeof(struct atalk_iface));
 			dev->atalk_ptr=NULL;
+			MOD_DEC_USE_COUNT;
 		}
 		else
 			iface = &tmp->next;
 	}
 
-	MOD_DEC_USE_COUNT;
 }
 
 static struct atalk_iface *atif_add_device(struct device *dev, struct at_addr *sa)
@@ -664,6 +664,16 @@
 }
 
 /*
+ * Actually down the interface.
+ */
+static inline void atalk_dev_down(struct device *dev)
+{
+	atrtr_device_down(dev);	/* Remove all routes for the device */
+	aarp_device_down(dev);	/* Remove AARP entries for the device */
+	atif_drop_device(dev);	/* Remove the device */
+}
+
+/*
  * A device event has occurred. Watch for devices going down and
  * delete our use of them (iface and route).
  */
@@ -672,8 +682,7 @@
 	if(event == NETDEV_DOWN)
 	{
 		/* Discard any use of this */
-		atrtr_device_down((struct device *)ptr);
-		atif_drop_device((struct device *)ptr);
+	        atalk_dev_down((struct device *) ptr);
 	}
 
 	return (NOTIFY_DONE);
@@ -820,14 +829,12 @@
 			break;
 
 	        case SIOCATALKDIFADDR:
+	        case SIOCDIFADDR:
 			if(!suser())
 				return (-EPERM);
 			if(sa->sat_family != AF_APPLETALK)
 				return (-EINVAL);
-			if(atif == NULL)
-				return (-EADDRNOTAVAIL);
-			atrtr_device_down(atif->dev);
-			atif_drop_device(atif->dev);
+			atalk_dev_down(dev);
 			break;			
 	}
 
@@ -1821,6 +1828,7 @@
 		case SIOCSIFADDR:
 		case SIOCGIFBRDADDR:
 		case SIOCATALKDIFADDR:
+		case SIOCDIFADDR:
 			return (atif_ioctl(cmd,(void *)arg));
 
 		/*
@@ -1984,18 +1992,6 @@
 }
 
 /*
- * Actually down the interface.
- */
-static void atalk_iface_down(struct atalk_iface *iface)
-{
-	atrtr_device_down(iface->dev);	/* Remove all routes for the device */
-	aarp_device_down(iface->dev);	/* Remove AARP entries for the device */
-	atif_drop_device(iface->dev);	/* Remove the device */
-
-	return;
-}
-
-/*
  * Note on MOD_{INC,DEC}_USE_COUNT:
  *
  * Use counts are incremented/decremented when
@@ -2010,16 +2006,6 @@
 
 void cleanup_module(void)
 {
-	struct atalk_iface *ifaces = atalk_iface_list, *tmp;
-
-        while(ifaces != NULL)
-        {
-                tmp = ifaces->next;
-                ifaces->dev->atalk_ptr = NULL;
-                atalk_iface_down(ifaces);
-                ifaces = tmp;
-        }
-
 #ifdef CONFIG_SYSCTL
 	atalk_unregister_sysctl();
 #endif /* CONFIG_SYSCTL */

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic