patch-2.3.99-pre1 linux/drivers/net/rcpci45.c

Next file: linux/drivers/net/rrunner.c
Previous file: linux/drivers/net/ppp_synctty.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.51/linux/drivers/net/rcpci45.c linux/drivers/net/rcpci45.c
@@ -1034,6 +1034,9 @@
     printk("RCioctl: cmd = 0x%x\n", cmd);
 #endif
  
+    if(!capable(CAP_NET_ADMIN))
+    	return -EPERM;
+    	
     switch (cmd)  {
  
     case RCU_PROTOCOL_REV:
@@ -1157,14 +1160,14 @@
             RCUD_DEFAULT -> rc = 0x11223344;
             break;
         }
-        copy_to_user(rq->ifr_data, &RCuser, sizeof(RCuser));
+        if(copy_to_user(rq->ifr_data, &RCuser, sizeof(RCuser)))
+        	return -EFAULT;
         break;
-    }   /* RCU_COMMAND */ 
+	}   /* RCU_COMMAND */ 
 
-    default:
-        printk("RC default\n");
-        rq->ifr_ifru.ifru_data = (caddr_t) 0x12345678;
-        break;
+	default:
+        	rq->ifr_ifru.ifru_data = (caddr_t) 0x12345678;
+        	return -EINVAL;
     }
     return 0;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)