* [PATCH] scsi: megaraid_mbox: avoid double kfree()
@ 2026-06-01 21:02 Arnd Bergmann
2026-06-02 1:55 ` Martin K. Petersen
0 siblings, 1 reply; 2+ 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] 2+ 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
0 siblings, 0 replies; 2+ 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] 2+ messages in thread
end of thread, other threads:[~2026-06-02 1:55 UTC | newest]
Thread overview: 2+ 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
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.