]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
scsi: scsi_dh_alua: fix missing kref_put() in alua_rtpg_work()
authortang.junhui <tang.junhui@zte.com.cn>
Fri, 28 Oct 2016 07:54:07 +0000 (15:54 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Nov 2016 09:51:48 +0000 (10:51 +0100)
commit 1fdd14279eab2e9f79745631379f0c53cb8f9a5a upstream.

Reference count of pg leaks in alua_rtpg_work() since kref_put() is not
called to decrease the reference count of pg when the condition
pg->rtpg_sdev==NULL satisfied (actually it is easy to satisfy), it would
cause memory of pg leakage.

Signed-off-by: tang.junhui <tang.junhui@zte.com.cn>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/device_handler/scsi_dh_alua.c

index 752b5c9d1ab2779810e68592df10a69eab72b30e..6e825036be89891344d0b303b7e27ac6c73fc5c5 100644 (file)
@@ -792,6 +792,7 @@ static void alua_rtpg_work(struct work_struct *work)
                WARN_ON(pg->flags & ALUA_PG_RUN_RTPG);
                WARN_ON(pg->flags & ALUA_PG_RUN_STPG);
                spin_unlock_irqrestore(&pg->lock, flags);
+               kref_put(&pg->kref, release_port_group);
                return;
        }
        if (pg->flags & ALUA_SYNC_STPG)