]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
scsi: elx: efct: Fix memory leak in efct_hw_parse_filter()
authorVitaliy Shevtsov <v.shevtsov@mt-integration.ru>
Thu, 12 Jun 2025 16:35:18 +0000 (21:35 +0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:05:38 +0000 (11:05 +0100)
commit8e31c6cc3cbac1d05cdca6e9c3c74653dd90a091
tree14e878419d52d56713c4321da2f82b7926c11b62
parent92750bfe7b0d8dbcaf578c091a65eda1c5f9ad38
scsi: elx: efct: Fix memory leak in efct_hw_parse_filter()

[ Upstream commit 2a8a5a5dd06eef580f9818567773fd75057cb875 ]

strsep() modifies the address of the pointer passed to it so that it no
longer points to the original address. This means kfree() gets the wrong
pointer.

Fix this by passing unmodified pointer returned from kstrdup() to
kfree().

Found by Linux Verification Center (linuxtesting.org) with Svace.

Fixes: 4df84e846624 ("scsi: elx: efct: Driver initialization routines")
Signed-off-by: Vitaliy Shevtsov <v.shevtsov@mt-integration.ru>
Link: https://lore.kernel.org/r/20250612163616.24298-1-v.shevtsov@mt-integration.ru
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/elx/efct/efct_hw.c