aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJia-Ju Bai <baijiaju1990@gmail.com>2019-05-22 14:33:58 +0300
committerPaul Gortmaker <paul.gortmaker@windriver.com>2019-09-16 12:21:34 -0400
commitda6d4c7650a24c56c631b844787020eaa0ef9f90 (patch)
tree726da1acbe3d2ba6eecef3f55c31d4d4ef9ea124
parent73940f2a969da142af11c1ed90fafa6ef61fe491 (diff)
downloadlinux-yocto-da6d4c7650a24c56c631b844787020eaa0ef9f90.tar.gz
linux-yocto-da6d4c7650a24c56c631b844787020eaa0ef9f90.tar.bz2
linux-yocto-da6d4c7650a24c56c631b844787020eaa0ef9f90.zip
usb: xhci: Fix a potential null pointer dereference in xhci_debugfs_create_endpoint()
commit 5bce256f0b528624a34fe907db385133bb7be33e upstream. In xhci_debugfs_create_slot(), kzalloc() can fail and dev->debugfs_private will be NULL. In xhci_debugfs_create_endpoint(), dev->debugfs_private is used without any null-pointer check, and can cause a null pointer dereference. To fix this bug, a null-pointer check is added in xhci_debugfs_create_endpoint(). This bug is found by a runtime fuzzing tool named FIZZER written by us. [subjet line change change, add potential -Mathais] Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r--drivers/usb/host/xhci-debugfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci-debugfs.c b/drivers/usb/host/xhci-debugfs.c
index cadc01336bf8..7ba6afc7ef23 100644
--- a/drivers/usb/host/xhci-debugfs.c
+++ b/drivers/usb/host/xhci-debugfs.c
@@ -440,6 +440,9 @@ void xhci_debugfs_create_endpoint(struct xhci_hcd *xhci,
struct xhci_ep_priv *epriv;
struct xhci_slot_priv *spriv = dev->debugfs_private;
+ if (!spriv)
+ return;
+
if (spriv->eps[ep_index])
return;