]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
fix up queue-3.0/block-fail-scsi-passthrough-ioctls-on-partition-devices.patch
authorGreg Kroah-Hartman <gregkh@suse.de>
Thu, 26 Jan 2012 00:19:43 +0000 (16:19 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 26 Jan 2012 00:19:43 +0000 (16:19 -0800)
queue-3.0/block-fail-scsi-passthrough-ioctls-on-partition-devices.patch

index 09c46bb64b38d9c72c6f4e2de2eec950012607dc..45be9d4ea6f7969366df82d3878cd9a4561c6064 100644 (file)
@@ -7,6 +7,9 @@ From: Paolo Bonzini <pbonzini@redhat.com>
 
 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 <pbonzini@redhat.com>
 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
 
+
 ---
  block/scsi_ioctl.c     |   45 +++++++++++++++++++++++++++++++++++++++++++++
  drivers/scsi/sd.c      |   11 +++++++++--
@@ -85,7 +89,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
 +               * 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 <gregkh@suse.de>
 +      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 <gregkh@suse.de>
 +
 +      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