[PATCH] scsi: efct: Fix potential memory leak in efct_io_pool_free()

Abdun Nihaal posted 1 patch 1 month, 2 weeks ago
drivers/scsi/elx/efct/efct_io.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] scsi: efct: Fix potential memory leak in efct_io_pool_free()
Posted by Abdun Nihaal 1 month, 2 weeks ago
The memory allocated for struct efct_io in efct_io_pool_create(), is
not freed by it's corresponding free function efct_io_pool_free().
Fix that by adding a kfree().

Fixes: e2cf422ba833 ("scsi: elx: efct: Hardware queues processing")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
Compile tested only. Found using static analysis.

 drivers/scsi/elx/efct/efct_io.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/elx/efct/efct_io.c b/drivers/scsi/elx/efct/efct_io.c
index c612f0a48839..bdafecca7573 100644
--- a/drivers/scsi/elx/efct/efct_io.c
+++ b/drivers/scsi/elx/efct/efct_io.c
@@ -92,6 +92,7 @@ efct_io_pool_free(struct efct_io_pool *io_pool)
 					  io->rspbuf.size, io->rspbuf.virt,
 					  io->rspbuf.phys);
 			memset(&io->rspbuf, 0, sizeof(struct efc_dma));
+			kfree(io);
 		}
 
 		kfree(io_pool);
-- 
2.43.0