* [PATCH] scsi: megaraid_mbox: avoid double kfree()
@ 2026-06-01 21:02 Arnd Bergmann
2026-06-02 1:55 ` Martin K. Petersen
2026-06-09 1:38 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2026-06-01 21:02 UTC (permalink / raw)
To: Kashyap Desai, Sumit Saxena, Shivasharan S, Chandrakanth patil,
James E.J. Bottomley, Martin K. Petersen, Arnd Bergmann
Cc: Dan Carpenter, megaraidlinux.pdl, linux-scsi, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Smatch found a double-free after my recent change:
drivers/scsi/megaraid/megaraid_mbox.c:3474 megaraid_cmm_register()
error: double free of 'adp' (line 3468)
Since the object is no longer allocated in megaraid_cmm_register(),
remove the kfree() as well.
Fixes: c1f7275b613b ("scsi: megaraid_mbox: Reduce stack usage in megaraid_cmm_register()")
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/megaraid/megaraid_mm.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c
index 60db48dc8f3a..e572665903d2 100644
--- a/drivers/scsi/megaraid/megaraid_mm.c
+++ b/drivers/scsi/megaraid/megaraid_mm.c
@@ -998,8 +998,6 @@ mraid_mm_register_adp(mraid_mmadp_t *adapter)
dma_pool_destroy(adapter->pthru_dma_pool);
- kfree(adapter);
-
return rval;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: megaraid_mbox: avoid double kfree()
2026-06-01 21:02 [PATCH] scsi: megaraid_mbox: avoid double kfree() Arnd Bergmann
@ 2026-06-02 1:55 ` Martin K. Petersen
2026-06-09 1:38 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2026-06-02 1:55 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Kashyap Desai, Sumit Saxena, Shivasharan S, Chandrakanth patil,
James E.J. Bottomley, Martin K. Petersen, Arnd Bergmann,
Dan Carpenter, megaraidlinux.pdl, linux-scsi, linux-kernel
Arnd,
> Smatch found a double-free after my recent change:
>
> drivers/scsi/megaraid/megaraid_mbox.c:3474 megaraid_cmm_register()
> error: double free of 'adp' (line 3468)
>
> Since the object is no longer allocated in megaraid_cmm_register(),
> remove the kfree() as well.
Applied to 7.2/scsi-staging, thanks!
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: megaraid_mbox: avoid double kfree()
2026-06-01 21:02 [PATCH] scsi: megaraid_mbox: avoid double kfree() Arnd Bergmann
2026-06-02 1:55 ` Martin K. Petersen
@ 2026-06-09 1:38 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2026-06-09 1:38 UTC (permalink / raw)
To: Kashyap Desai, Sumit Saxena, Shivasharan S, Chandrakanth patil,
James E.J. Bottomley, Arnd Bergmann, Arnd Bergmann
Cc: Martin K . Petersen, Dan Carpenter, megaraidlinux.pdl, linux-scsi,
linux-kernel
On Mon, 01 Jun 2026 23:02:04 +0200, Arnd Bergmann wrote:
> Smatch found a double-free after my recent change:
>
> drivers/scsi/megaraid/megaraid_mbox.c:3474 megaraid_cmm_register()
> error: double free of 'adp' (line 3468)
>
> Since the object is no longer allocated in megaraid_cmm_register(),
> remove the kfree() as well.
>
> [...]
Applied to 7.2/scsi-queue, thanks!
[1/1] scsi: megaraid_mbox: avoid double kfree()
https://git.kernel.org/mkp/scsi/c/c39a9a02bc5d
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-09 1:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-01 21:02 [PATCH] scsi: megaraid_mbox: avoid double kfree() Arnd Bergmann
2026-06-02 1:55 ` Martin K. Petersen
2026-06-09 1:38 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox