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

From: Abdun Nihaal

Date: Wed Jul 01 2026 - 02:23:46 EST


When an empty string is provided as the value, the error check after
kstrdup() call, can fail even when a small buffer is allocated for the
null terminated empty string. Fix that by freeing it before returning.

Fixes: 4df84e846624 ("scsi: elx: efct: Driver initialization routines")
Signed-off-by: Abdun Nihaal <nihaal@xxxxxxxxxxxxxx>
---
Compile tested only. Issue found using static analysis.

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

diff --git a/drivers/scsi/elx/efct/efct_hw.c b/drivers/scsi/elx/efct/efct_hw.c
index 1838032f6486..b0fdeabb9d05 100644
--- a/drivers/scsi/elx/efct/efct_hw.c
+++ b/drivers/scsi/elx/efct/efct_hw.c
@@ -1129,6 +1129,7 @@ efct_hw_parse_filter(struct efct_hw *hw, void *value)

p = kstrdup(value, GFP_KERNEL);
if (!p || !*p) {
+ kfree(p);
efc_log_err(hw->os, "p is NULL\n");
return -ENOMEM;
}
--
2.43.0