forked from luck/tmp_suning_uos_patched
drivers/block/floppy.c: remove misleading, used once FD_IOCTL_ALLOWED macro
Just code the test directly Signed-off-by: Joe Perches <joe@perches.com> Cc: Stephen Hemminger <shemminger@vyatta.com> Cc: Jens Axboe <jens.axboe@oracle.com> Cc: Marcin Slusarz <marcin.slusarz@gmail.com> Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
712e1de43e
commit
0aad92cfea
@ -3420,8 +3420,6 @@ static int fd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
|
|||||||
static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
|
static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
|
||||||
unsigned long param)
|
unsigned long param)
|
||||||
{
|
{
|
||||||
#define FD_IOCTL_ALLOWED (mode & (FMODE_WRITE|FMODE_WRITE_IOCTL))
|
|
||||||
|
|
||||||
int drive = (long)bdev->bd_disk->private_data;
|
int drive = (long)bdev->bd_disk->private_data;
|
||||||
int type = ITYPE(UDRS->fd_device);
|
int type = ITYPE(UDRS->fd_device);
|
||||||
int i;
|
int i;
|
||||||
@ -3454,7 +3452,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* permission checks */
|
/* permission checks */
|
||||||
if (((cmd & 0x40) && !FD_IOCTL_ALLOWED) ||
|
if (((cmd & 0x40) && !(mode & (FMODE_WRITE | FMODE_WRITE_IOCTL))) ||
|
||||||
((cmd & 0x80) && !capable(CAP_SYS_ADMIN)))
|
((cmd & 0x80) && !capable(CAP_SYS_ADMIN)))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user