]> 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)
commit5668e3b9c5a425b4ecf5c3843e2a4a806be0678c
tree5d61ed8c7e551eb980a4c1772964bdce25d8c1d8
parent19593dbd37ea02201dff56009946f6c8dc62c2a5
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