From: Greg Kroah-Hartman Date: Thu, 26 Jan 2012 00:19:43 +0000 (-0800) Subject: fix up queue-3.0/block-fail-scsi-passthrough-ioctls-on-partition-devices.patch X-Git-Tag: v3.2.2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2166e3aafd17c119e464235afc42b314d6668882;p=thirdparty%2Fkernel%2Fstable-queue.git fix up queue-3.0/block-fail-scsi-passthrough-ioctls-on-partition-devices.patch --- diff --git a/queue-3.0/block-fail-scsi-passthrough-ioctls-on-partition-devices.patch b/queue-3.0/block-fail-scsi-passthrough-ioctls-on-partition-devices.patch index 09c46bb64b3..45be9d4ea6f 100644 --- a/queue-3.0/block-fail-scsi-passthrough-ioctls-on-partition-devices.patch +++ b/queue-3.0/block-fail-scsi-passthrough-ioctls-on-partition-devices.patch @@ -7,6 +7,9 @@ From: Paolo Bonzini commit 0bfc96cb77224736dfa35c3c555d37b3646ef35e upstream. +[ Changes with respect to 3.3: return -ENOTTY from scsi_verify_blk_ioctl + and -ENOIOCTLCMD from sd_compat_ioctl. ] + Linux allows executing the SG_IO ioctl on a partition or LVM volume, and will pass the command to the underlying block device. This is well-known, but it is also a large security problem when (via Unix @@ -40,6 +43,7 @@ Signed-off-by: Paolo Bonzini Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman + --- block/scsi_ioctl.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ drivers/scsi/sd.c | 11 +++++++++-- @@ -85,7 +89,7 @@ Signed-off-by: Greg Kroah-Hartman + * and we do not want to spam dmesg about it. CD-ROMs do + * not have partitions, so we get here only for disks. + */ -+ return -ENOIOCTLCMD; ++ return -ENOTTY; + default: + break; + } @@ -94,7 +98,7 @@ Signed-off-by: Greg Kroah-Hartman + printk_ratelimited(KERN_WARNING + "%s: sending ioctl %x to a partition!\n", current->comm, cmd); + -+ return capable(CAP_SYS_RAWIO) ? 0 : -ENOIOCTLCMD; ++ return capable(CAP_SYS_RAWIO) ? 0 : -ENOTTY; +} +EXPORT_SYMBOL(scsi_verify_blk_ioctl); + @@ -131,7 +135,7 @@ Signed-off-by: Greg Kroah-Hartman + + ret = scsi_verify_blk_ioctl(bdev, cmd); + if (ret < 0) -+ return ret; ++ return -ENOIOCTLCMD; /* * If we are in the middle of error recovery, don't let anyone