Commit b43f1886e4d3ea3f68665eaea96526ccdd53741d

Authored by Nicholas Bellinger
1 parent 683497566d

tcm_loop: Fix memory leak in tcm_loop_submission_work error path

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>

Showing 1 changed file with 1 additions and 0 deletions Side-by-side Diff

drivers/target/loopback/tcm_loop.c
... ... @@ -239,6 +239,7 @@
239 239 return;
240 240  
241 241 out_done:
  242 + kmem_cache_free(tcm_loop_cmd_cache, tl_cmd);
242 243 sc->scsi_done(sc);
243 244 return;
244 245 }