From: Mark Brown <broonie@kernel.org>
To: Michael Walle <michael@walle.cc>
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Vladimir Oltean" <olteanv@gmail.com>
Subject: Re: [RFC PATCH] spi: fix use-after-free of the add_lock mutex
Date: Wed, 10 Nov 2021 16:27:27 +0000 [thread overview]
Message-ID: <YYvy79HfTvy8hC5/@sirena.org.uk> (raw)
In-Reply-To: <20211110160836.3304104-1-michael@walle.cc>
[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]
On Wed, Nov 10, 2021 at 05:08:36PM +0100, Michael Walle wrote:
> Commit 6098475d4cb4 ("spi: Fix deadlock when adding SPI controllers on
> SPI buses") introduced a per-controller mutex. But mutex_unlock() of
> said lock is called after the controller is already freed:
>
> spi_unregister_controller(ctlr)
> -> put_device(&ctlr->dev)
> -> spi_controller_release(dev)
> mutex_unlock(&ctrl->add_lock)
>
> Move the put_device() after the mutex_unlock().
Do we even need to unlock the mutex here?
>
> For reference, the kernel oops is:
> [ 20.242505] Unable to handle kernel paging request at virtual address 0042a2203dc65260
> [ 20.250468] Mem abort info:
> [ 20.253270] ESR = 0x96000044
Please think hard before including complete backtraces in upstream
reports, they are very large and contain almost no useful information
relative to their size so often obscure the relevant content in your
message. If part of the backtrace is usefully illustrative (it often is
for search engines if nothing else) then it's usually better to pull out
the relevant sections.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-11-10 16:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-10 16:08 Michael Walle
2021-11-10 16:27 ` Mark Brown [this message]
2021-11-10 16:30 ` Michael Walle
2021-11-10 16:39 ` Mark Brown
2021-11-10 16:49 ` Andy Shevchenko
2021-11-10 17:28 ` Uwe Kleine-König
2021-11-11 5:19 ` Lukas Wunner
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=YYvy79HfTvy8hC5/@sirena.org.uk \
--to=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=michael@walle.cc \
--cc=olteanv@gmail.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
Powered by JetHome