summaryrefslogtreecommitdiffstats
path: root/drivers/misc/mic
diff options
context:
space:
mode:
authorKefeng Wang <wangkefeng.wang@huawei.com>2019-05-31 23:23:24 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-10 18:44:22 +0200
commitb0c35cb59f7b640f455fa426074fea155296a37c (patch)
tree81f301852d8a6e79e33af1f6bfe93311b7a342d5 /drivers/misc/mic
parent2f0f2441b4a10948e2ec042b48fef13680387f7c (diff)
downloadlinux-b0c35cb59f7b640f455fa426074fea155296a37c.tar.bz2
misc: mic: scif: fix potential 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 <sudeep.dutt@intel.com> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mic')
-rw-r--r--drivers/misc/mic/scif/scif_main.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/misc/mic/scif/scif_main.c b/drivers/misc/mic/scif/scif_main.c
index 490e3bdc1941..e2278bf9f11d 100644
--- a/drivers/misc/mic/scif/scif_main.c
+++ b/drivers/misc/mic/scif/scif_main.c
@@ -133,6 +133,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)