RE: [PATCH v2] OMAP:MUSB: Corrects urb unlink function path

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

 



On Fri, Aug 22, 2008 at 01:32:12PM -0400, Alan Stern wrote:
> On Fri, 22 Aug 2008 ajay.gupta@xxxxxx wrote:
>
> > @@ -1785,9 +1784,11 @@ static int musb_urb_enqueue(
> >      * REVISIT consider a dedicated qh kmem_cache, so it's harder
> >      * for bugs in other kernel code to break this driver...
> >      */
>
> This doesn't look right.  After calling spin_lock_irqsave you are in an
> atomic context, so you can't pass mem_flags to kzalloc.
>
> Either move the spin_lock_irqsave after the call to kzalloc or else
> change mem_flags to GFP_ATOMIC.

first one, please.

should be like:

        qh = kzalloc(sizeof *qh, mem_flags);
        if (!qh) {
+               spin_lock_irqsave(&musb->lock, flags);
                usb_hcd_unlink_urb_from_ep(hcd, urb);
+               spin_unlock_irqrestore(&musb->lock, flags);
                return -ENOMEM;
        }

Similarly at the end of enqueue(),
         if (ret != 0) {
+               spin_lock_irqsave(&musb->lock, flags);
                 usb_hcd_unlink_urb_from_ep(hcd, urb);
+               spin_unlock_irqrestore(&musb->lock, flags);
                 kfree(qh);
         }
So hold the musb->lock at the two places in enqueue path and no 
other change. If this is fine then I will resubmit with this modification.

--Ajay
--
balbi--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux