Re: [PATCH] spi: Avoid calling spi_slave_abort() with kfreed spidev

From: Mark Brown
Date: Tue Oct 01 2019 - 07:41:27 EST


On Tue, Oct 01, 2019 at 12:00:07PM +0200, Geert Uytterhoeven wrote:
> On Tue, Oct 1, 2019 at 11:34 AM Lukasz Majewski <lukma@xxxxxxx> wrote:
> > > On Tue, Oct 1, 2019 at 11:07 AM Lukasz Majewski <lukma@xxxxxxx> wrote:

> > The if (!dofree) prevents from calling spi_slave_abort() when
> > spidev->spi == NULL and spidev is kfree'd.

> If spidev->users != 0, the block checking spidev->spi == NULL is never
> executed, and spi_slave_abort() will be called.

> I'm wondering if spidev->spi can be NULL if spidev->users is still positive.

It *shouldn't* be. I think we have other problems if it is.

Attachment: signature.asc
Description: PGP signature