Skip to content

Commit add4c48

Browse files
forsaken641martinkpetersen
authored andcommitted
scsi: bfa: Double-free fix
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent b99a506 commit add4c48

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/scsi/bfa/bfad_im.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,7 @@ bfad_im_probe(struct bfad_s *bfad)
706706

707707
if (bfad_thread_workq(bfad) != BFA_STATUS_OK) {
708708
kfree(im);
709+
bfad->im = NULL;
709710
return BFA_STATUS_FAILED;
710711
}
711712

0 commit comments

Comments
 (0)