linux-stable/drivers/scsi/device_handler
Bart Van Assche 50759b881e scsi: device_handler: alua: Call scsi_device_put() from non-atomic context
Since commit f93ed747e2 ("scsi: core: Release SCSI devices
synchronously"), scsi_device_put() might sleep. Avoid calling it from
alua_rtpg_queue() with the pg_lock held. The lock only pretects h->pg,
anyway. To avoid the pg being freed under us, because of a race with
another thread, take a temporary reference. In alua_rtpg_queue(), verify
that the pg still belongs to the sdev being passed before actually queueing
the RTPG.

This patch fixes the following smatch warning:

drivers/scsi/device_handler/scsi_dh_alua.c:1013 alua_rtpg_queue() warn: sleeping in atomic context

alua_check_vpd() <- disables preempt
-> alua_rtpg_queue()
   -> scsi_device_put()

Cc: Martin Wilck <mwilck@suse.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Sachin Sant <sachinp@linux.ibm.com>
Cc: Benjamin Block <bblock@linux.ibm.com>
Suggested-by: Martin Wilck <mwilck@suse.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20221117183626.2656196-3-bvanassche@acm.org
Tested-by: Sachin Sant <sachinp@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-11-26 00:35:16 +00:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
scsi_dh_alua.c scsi: device_handler: alua: Call scsi_device_put() from non-atomic context 2022-11-26 00:35:16 +00:00
scsi_dh_emc.c scsi/device_handlers: Use the new blk_opf_t type 2022-07-14 12:14:32 -06:00
scsi_dh_hp_sw.c scsi/device_handlers: Use the new blk_opf_t type 2022-07-14 12:14:32 -06:00
scsi_dh_rdac.c scsi/device_handlers: Use the new blk_opf_t type 2022-07-14 12:14:32 -06:00