lists.openwall.net   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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191216174757.050729358@linuxfoundation.org>
Date:   Mon, 16 Dec 2019 18:48:13 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     linux-kernel@...r.kernel.org
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        stable@...r.kernel.org, Wen Yang <wenyang@...ux.alibaba.com>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Peter Chen <peter.chen@....com>,
        Hans de Goede <hdegoede@...hat.com>,
        Chunfeng Yun <chunfeng.yun@...iatek.com>,
        Suzuki K Poulose <suzuki.poulose@....com>,
        linux-usb@...r.kernel.org
Subject: [PATCH 4.19 025/140] usb: roles: fix a potential use after free

From: Wen Yang <wenyang@...ux.alibaba.com>

commit 1848a543191ae32e558bb0a5974ae7c38ebd86fc upstream.

Free the sw structure only after we are done using it.
This patch just moves the put_device() down a bit to avoid the
use after free.

Fixes: 5c54fcac9a9d ("usb: roles: Take care of driver module reference counting")
Signed-off-by: Wen Yang <wenyang@...ux.alibaba.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Reviewed-by: Peter Chen <peter.chen@....com>
Cc: stable <stable@...r.kernel.org>
Cc: Hans de Goede <hdegoede@...hat.com>
Cc: Chunfeng Yun <chunfeng.yun@...iatek.com>
Cc: Suzuki K Poulose <suzuki.poulose@....com>
Cc: linux-usb@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Link: https://lore.kernel.org/r/20191124142236.25671-1-wenyang@linux.alibaba.com
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>

---
 drivers/usb/roles/class.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/usb/roles/class.c
+++ b/drivers/usb/roles/class.c
@@ -130,8 +130,8 @@ EXPORT_SYMBOL_GPL(usb_role_switch_get);
 void usb_role_switch_put(struct usb_role_switch *sw)
 {
 	if (!IS_ERR_OR_NULL(sw)) {
-		put_device(&sw->dev);
 		module_put(sw->dev.parent->driver->owner);
+		put_device(&sw->dev);
 	}
 }
 EXPORT_SYMBOL_GPL(usb_role_switch_put);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ