]> asedeno.scripts.mit.edu Git - linux.git/commit
usb: xhci: Fix potential memory leak in xhci_disable_slot()
authorLu Baolu <baolu.lu@linux.intel.com>
Thu, 5 Oct 2017 08:21:41 +0000 (11:21 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Oct 2017 09:01:57 +0000 (11:01 +0200)
commitcd3f1790b006d91786728c20a01da21ee277aff1
tree6f04399ab0089e40532cb86cf755b00490ebc172
parentb64149ca016c25f30b39ac5a8f37cfb9017e19bb
usb: xhci: Fix potential memory leak in xhci_disable_slot()

xhci_disable_slot() allows the invoker to pass a command pointer
as paramenter. Otherwise, it will allocate one. This will cause
memory leak when a command structure was allocated inside of this
function while queuing command trb fails. Another problem comes up
when the invoker passed a command pointer, but xhci_disable_slot()
frees it when it detects a dead host.

This patch fixes these two problems by removing the command parameter
from xhci_disable_slot().

Fixes: f9e609b82479 ("usb: xhci: Add helper function xhci_disable_slot().")
Cc: Guoqing Zhang <guoqing.zhang@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-hub.c
drivers/usb/host/xhci.c
drivers/usb/host/xhci.h