* [PATCH 4.14 31/64] spi: fix IDR collision on systems with both fixed and dynamic SPI bus numbers
2018-09-27 9:03 [PATCH 4.14 00/64] 4.14.73-stable review Greg Kroah-Hartman
@ 2018-09-27 9:03 ` Greg Kroah-Hartman
0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2018-09-27 9:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Kirill Kapranov, Mark Brown
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
commit 1a4327fbf4554d5b78d75b19a13d40d6de220159 upstream.
On systems where some controllers get a dynamic ID assigned and some have
a fixed number (e.g. from ACPI tables), the current implementation might
run into an IDR collision: in case of a fixed bus number is gotten by a
driver (but not marked busy in IDR tree) and a driver with dynamic bus
number gets the same ID and predictably fails.
Fix this by means of checking-in fixed IDsin IDR as far as dynamic ones
at the moment of the controller registration.
Fixes: 9b61e302210e (spi: Pick spi bus number from Linux idr or spi alias)
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/spi/spi.c | 9 +++++++++
1 file changed, 9 insertions(+)
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2135,6 +2135,15 @@ int spi_register_controller(struct spi_c
if (WARN(id < 0, "couldn't get idr"))
return id;
ctlr->bus_num = id;
+ } else {
+ /* devices with a fixed bus num must check-in with the num */
+ mutex_lock(&board_lock);
+ id = idr_alloc(&spi_master_idr, ctlr, ctlr->bus_num,
+ ctlr->bus_num + 1, GFP_KERNEL);
+ mutex_unlock(&board_lock);
+ if (WARN(id < 0, "couldn't get idr"))
+ return id == -ENOSPC ? -EBUSY : id;
+ ctlr->bus_num = id;
}
INIT_LIST_HEAD(&ctlr->queue);
spin_lock_init(&ctlr->queue_lock);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 4.14 31/64] spi: fix IDR collision on systems with both fixed and dynamic SPI bus numbers
@ 2018-09-27 11:46 Sudip Mukherjee
2018-09-27 12:04 ` Kirill Kapranov
0 siblings, 1 reply; 5+ messages in thread
From: Sudip Mukherjee @ 2018-09-27 11:46 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, Stable, Kirill Kapranov, Mark Brown
Hi Greg,
On Thu, Sep 27, 2018 at 10:03 AM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> 4.14-stable review patch. If anyone has any objections, please let me know.
>
> ------------------
>
> From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
>
> commit 1a4327fbf4554d5b78d75b19a13d40d6de220159 upstream.
>
> On systems where some controllers get a dynamic ID assigned and some have
> a fixed number (e.g. from ACPI tables), the current implementation might
> run into an IDR collision: in case of a fixed bus number is gotten by a
> driver (but not marked busy in IDR tree) and a driver with dynamic bus
> number gets the same ID and predictably fails.
>
> Fix this by means of checking-in fixed IDsin IDR as far as dynamic ones
> at the moment of the controller registration.
>
> Fixes: 9b61e302210e (spi: Pick spi bus number from Linux idr or spi alias)
> Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> Cc: stable@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
There is another later patch which fixes this patch.
04b2d03a7565 ("spi: Fix double IDR allocation with DT aliases") , can
you please add it to the release also..
--
Regards
Sudip
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 4.14 31/64] spi: fix IDR collision on systems with both fixed and dynamic SPI bus numbers
2018-09-27 11:46 [PATCH 4.14 31/64] spi: fix IDR collision on systems with both fixed and dynamic SPI bus numbers Sudip Mukherjee
@ 2018-09-27 12:04 ` Kirill Kapranov
2018-09-27 19:20 ` Greg Kroah-Hartman
2018-09-27 21:44 ` Mark Brown
0 siblings, 2 replies; 5+ messages in thread
From: Kirill Kapranov @ 2018-09-27 12:04 UTC (permalink / raw)
To: Sudip Mukherjee, Greg Kroah-Hartman; +Cc: linux-kernel, Stable, Mark Brown
Hi Greg,
Sudip is absolutely right, the patch he mentioned,
04b2d03a7565 ("spi: Fix double IDR allocation with DT aliases"),
MUST be added too with the mine.
Sudip, thank you for reminding.
--
Best Regards,
Kirill
> Hi Greg,
>
> On Thu, Sep 27, 2018 at 10:03 AM, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
>> 4.14-stable review patch. If anyone has any objections, please let me know.
>>
>> ------------------
>>
>> From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
>>
>> commit 1a4327fbf4554d5b78d75b19a13d40d6de220159 upstream.
>>
>> On systems where some controllers get a dynamic ID assigned and some have
>> a fixed number (e.g. from ACPI tables), the current implementation might
>> run into an IDR collision: in case of a fixed bus number is gotten by a
>> driver (but not marked busy in IDR tree) and a driver with dynamic bus
>> number gets the same ID and predictably fails.
>>
>> Fix this by means of checking-in fixed IDsin IDR as far as dynamic ones
>> at the moment of the controller registration.
>>
>> Fixes: 9b61e302210e (spi: Pick spi bus number from Linux idr or spi alias)
>> Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
>> Signed-off-by: Mark Brown <broonie@kernel.org>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> There is another later patch which fixes this patch.
>
> 04b2d03a7565 ("spi: Fix double IDR allocation with DT aliases") , can
> you please add it to the release also..
>
>
> --
> Regards
> Sudip
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 4.14 31/64] spi: fix IDR collision on systems with both fixed and dynamic SPI bus numbers
2018-09-27 12:04 ` Kirill Kapranov
@ 2018-09-27 19:20 ` Greg Kroah-Hartman
2018-09-27 21:44 ` Mark Brown
1 sibling, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2018-09-27 19:20 UTC (permalink / raw)
To: Kirill Kapranov; +Cc: Sudip Mukherjee, linux-kernel, Stable, Mark Brown
On Thu, Sep 27, 2018 at 03:04:20PM +0300, Kirill Kapranov wrote:
> Hi Greg,
>
> Sudip is absolutely right, the patch he mentioned,
> 04b2d03a7565 ("spi: Fix double IDR allocation with DT aliases"),
> MUST be added too with the mine.
>
> Sudip, thank you for reminding.
Thanks, I'll go queue this up now.
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 4.14 31/64] spi: fix IDR collision on systems with both fixed and dynamic SPI bus numbers
2018-09-27 12:04 ` Kirill Kapranov
2018-09-27 19:20 ` Greg Kroah-Hartman
@ 2018-09-27 21:44 ` Mark Brown
1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2018-09-27 21:44 UTC (permalink / raw)
To: Kirill Kapranov; +Cc: Sudip Mukherjee, Greg Kroah-Hartman, linux-kernel, Stable
[-- Attachment #1: Type: text/plain, Size: 286 bytes --]
On Thu, Sep 27, 2018 at 03:04:20PM +0300, Kirill Kapranov wrote:
> Sudip is absolutely right, the patch he mentioned,
> 04b2d03a7565 ("spi: Fix double IDR allocation with DT aliases"),
> MUST be added too with the mine.
> Sudip, thank you for reminding.
Yes, they're both required.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-09-28 4:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-27 11:46 [PATCH 4.14 31/64] spi: fix IDR collision on systems with both fixed and dynamic SPI bus numbers Sudip Mukherjee
2018-09-27 12:04 ` Kirill Kapranov
2018-09-27 19:20 ` Greg Kroah-Hartman
2018-09-27 21:44 ` Mark Brown
-- strict thread matches above, loose matches on Subject: below --
2018-09-27 9:03 [PATCH 4.14 00/64] 4.14.73-stable review Greg Kroah-Hartman
2018-09-27 9:03 ` [PATCH 4.14 31/64] spi: fix IDR collision on systems with both fixed and dynamic SPI bus numbers Greg Kroah-Hartman
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).