]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: scsi_dh_alua: Fix a reference counting bug
authorBart Van Assche <bart.vanassche@sandisk.com>
Tue, 1 Nov 2016 14:19:57 +0000 (08:19 -0600)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 1 Nov 2016 17:32:24 +0000 (13:32 -0400)
commitc647de8a69f72f46aa24c12c8d4a2bbfd5afc4d5
tree5d61ed8c7e551eb980a4c1772964bdce25d8c1d8
parente4be326f6f177698cb5fb5505a9dd3d292074a0d
scsi: scsi_dh_alua: Fix a reference counting bug

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

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

In other words, alua_rtpg_queue() must hold an sdev reference and a pg
reference before queueing rtpg work. If no rtpg work is queued no
additional references should be held when alua_rtpg_queue() returns. If
no rtpg work is queued, ensure that alua_rtpg_queue() only gives up the
sdev reference if that reference was obtained by the same
alua_rtpg_queue() call.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reported-by: Tang Junhui <tang.junhui@zte.com.cn>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Tang Junhui <tang.junhui@zte.com.cn>
Cc: <stable@vger.kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/device_handler/scsi_dh_alua.c