]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
scsi_dh: don't allow to detach device handlers at runtime
authorChristoph Hellwig <hch@lst.de>
Thu, 27 Aug 2015 12:17:01 +0000 (14:17 +0200)
committerJames Bottomley <JBottomley@Odin.com>
Fri, 28 Aug 2015 20:14:58 +0000 (13:14 -0700)
The I/O submission and completion paths call into the device handler
without any synchronization agains detachment.  So disallow detaching
device handlers at runtime.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
drivers/scsi/scsi_dh.c

index 2e1db5738ae1a6da8532ddbf80e033fa6b8001fd..9f6511da5023903b0b55cf6066b346b605e55930 100644 (file)
@@ -181,8 +181,10 @@ store_dh_state(struct device *dev, struct device_attribute *attr,
                        /*
                         * Detach from a device handler
                         */
-                       scsi_dh_handler_detach(sdev);
-                       err = 0;
+                       sdev_printk(KERN_WARNING, sdev,
+                                   "can't detach handler %s.\n",
+                                   sdev->handler->name);
+                       err = -EINVAL;
                } else if (!strncmp(buf, "activate", 8)) {
                        /*
                         * Activate a device handler