lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Fri, 20 Nov 2020 15:48:44 +0800
From:   Qinglang Miao <>
To:     David Kershner <>,
CC:     <>,
        Qinglang Miao <>
Subject: [PATCH] drivers: visorbus: fix use-after free bugs

kfree(dev) is called in put_device(&dev->device) so that following
use would cause use-after-free bug.

There are two inappropriate use of put_device:

1. In create_visor_device, put dev_err before put_device to fix this.

2. In remove_visor_device, the former put_device is redundant because
   device_unregister contains put_device already.

Fixes: 93d3ad90c2d4 ("drivers: visorbus: move driver out of staging")
Reported-by: Hulk Robot <>
Signed-off-by: Qinglang Miao <>
 drivers/visorbus/visorbus_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/visorbus/visorbus_main.c b/drivers/visorbus/visorbus_main.c
index 152fd29f0..031349baf 100644
--- a/drivers/visorbus/visorbus_main.c
+++ b/drivers/visorbus/visorbus_main.c
@@ -695,15 +695,14 @@ int create_visor_device(struct visor_device *dev)
 	return 0;
-	put_device(&dev->device);
 	dev_err(&dev->device, "Creating visor device failed. %d\n", err);
+	put_device(&dev->device);
 	return err;
 void remove_visor_device(struct visor_device *dev)
-	put_device(&dev->device);
 	if (dev->pending_msg_hdr)
 		visorbus_response(dev, 0, CONTROLVM_DEVICE_DESTROY);

Powered by blists - more mailing lists