Message ID | 1525105254-2852-2-git-send-email-b-liu@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Apr 30, 2018 at 11:20:53AM -0500, Bin Liu wrote: > musb_start_urb() doesn't check the pass-in parameter if it is NULL. But > in musb_bulk_nak_timeout() the parameter passed to musb_start_urb() is > returned from first_qh(), which could be NULL. > > So wrap the musb_start_urb() call here with a if condition check to > avoid the potential NULL pointer dereference. > > Fixes: f283862f3b5cb("usb: musb: NAK timeout scheme on bulk TX endpoint") Nit, you forgot a ' ', this should be: f283862f3b5c ("usb: musb: NAK timeout scheme on bulk TX endpoint") You also had one extra id value in there, odd. I'll edit this by hand... greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Apr 30, 2018 at 09:42:15AM -0700, Greg Kroah-Hartman wrote: > On Mon, Apr 30, 2018 at 11:20:53AM -0500, Bin Liu wrote: > > musb_start_urb() doesn't check the pass-in parameter if it is NULL. But > > in musb_bulk_nak_timeout() the parameter passed to musb_start_urb() is > > returned from first_qh(), which could be NULL. > > > > So wrap the musb_start_urb() call here with a if condition check to > > avoid the potential NULL pointer dereference. > > > > Fixes: f283862f3b5cb("usb: musb: NAK timeout scheme on bulk TX endpoint") > > Nit, you forgot a ' ', this should be: > f283862f3b5c ("usb: musb: NAK timeout scheme on bulk TX endpoint") Sorry, thanks. > You also had one extra id value in there, odd. I'll edit this by Not sure why 'git blame' gives that one extra on my computer. I will see if I will figure it out... > hand... Thanks, -Bin. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Apr 30, 2018 at 01:11:34PM -0500, Bin Liu wrote: > On Mon, Apr 30, 2018 at 09:42:15AM -0700, Greg Kroah-Hartman wrote: > > On Mon, Apr 30, 2018 at 11:20:53AM -0500, Bin Liu wrote: > > > musb_start_urb() doesn't check the pass-in parameter if it is NULL. But > > > in musb_bulk_nak_timeout() the parameter passed to musb_start_urb() is > > > returned from first_qh(), which could be NULL. > > > > > > So wrap the musb_start_urb() call here with a if condition check to > > > avoid the potential NULL pointer dereference. > > > > > > Fixes: f283862f3b5cb("usb: musb: NAK timeout scheme on bulk TX endpoint") > > > > Nit, you forgot a ' ', this should be: > > f283862f3b5c ("usb: musb: NAK timeout scheme on bulk TX endpoint") > > Sorry, thanks. > > > You also had one extra id value in there, odd. I'll edit this by > > Not sure why 'git blame' gives that one extra on my computer. I will see > if I will figure it out... Why use 'git blame'? I use: git show -s --abbrev-commit --abbrev=12 --pretty=format:"%h (\"%s\")%n" to generate these types of lines. thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Apr 30, 2018 at 11:24:48AM -0700, Greg Kroah-Hartman wrote: > On Mon, Apr 30, 2018 at 01:11:34PM -0500, Bin Liu wrote: > > On Mon, Apr 30, 2018 at 09:42:15AM -0700, Greg Kroah-Hartman wrote: > > > On Mon, Apr 30, 2018 at 11:20:53AM -0500, Bin Liu wrote: > > > > musb_start_urb() doesn't check the pass-in parameter if it is NULL. But > > > > in musb_bulk_nak_timeout() the parameter passed to musb_start_urb() is > > > > returned from first_qh(), which could be NULL. > > > > > > > > So wrap the musb_start_urb() call here with a if condition check to > > > > avoid the potential NULL pointer dereference. > > > > > > > > Fixes: f283862f3b5cb("usb: musb: NAK timeout scheme on bulk TX endpoint") > > > > > > Nit, you forgot a ' ', this should be: > > > f283862f3b5c ("usb: musb: NAK timeout scheme on bulk TX endpoint") > > > > Sorry, thanks. > > > > > You also had one extra id value in there, odd. I'll edit this by > > > > Not sure why 'git blame' gives that one extra on my computer. I will see > > if I will figure it out... > > Why use 'git blame'? I use: > git show -s --abbrev-commit --abbrev=12 --pretty=format:"%h (\"%s\")%n" > > to generate these types of lines. My ~/.gitconfig already has abbrev = 12 but I used 'git blame' to find the commit id which introduces the bug, then just directly copied the commit id from there... only until now know 'git blame' gives 13 chars... I will create a shortcut for the command you gave above to avoid this 13 chars problem from now on. Thanks, -Bin. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 4fa372c845e1..e7f99d55922a 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c @@ -990,7 +990,9 @@ static void musb_bulk_nak_timeout(struct musb *musb, struct musb_hw_ep *ep, /* set tx_reinit and schedule the next qh */ ep->tx_reinit = 1; } - musb_start_urb(musb, is_in, next_qh); + + if (next_qh) + musb_start_urb(musb, is_in, next_qh); } }
musb_start_urb() doesn't check the pass-in parameter if it is NULL. But in musb_bulk_nak_timeout() the parameter passed to musb_start_urb() is returned from first_qh(), which could be NULL. So wrap the musb_start_urb() call here with a if condition check to avoid the potential NULL pointer dereference. Fixes: f283862f3b5cb("usb: musb: NAK timeout scheme on bulk TX endpoint") Cc: stable@vger.kernel.org # v3.7+ Signed-off-by: Bin Liu <b-liu@ti.com> --- drivers/usb/musb/musb_host.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)