]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scsi: bfa: Double-free fix
authorjackysliu <1972843537@qq.com>
Tue, 24 Jun 2025 11:58:24 +0000 (19:58 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 15 Jul 2025 01:10:30 +0000 (21:10 -0400)
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>
drivers/scsi/bfa/bfad_im.c

index a719a18f0fbcf753661ad90a7930b15c3470e589..f56e008ee52b1d5cb1d2788c0cdf0ba4a4f89f49 100644 (file)
@@ -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;
        }