The code at the end of alua_rtpg_work() is as follows:

        scsi_device_put(sdev);
        kref_put(&pg->kref, release_port_group);

Make sure that all code that queues the work item associated
with alua_rtpg_work() holds both references.

Signed-off-by: Bart Van Assche <bart.vanass...@sandisk.com>
Cc: Hannes Reinecke <h...@suse.com>
Cc: <sta...@vger.kernel.org>
---
 drivers/scsi/device_handler/scsi_dh_alua.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c 
b/drivers/scsi/device_handler/scsi_dh_alua.c
index 752b5c9..f7099e2 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -889,6 +889,7 @@ static void alua_rtpg_queue(struct alua_port_group *pg,
                /* Do not queue if the worker is already running */
                if (!(pg->flags & ALUA_PG_RUNNING)) {
                        kref_get(&pg->kref);
+                       scsi_device_get(sdev);
                        start_queue = 1;
                }
        }
-- 
2.10.0

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to