patch-2.3.13 linux/drivers/char/raw.c

Next file: linux/drivers/char/riscom8.c
Previous file: linux/drivers/char/q40_keyb.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.12/linux/drivers/char/raw.c linux/drivers/char/raw.c
@@ -13,6 +13,7 @@
 #include <linux/major.h>
 #include <linux/blkdev.h>
 #include <linux/raw.h>
+#include <linux/capability.h>
 #include <asm/uaccess.h>
 
 #define dprintk(x...) 
@@ -233,6 +234,15 @@
 		}
 
 		if (command == RAW_SETBIND) {
+			/*
+			 * This is like making block devices, so demand the
+			 * same capability
+			 */
+			if (!capable(CAP_SYS_ADMIN)) {
+				err = -EPERM;
+				break;
+			}
+
 			/* 
 			 * For now, we don't need to check that the underlying
 			 * block device is present or not: we can do that when

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