diff options
| author | jackysliu <1972843537@qq.com> | 2025-06-24 19:58:24 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-08-28 16:28:26 +0200 |
| commit | 39cfe2c83146aad956318f866d0ee471b7a61fa5 (patch) | |
| tree | 568e6aeeeca4a5b94f1afcc24d52fd76e78e3d0d /drivers/scsi | |
| parent | 2b98d2c23317188a6ba98d9da048d14ef97da2c8 (diff) | |
| download | linux-39cfe2c83146aad956318f866d0ee471b7a61fa5.tar.gz linux-39cfe2c83146aad956318f866d0ee471b7a61fa5.tar.bz2 linux-39cfe2c83146aad956318f866d0ee471b7a61fa5.zip | |
scsi: bfa: Double-free fix
[ Upstream commit add4c4850363d7c1b72e8fce9ccb21fdd2cf5dc9 ]
When the bfad_im_probe() function fails during initialization, the memory
pointed to by bfad->im is freed without setting bfad->im to NULL.
Subsequently, during driver uninstallation, when the state machine enters
the bfad_sm_stopping state and calls the bfad_im_probe_undo() function,
it attempts to free the memory pointed to by bfad->im again, thereby
triggering a double-free vulnerability.
Set bfad->im to NULL if probing fails.
Signed-off-by: jackysliu <1972843537@qq.com>
Link: https://lore.kernel.org/r/tencent_3BB950D6D2D470976F55FC879206DE0B9A09@qq.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/scsi')
| -rw-r--r-- | drivers/scsi/bfa/bfad_im.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index a9d3d8562d3c..0ec76d1cb6fb 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c @@ -706,6 +706,7 @@ bfad_im_probe(struct bfad_s *bfad) if (bfad_thread_workq(bfad) != BFA_STATUS_OK) { kfree(im); + bfad->im = NULL; return BFA_STATUS_FAILED; } |
