patch-2.1.102 linux/drivers/block/nbd.c

Next file: linux/drivers/char/cyclades.c
Previous file: linux/drivers/block/ide.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.101/linux/drivers/block/nbd.c linux/drivers/block/nbd.c
@@ -316,6 +316,8 @@
 	struct nbd_device *lo;
 	int dev, error;
 
+	/* Anyone capable of this syscall can do *real bad* things */
+
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
 	if (!inode)
@@ -422,6 +424,11 @@
 int nbd_init(void)
 {
 	int i;
+
+	if (sizeof(struct nbd_request) != 24) {
+		printk(KERN_CRIT "Sizeof nbd_request needs to be 24 in order to work!\n" );
+		return -EIO;
+	}
 
 	if (register_blkdev(MAJOR_NR, "nbd", &nbd_fops)) {
 		printk("Unable to get major number %d for NBD\n",

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