Skip to contentSkip to conversation

misc: mic: scif: fix double free of scif_dev

PATCH New Kefeng Wang 1 participant 1 message May 31, 2019 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 misc: mic: scif: fix double free of scif_dev

_scif_init() free scif_dev in the free_sdev erro path, but _scif_exit will free it again when module exit, it cause BUG_ON issue,

kernel BUG at mm/slub.c:3944!
invalid opcode: 0000 [#1] SMP KASAN PTI

Set scif_dev to NULL in scif_destroy_scifdev() to fix it.

Cc Sudeep Dutt <[email protected]>
Cc Ashutosh Dixit <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/misc/mic/scif/scif_main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/misc/mic/scif/scif_main.c +1 -0
index 36d847af1209..7f9ce0fe1e24 100644
@@ -142,6 +142,7 @@ static int scif_setup_scifdev(void)
 static void scif_destroy_scifdev(void)
 {
 	kfree(scif_dev);
+	scif_dev = NULL;
 }
 
 static int scif_probe(struct scif_hw_dev *sdev)
Signature · 1 line
2.20.1