[PATCH] spi: bcm2835: Add spi_master_get() call to prevent use after free

Mark Brown broonie at kernel.org
Thu Aug 22 09:26:10 EDT 2013

On Thu, Aug 22, 2013 at 08:45:37PM +0800, Axel Lin wrote:

> spi_unregister_master().
> If spi_unregister_master() free the memory, we should not access the
> memory allocated
> by spi_alloc_master().
> Thus add spi_master_get() to prevent spi_unregister_master() free the memory.
> And then call spi_master_put only after the last access to device data.

Ah, right - I'd forgotten that spi is a bit unusual here in managing the
devdata by itself.  Yes, that's an issue.  However it does seem that the
changelog isn't quite describing the problem since it's not saying why
there isn't a leak introduced.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-rpi-kernel/attachments/20130822/4427c27e/attachment.sig>

More information about the linux-rpi-kernel mailing list