Linux SPI subsystem development
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: linux-spi@vger.kernel.org
Subject: Re: users of spi_unregister_controller() broken?
Date: Mon, 21 Sep 2020 13:00:29 +0100	[thread overview]
Message-ID: <20200921120029.GA4792@sirena.org.uk> (raw)
In-Reply-To: <20200921110805.GI21278@pengutronix.de>

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

On Mon, Sep 21, 2020 at 01:08:05PM +0200, Sascha Hauer wrote:

> I see the following KASan use-after-free messages from the fsl-dspi
> driver. It seems that after spi_unregister_controller() has been called
> no references to the SPI controller device are left and the device is
> freed in spi_controller_release(). This also frees the driver data
> structure which is allocated with spi_alloc_master(). Nevertheless all
> users of spi_unregister_controller() still use their driver data after
> having called spi_unregister_controller().

> Any idea what to do about this?

Drivers that need to use their driver_data in remove() should either use
devm_spi_register_controller() or not use spi_register_controller() to
allocate driver_data.  Depending on what the remove function does it may
not be practical to do the former, most likely it won't be.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-09-21 12:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-21 11:08 users of spi_unregister_controller() broken? Sascha Hauer
2020-09-21 12:00 ` Mark Brown [this message]
2020-09-22 10:07   ` Vladimir Oltean
2020-09-22 11:22     ` Mark Brown

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=20200921120029.GA4792@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=s.hauer@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