spi: race in spi_finalize_current_message starting queue_kthread_work before the message is unmapped

Martin Sperl kernel at martin.sperl.org
Mon May 11 12:27:35 PDT 2015

> On 11.05.2015, at 20:00, Mark Brown <broonie at kernel.org> wrote:
>> * dummy_RX/TX get allocated/released even when can_dma returns false
>>  should only run this “mapping if necessary. I guess that it is mostly
>>  usefull for DMA transfers - PIO drivers typically implement this via
>>  a simple if when tx/rx_buf is NULL.
> No, it's supposed to be usable for PIO too - it can keep logic simpler.
but only slightly - it is a simple
  (xfer->tx_buf) ? xfer->tx_buf[i] : 0
so I do not see a huge difference.

> Indeed, just having a page that gets reused would be better.  I'm hoping
> that someone who needs this will get around to optimizing it at some
> point.

I could possibly look into that, but it goes against the point you
made above about PIO.
Either we allocate the memory completely and make it work for PIO.
Or we only create a scatter/gather list of the same page and leave
tx_buf == NULL.

So unless we have a separate flag to say we only need it for DMA,
then we have to keep the the current logic with allocation or we break
other drivers.


More information about the linux-rpi-kernel mailing list