tcm_loop: Fix memory leak in tcm_loop_submission_work error path
authorNicholas Bellinger <nab@linux-iscsi.org>
Tue, 17 Jun 2014 22:23:03 +0000 (22:23 +0000)
committerNicholas Bellinger <nab@linux-iscsi.org>
Fri, 27 Jun 2014 03:56:49 +0000 (20:56 -0700)
This patch fixes a tcm_loop_cmd descriptor memory leak in the
tcm_loop_submission_work() error path, and would result in
warnings about leaked tcm_loop_cmd_cache objects at module
unload time.

Go ahead and invoke kmem_cache_free() to release tl_cmd back to
tcm_loop_cmd_cache before calling sc->scsi_done().

Reported-by: Sebastian Herbszt <herbszt@gmx.de>
Tested-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/loopback/tcm_loop.c

index 6d2f37578b29cc0509d3898b7910bb35cd9d484c..8c64b8776a9634e34027098ef3ca8976e9e5691e 100644 (file)
@@ -239,6 +239,7 @@ static void tcm_loop_submission_work(struct work_struct *work)
        return;
 
 out_done:
+       kmem_cache_free(tcm_loop_cmd_cache, tl_cmd);
        sc->scsi_done(sc);
        return;
 }