* Re: Patch "spi: Fix controller unregister order" has been added to the 4.4-stable tree
[not found] <20200616015646.AC54E2074D@mail.kernel.org>
@ 2020-10-10 8:41 ` yangerkun
2020-12-05 17:42 ` Lukas Wunner
0 siblings, 1 reply; 3+ messages in thread
From: yangerkun @ 2020-10-10 8:41 UTC (permalink / raw)
To: linux-kernel, lukas, sashal, chenwenyong2; +Cc: stable-commits, zhangyi (F)
在 2020/6/16 9:56, Sasha Levin 写道:
> This is a note to let you know that I've just added the patch titled
>
> spi: Fix controller unregister order
>
> to the 4.4-stable tree which can be found at:
> http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
>
> The filename of the patch is:
> spi-fix-controller-unregister-order.patch
> and it can be found in the queue-4.4 subdirectory.
>
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable@vger.kernel.org> know about it.
>
>
>
> commit af9adff04d45f726c49bc1be4a401877e627adf3
> Author: Lukas Wunner <lukas@wunner.de>
> Date: Fri May 15 17:58:01 2020 +0200
>
> spi: Fix controller unregister order
>
> [ Upstream commit 84855678add8aba927faf76bc2f130a40f94b6f7 ]
>
> When an SPI controller unregisters, it unbinds all its slave devices.
> For this, their drivers may need to access the SPI bus, e.g. to quiesce
> interrupts.
>
> However since commit ffbbdd21329f ("spi: create a message queueing
> infrastructure"), spi_destroy_queue() is executed before unbinding the
> slaves. It sets ctlr->running = false, thereby preventing SPI bus
> access and causing unbinding of slave devices to fail.
>
> Fix by unbinding slaves before calling spi_destroy_queue().
>
> Fixes: ffbbdd21329f ("spi: create a message queueing infrastructure")
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> Cc: stable@vger.kernel.org # v3.4+
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Link: https://lore.kernel.org/r/8aaf9d44c153fe233b17bc2dec4eb679898d7e7b.1589557526.git.lukas@wunner.de
> Signed-off-by: Mark Brown <broonie@kernel.org>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
>
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index e5460d84ed08..57001f8f727a 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -1922,11 +1922,12 @@ void spi_unregister_master(struct spi_master *master)
> dev_err(&master->dev, "queue remove failed\n");
> }
>
> + device_for_each_child(&master->dev, NULL, __unregister);
> +
Hi,
This is a wrong patch. We should move this line before
spi_destroy_queue, but we didn't. 4.9 stable exists this
problem too.
Thanks,
Kun.
> mutex_lock(&board_lock);
> list_del(&master->list);
> mutex_unlock(&board_lock);
>
> - device_for_each_child(&master->dev, NULL, __unregister);
> device_unregister(&master->dev);
> }
> EXPORT_SYMBOL_GPL(spi_unregister_master);
>
> .
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Patch "spi: Fix controller unregister order" has been added to the 4.4-stable tree
2020-10-10 8:41 ` Patch "spi: Fix controller unregister order" has been added to the 4.4-stable tree yangerkun
@ 2020-12-05 17:42 ` Lukas Wunner
2020-12-06 9:47 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Lukas Wunner @ 2020-12-05 17:42 UTC (permalink / raw)
To: yangerkun, sashal, gregkh; +Cc: linux-kernel, chenwenyong2, stable, zhangyi (F)
On Sat, Oct 10, 2020 at 04:41:09PM +0800, yangerkun wrote:
> ?? 2020/6/16 9:56, Sasha Levin ????:
> > This is a note to let you know that I've just added the patch titled
> >
> > spi: Fix controller unregister order
> >
> > to the 4.4-stable tree which can be found at:
[...]
> > --- a/drivers/spi/spi.c
> > +++ b/drivers/spi/spi.c
> > @@ -1922,11 +1922,12 @@ void spi_unregister_master(struct spi_master *master)
> > dev_err(&master->dev, "queue remove failed\n");
> > }
> > + device_for_each_child(&master->dev, NULL, __unregister);
> > +
>
> This is a wrong patch. We should move this line before
> spi_destroy_queue, but we didn't. 4.9 stable exists this
> problem too.
Hi Sasha, Hi Greg,
below please find a patch for the 4.9-stable tree to fix the backporting
issue reported above.
Thanks!
-- >8 --
Subject: [PATCH] spi: Fix controller unregister order harder
Commit c7e41e1caa71 sought to backport upstream commit 84855678add8 to
the 4.9-stable tree but erroneously inserted a line at the wrong place.
Fix it.
Fixes: c7e41e1caa71 ("spi: Fix controller unregister order")
Reported-by: yangerkun <yangerkun@huawei.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
drivers/spi/spi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index c7c9ca3178ad..e0632ee1723b 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2070,13 +2070,13 @@ static int __unregister(struct device *dev, void *null)
*/
void spi_unregister_master(struct spi_master *master)
{
+ device_for_each_child(&master->dev, NULL, __unregister);
+
if (master->queued) {
if (spi_destroy_queue(master))
dev_err(&master->dev, "queue remove failed\n");
}
- device_for_each_child(&master->dev, NULL, __unregister);
-
mutex_lock(&board_lock);
list_del(&master->list);
mutex_unlock(&board_lock);
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: Patch "spi: Fix controller unregister order" has been added to the 4.4-stable tree
2020-12-05 17:42 ` Lukas Wunner
@ 2020-12-06 9:47 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2020-12-06 9:47 UTC (permalink / raw)
To: Lukas Wunner
Cc: yangerkun, sashal, linux-kernel, chenwenyong2, stable, zhangyi (F)
On Sat, Dec 05, 2020 at 06:42:07PM +0100, Lukas Wunner wrote:
> On Sat, Oct 10, 2020 at 04:41:09PM +0800, yangerkun wrote:
> > ?? 2020/6/16 9:56, Sasha Levin ????:
> > > This is a note to let you know that I've just added the patch titled
> > >
> > > spi: Fix controller unregister order
> > >
> > > to the 4.4-stable tree which can be found at:
> [...]
> > > --- a/drivers/spi/spi.c
> > > +++ b/drivers/spi/spi.c
> > > @@ -1922,11 +1922,12 @@ void spi_unregister_master(struct spi_master *master)
> > > dev_err(&master->dev, "queue remove failed\n");
> > > }
> > > + device_for_each_child(&master->dev, NULL, __unregister);
> > > +
> >
> > This is a wrong patch. We should move this line before
> > spi_destroy_queue, but we didn't. 4.9 stable exists this
> > problem too.
>
> Hi Sasha, Hi Greg,
>
> below please find a patch for the 4.9-stable tree to fix the backporting
> issue reported above.
Now applied, thanks.
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-12-06 9:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20200616015646.AC54E2074D@mail.kernel.org>
2020-10-10 8:41 ` Patch "spi: Fix controller unregister order" has been added to the 4.4-stable tree yangerkun
2020-12-05 17:42 ` Lukas Wunner
2020-12-06 9:47 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.