[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 11 Nov 2021 06:19:23 +0100
From: Lukas Wunner <lukas@...ner.de>
To: Michael Walle <michael@...le.cc>
Cc: linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org,
Mark Brown <broonie@...nel.org>,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>,
Vladimir Oltean <olteanv@...il.com>,
Andy Shevchenko <andy.shevchenko@...il.com>
Subject: Re: [RFC PATCH] spi: fix use-after-free of the add_lock mutex
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().
>
> Fixes: 6098475d4cb4 ("spi: Fix deadlock when adding SPI controllers on SPI buses")
> Signed-off-by: Michael Walle <michael@...le.cc>
Reviewed-by: Lukas Wunner <lukas@...ner.de>
Cc: stable@...r.kernel.org # v5.15
Powered by blists - more mailing lists