Re: [PATCH] hid: usbhid: fix possible deadlock in __usbhid_submit_report

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

 



On Sat, Apr 21, 2012 at 5:59 AM, Dmitry Torokhov
<dmitry.torokhov@xxxxxxxxx> wrote:
> On Friday, April 20, 2012 06:17:51 PM Ming Lei wrote:

> Why don't you do something like this:
>
>        urb_to_unlink = usbhid->urbout;
>        usbhid->urbout = NULL;

This may trigger oops in hid_submit_out called by hid_irq_out.

Even though you can check if usbhid->urbout is NULL inside
hid_submit_out, and just not submit it if it is NULL, then the solution
become similar with Oliver's idea, and the problem is that when the
usbhid->urbout will be resubmitted, which looks may involve much
more changes than the per cpu flag patch.

The difficulty is in the race between unlink with complete handler(irq),
both may run concurrently on different CPUs.

>
>        spin_unlock(&usbhid->lock);
>        usb_unlink_urb(urb_to_unlink);
>        spin_lock(&usbhid->lock);
>
> and of course comment it properly.
>
> Thanks.
>
> --
> Dmitry



Thanks,
--
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-input" 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 Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux