patch-2.4.0-test6 linux/drivers/block/floppy.c

Next file: linux/drivers/block/ll_rw_blk.c
Previous file: linux/drivers/block/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test5/linux/drivers/block/floppy.c linux/drivers/block/floppy.c
@@ -3429,9 +3429,6 @@
 static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
 		    unsigned long param)
 {
-#define IOCTL_MODE_BIT 8
-#define OPEN_WRITE_BIT 16
-#define IOCTL_ALLOWED (filp && (filp->f_mode & IOCTL_MODE_BIT))
 #define OUT(c,x) case c: outparam = (const char *) (x); break
 #define IN(c,x,tag) case c: *(x) = inparam. tag ; return 0
 
@@ -3499,7 +3496,7 @@
 		return -EINVAL;
 
 	/* permission checks */
-	if (((cmd & 0x40) && !IOCTL_ALLOWED) ||
+	if (((cmd & 0x40) && !(filp->f_mode & 2)) ||
 	    ((cmd & 0x80) && !suser()))
 		return -EPERM;
 
@@ -3620,7 +3617,6 @@
 		return fd_copyout((void *)param, outparam, size);
 	else
 		return 0;
-#undef IOCTL_ALLOWED
 #undef OUT
 #undef IN
 }
@@ -3772,12 +3768,6 @@
 			buffer_track = -1;
 		invalidate_buffers(MKDEV(FLOPPY_MAJOR,old_dev));
 	}
-
-	/* Allow ioctls if we have write-permissions even if read-only open */
-	if ((filp->f_mode & 2) || (permission(inode,2) == 0))
-		filp->f_mode |= IOCTL_MODE_BIT;
-	if (filp->f_mode & 2)
-		filp->f_mode |= OPEN_WRITE_BIT;
 
 	if (UFDCS->rawcmd == 1)
 		UFDCS->rawcmd = 2;

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