linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] USB: EHCI: fix dereference of ERR_PTR
@ 2015-09-16 14:08 Sudip Mukherjee
  2015-09-16 14:16 ` Fabio Estevam
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Sudip Mukherjee @ 2015-09-16 14:08 UTC (permalink / raw)
  To: Alan Stern, Greg Kroah-Hartman; +Cc: linux-kernel, linux-usb, Sudip Mukherjee

On error find_tt() returns either a NULL pointer or the error value in
ERR_PTR. But we were dereferencing it directly without even checking if
find_tt() returned a valid pointer or not.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/usb/host/ehci-sched.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index f9a3327..27bced7 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -257,6 +257,8 @@ static void reserve_release_intr_bandwidth(struct ehci_hcd *ehci,
 	/* FS/LS bus bandwidth */
 	if (tt_usecs) {
 		tt = find_tt(qh->ps.udev);
+		if (!tt || IS_ERR(tt))
+			return;
 		if (sign > 0)
 			list_add_tail(&qh->ps.ps_list, &tt->ps_list);
 		else
@@ -1373,6 +1375,8 @@ static void reserve_release_iso_bandwidth(struct ehci_hcd *ehci,
 		}
 
 		tt = find_tt(stream->ps.udev);
+		if (!tt || IS_ERR(tt))
+			return;
 		if (sign > 0)
 			list_add_tail(&stream->ps.ps_list, &tt->ps_list);
 		else
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-09-21  4:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-16 14:08 [PATCH] USB: EHCI: fix dereference of ERR_PTR Sudip Mukherjee
2015-09-16 14:16 ` Fabio Estevam
2015-09-16 14:25 ` Sergei Shtylyov
2015-09-16 16:22 ` [PATCH v2] " Sudip Mukherjee
2015-09-16 16:54   ` Alan Stern
2015-09-18  5:48     ` Sudip Mukherjee
2015-09-18 14:45       ` Alan Stern
2015-09-21  2:48 ` [PATCH] " Lu, Baolu
2015-09-21  4:49   ` Sudip Mukherjee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).