Re: [PATCH v2 2/3] spi: Use bus_type functions for probe, remove and shutdown

From: Mark Brown
Date: Tue Nov 24 2020 - 08:32:29 EST


On Tue, Nov 24, 2020 at 02:01:07PM +0100, Uwe Kleine-König wrote:
> On Tue, Nov 24, 2020 at 01:03:25PM +0100, Marek Szyprowski wrote:

> > > + if (sdrv->shutdown)
> > > + sdrv->shutdown(to_spi_device(dev));
> > > }

> > In the above function dev->driver might be NULL, so its use in
> > to_spi_driver() and sdrv->shutdown leads to NULL pointer dereference. I
> > didn't check the details, but a simple check for NULL dev->driver and
> > return is enough to fix this issue. I can send such fix if you want.

> Ah, I see. shutdown is called for unbound devices, too. Assuming that
> Mark prefers a fix on top instead of an updated patch: Yes, please send
> a fix. Otherwise I can do this, too, as I introduced the problem.

Yes, please send an incremental fix (in general in a situation like this
I'd just send a fix as part of the original report, it's quicker if the
fix is OK).

Attachment: signature.asc
Description: PGP signature