Re: [Suggestion] drivers/usb/host/ohci* : not setting urb->hcpriv = NULL after kfree it.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 17 Dec 2012, Chen Gang wrote:

>     are all kfree for urb->hcpriv in lock protected ? 

Yes.  The only one is in urb_free_priv, and it is always called with 
the lock held.

>       (set urb->hcpriv = NULL in usb_hcd_giveback_urb, not in lock protected).
>     can you be sure that it is no synchronization issue ?

Yes.

>       if you can be sure
>         would you please explain to me (I am learning).

It is pretty much as I explained in my previous email.

finish_urb calls usb_free_priv while holding the lock.  Then while 
still holding the lock, it calls usb_hcd_unlink_urb_from_ep.

In addition, ohci_urb_dequeue calls usb_hcd_check_unlink_urb while 
holding the lock, and does nothing if the return value is nonzero.

So all you need to do is verify that after usb_hcd_unlink_urb_from_ep 
runs, usb_hcd_check_unlink_urb will always return a nonzero value.  In 
fact, it will return -EIDRM -- until the next time the URB is submitted 
and usb_hcd_link_urb_to_ep is called.

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux