On Tue, 18 Dec 2012, Chen Gang wrote: > although we can not say it is surely a bug. > it is better to set urb->hcpriv = NULL, after finish calling urb_free_priv. > before kfree urb_priv, better to judge whether urb_priv == NULL, firstly. > > Signed-off-by: Chen Gang <gang.chen@xxxxxxxxxxx> > --- > drivers/usb/host/ohci-q.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c > index 7482cfb..6671107 100644 > --- a/drivers/usb/host/ohci-q.c > +++ b/drivers/usb/host/ohci-q.c > @@ -12,8 +12,12 @@ > > static void urb_free_priv (struct ohci_hcd *hc, urb_priv_t *urb_priv) > { > - int last = urb_priv->length - 1; > + int last; > > + if (!urb_priv) > + return; > + > + last = urb_priv->length - 1; Please don't do this. If urb_priv is NULL, that's a bug. We want it to cause a visible error, not silently fail. > if (last >= 0) { > int i; > struct td *td; > @@ -44,6 +48,7 @@ __acquires(ohci->lock) > // ASSERT (urb->hcpriv != 0); > > urb_free_priv (ohci, urb->hcpriv); > + urb->hcpriv = NULL; > if (likely(status == -EINPROGRESS)) > status = 0; This part is okay. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html