Re: Staging: serqt_usb2: kmalloc(GFP_NOIO) with spinlock held inqt_break() and qt_tiocmset()

From: Greg KH
Date: Fri Aug 05 2011 - 11:18:12 EST


On Fri, Aug 05, 2011 at 06:35:10PM +0400, Alexey Khoroshilov wrote:
> qt_break() calls usb_control_msg() with spinlock held,

Ick, not good, that will sleep.

> while usb_control_msg() calls kmalloc(GFP_NOIO) and indirectly usb_alloc_urb(GFP_NOIO).

You forgot the obvious call to wait_for_completion_timeout() in the
usb_control_msg() callchain that shows that a spinlock is not a good
thing to be using here :)

> The same is true for qt_tiocmget() and qt_tiocmset().
>
> Is replacing spinlock with mutex an appropriate solution to fix the issue?

Yes, it sounds like it.

patches gladly accepted.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/