patch-2.1.85 linux/net/core/dev.c

Next file: linux/net/core/scm.c
Previous file: linux/net/ax25/Config.in
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.84/linux/net/core/dev.c linux/net/core/dev.c
@@ -49,6 +49,7 @@
  *	    Thomas Bogendoerfer :	Return ENODEV for dev_open, if there
  *					is no device open function.
  *		Andi Kleen	:	Fix error reporting for SIOCGIFCONF
+ *		Régis Duchesne	:	Fix the argument check in dev_ioctl()
  *
  */
 
@@ -1534,7 +1535,6 @@
 	return -EINVAL;
 }
 
-
 /*
  *	This function handles all "interface"-type I/O control requests. The actual
  *	'doing' part of this is dev_ifsioc above.
@@ -1566,25 +1566,19 @@
 		return dev_ifname((struct ifreq *)arg);
 	}
 
+	/*
+	 *	Fetch the interface name from the info block. 
+	 */
+
 	if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
 		return -EFAULT;
-
 	ifr.ifr_name[IFNAMSIZ-1] = 0;
-
 #ifdef CONFIG_NET_ALIAS
 	colon = strchr(ifr.ifr_name, ':');
 	if (colon)
 		*colon = 0;
 #endif
 
-	/*
-	 *	See which interface the caller is talking about. 
-	 */
-	 
-#ifdef CONFIG_KERNELD
-	dev_load(ifr.ifr_name);
-#endif	
-
 	switch(cmd) 
 	{
 		/*
@@ -1602,6 +1596,9 @@
 		case SIOCGIFMAP:
 		case SIOCGIFINDEX:
 		case SIOCGIFTXQLEN:
+#ifdef CONFIG_KERNELD
+			dev_load(ifr.ifr_name);
+#endif	
 			ret = dev_ifsioc(&ifr, cmd);
 			if (!ret) {
 #ifdef CONFIG_NET_ALIAS
@@ -1632,6 +1629,9 @@
 		case SIOCSIFTXQLEN:
 			if (!suser())
 				return -EPERM;
+#ifdef CONFIG_KERNELD
+			dev_load(ifr.ifr_name);
+#endif	
 			rtnl_lock();
 			ret = dev_ifsioc(&ifr, cmd);
 			rtnl_unlock();
@@ -1652,6 +1652,9 @@
 		default:
 			if (cmd >= SIOCDEVPRIVATE &&
 			    cmd <= SIOCDEVPRIVATE + 15) {
+#ifdef CONFIG_KERNELD
+				dev_load(ifr.ifr_name);
+#endif	
 				rtnl_lock();
 				ret = dev_ifsioc(&ifr, cmd);
 				rtnl_unlock();
@@ -1664,8 +1667,15 @@
 				if (IW_IS_SET(cmd)) {
 					if (!suser())
 						return -EPERM;
+#ifdef CONFIG_KERNELD
+					dev_load(ifr.ifr_name);
+#endif	
 					rtnl_lock();
 				}
+#ifdef CONFIG_KERNELD
+				else
+					dev_load(ifr.ifr_name);
+#endif	
 				ret = dev_ifsioc(&ifr, cmd);
 				if (IW_IS_SET(cmd))
 					rtnl_unlock();

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov