[PATCH] pxa2xx_spi: Fix race condition in stop_queue()

Mike Frysinger vapier at gentoo.org
Mon Apr 4 13:35:14 EDT 2011


On Fri, Apr 1, 2011 at 06:03, Vasily Khoruzhick wrote:
> On Friday 01 April 2011 10:26:37 Eric Miao wrote:
>> On Mon, Mar 14, 2011 at 6:27 AM, Vasily Khoruzhick wrote:
>> > There's a race condition in stop_queue(),
>> > if drv_data->queue is empty, but drv_data->busy is still set
>> > (or opposite situation) stop_queue will return -EBUSY.
>> > So fix loop condition to check that both drv_data->queue is empty
>> > and drv_data->busy is not set.
>>
>> I think this is a good catch if the queue could be stopped only when
>> 1) queue is empty AND 2) transfer is not in progress.
>
> It has check later (under while):
>
> if (!list_empty(&drv_data->queue) || drv_data->busy)
>        status = -EBUSY;
>
> And I'm hitting it on Z2 when I'm trying to enter suspend - it fails, because
> spi driver refuses to enter suspend.
>
>> There are several other places you might need to change accordingly,
>> e.g. spi_bfin5xx.c
>
> I can make a patch for other drivers, but I can't test it - I have no
> appropriate boards, and even toolchain.

that's fine, i do.  was this patch actually merged ?  or is there a
new version on the way ?
-mike



More information about the linux-arm-kernel mailing list