OSDN Git Service

xhci: fix possible memleak on setup address fails.
authorIkjoon Jang <ikjn@chromium.org>
Fri, 30 Aug 2019 13:39:16 +0000 (16:39 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Sep 2019 13:49:12 +0000 (15:49 +0200)
commit9334367cda850fadc3b0ed2ff26b85e29226c1c4
tree94eb1e2e45501e1a2e84f01fe7039fc9c2bd848e
parent8a62dff2c0734a67fefd96742839a6d4bbb2587b
xhci: fix possible memleak on setup address fails.

Xhci re-enables a slot on transaction error in set_address using
xhci_disable_slot() + xhci_alloc_dev().

But in this case, xhci_alloc_dev() creates debugfs entries upon an
existing device without cleaning up old entries, thus memory leaks.

So this patch simply moves calling xhci_debugfs_free_dev() from
xhci_free_dev() to xhci_disable_slot().

[added "possible" to header as this is about failure codepath -Mathias]
Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/1567172356-12915-5-git-send-email-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci.c