scsi: scsi_dh_alua: Warn if the first argument of alua_rtpg_queue() is NULL

This change “scsi: scsi_dh_alua: Warn if the first argument of alua_rtpg_queue() is NULL” (commit 0aeccdf) in Linux kernel is authored by Bart Van Assche <bart.vanassche [at] sandisk.com> on Fri Mar 17 17:02:03 2017 -0700.

Description of "scsi: scsi_dh_alua: Warn if the first argument of alua_rtpg_queue() is NULL"

The change “scsi: scsi_dh_alua: Warn if the first argument of alua_rtpg_queue() is NULL” introduces changes as follows.

scsi: scsi_dh_alua: Warn if the first argument of alua_rtpg_queue() is NULL

Callers must provide a valid port group to alua_rtpg_queue().  Issue a
kernel warning if that is not the case.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Tang Junhui <tang.junhui@zte.com.cn>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Linux kernel releases containing commit 0aeccdf

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "scsi: scsi_dh_alua: Warn if the first argument of alua_rtpg_queue() is NULL"

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/scsi/device_handler/scsi_dh_alua.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 
diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
index b6849d3ecefe..c01b47e5b55a 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -876,7 +876,7 @@ static bool alua_rtpg_queue(struct alua_port_group *pg,
 	unsigned long flags;
 	struct workqueue_struct *alua_wq = kaluad_wq;
 
-	if (!pg || scsi_device_get(sdev))
+	if (WARN_ON_ONCE(!pg) || scsi_device_get(sdev))
 		return false;
 
 	spin_lock_irqsave(&pg->lock, flags);

The commit for this change in Linux stable tree is 0aeccdf (patch).

Last modified: 2020/02/09