patch-2.3.99-pre1 linux/drivers/net/hamradio/yam.c

Next file: linux/drivers/net/lance.c
Previous file: linux/drivers/net/hamradio/soundmodem/sm_wss.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.51/linux/drivers/net/hamradio/yam.c linux/drivers/net/hamradio/yam.c
@@ -962,7 +962,7 @@
 	if (yp == NULL || yp->magic != YAM_MAGIC)
 		return -EINVAL;
 
-	if (!suser())
+	if (!capable(CAP_NET_ADMIN))
 		return -EPERM;
 
 	if (cmd != SIOCDEVPRIVATE)
@@ -977,6 +977,8 @@
 		if (netif_running(dev))
 			return -EINVAL;		/* Cannot change this parameter when up */
 		ym = kmalloc(sizeof(struct yamdrv_ioctl_mcs), GFP_ATOMIC);
+		if(ym==NULL)
+			return -ENOBUFS;
 		ym->bitrate = 9600;
 		if (copy_from_user(ym, ifr->ifr_data, sizeof(struct yamdrv_ioctl_mcs)))
 			 return -EFAULT;
@@ -987,6 +989,8 @@
 		break;
 
 	case SIOCYAMSCFG:
+		if (!capable(CAP_SYS_RAWIO))
+			return -EPERM;
 		if (copy_from_user(&yi, ifr->ifr_data, sizeof(struct yamdrv_ioctl_cfg)))
 			 return -EFAULT;
 

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