linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de,
	linux-spi@vger.kernel.org
Subject: Re: [PATCH v2 2/3] spi: Use bus_type functions for probe, remove and shutdown
Date: Tue, 24 Nov 2020 13:31:39 +0000	[thread overview]
Message-ID: <20201124133139.GB4933@sirena.org.uk> (raw)
In-Reply-To: <20201124130107.2yvgk7kheep5gd6z@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 904 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-11-24 13:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-19 16:16 [PATCH v2 1/3] spi: fix resource leak for drivers without .remove callback Uwe Kleine-König
2020-11-19 16:16 ` [PATCH v2 2/3] spi: Use bus_type functions for probe, remove and shutdown Uwe Kleine-König
     [not found]   ` <CGME20201124120324eucas1p189ec6eed6d6477e27a194f9d75d7b43a@eucas1p1.samsung.com>
2020-11-24 12:03     ` Marek Szyprowski
2020-11-24 13:01       ` Uwe Kleine-König
2020-11-24 13:31         ` Mark Brown [this message]
2020-11-19 16:16 ` [PATCH v2 3/3] spi: Warn when a driver's remove callback returns an error Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201124133139.GB4933@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).