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

Next file: linux/net/core/sock.c
Previous file: linux/net/ax25/af_ax25.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.33/linux/net/core/dev.c linux/net/core/dev.c
@@ -225,7 +225,7 @@
 
 extern __inline__ void dev_load(const char *name)
 {
-	if(!dev_get(name)) {
+	if(!dev_get(name) && suser()) {
 #ifdef CONFIG_NET_ALIAS
 		const char *sptr;
  
@@ -1113,6 +1113,8 @@
 			{
 				int old_flags = dev->flags;
 				
+				if(securelevel>0)
+					ifr.ifr_flags&=~IFF_PROMISC;
 				/*
 				 *	We are not allowed to potentially close/unload
 				 *	a device until we get this lock.
@@ -1191,6 +1193,8 @@
 			{
 				if(dev->set_mac_address==NULL)
 					return -EOPNOTSUPP;
+				if(securelevel>0)
+					return -EPERM;
 				ret=dev->set_mac_address(dev,&ifr.ifr_addr);
 			}
 			else
@@ -1336,6 +1340,8 @@
 		case SIOCSIFHWADDR:
 			if(dev->set_mac_address==NULL)
 				return -EOPNOTSUPP;
+			if(securelevel > 0)
+				return -EPERM;
 			if(ifr.ifr_hwaddr.sa_family!=dev->type)
 				return -EINVAL;
 			ret=dev->set_mac_address(dev,&ifr.ifr_hwaddr);
@@ -1523,9 +1529,6 @@
 	 *
 	 * Some devices want to be initialized early..
 	 */
-#if defined(CONFIG_LANCE)
-	lance_init();
-#endif
 #if defined(CONFIG_PI)
 	pi_init();
 #endif	

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