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

index a5461d4c8676b480f23a1807c63be9d283aa0b36..f858e09cd11d94f421d43372ad14c01ba226d772 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
@@ -85,7 +88,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 +97,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 +134,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