All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@kernel.org>
To: Marek Vasut <marex@denx.de>
Cc: "Alexis Lothoré" <alexis.lothore@bootlin.com>,
	"Ajay Singh" <ajay.kathat@microchip.com>,
	"Claudiu Beznea" <claudiu.beznea@tuxon.dev>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH wireless] wifi: wilc1000: unregister wiphy only if it has been registered
Date: Tue, 07 Jan 2025 17:22:23 +0200	[thread overview]
Message-ID: <87sepur6mo.fsf@kernel.org> (raw)
In-Reply-To: <81554a5e-5b86-4944-9565-4e2aed5fd0ef@denx.de> (Marek Vasut's message of "Mon, 23 Dec 2024 20:19:10 +0100")

Marek Vasut <marex@denx.de> writes:

> On 12/23/24 4:46 PM, Alexis Lothoré wrote:
>
>> There is a specific error path in probe functions in wilc drivers (both
>> sdio and spi) which can lead to kernel panic, as this one for example
>> when using SPI:
>> Unable to handle kernel paging request at virtual address 9f000000
>> when read
>> [9f000000] *pgd=00000000
>> Internal error: Oops: 5 [#1] ARM
>> Modules linked in: wilc1000_spi(+) crc_itu_t crc7 wilc1000 cfg80211 bluetooth ecdh_generic ecc
>> CPU: 0 UID: 0 PID: 106 Comm: modprobe Not tainted 6.13.0-rc3+ #22
>> Hardware name: Atmel SAMA5
>> PC is at wiphy_unregister+0x244/0xc40 [cfg80211]
>> LR is at wiphy_unregister+0x1c0/0xc40 [cfg80211]
>> [...]
>>   wiphy_unregister [cfg80211] from wilc_netdev_cleanup+0x380/0x494 [wilc1000]
>>   wilc_netdev_cleanup [wilc1000] from wilc_bus_probe+0x360/0x834 [wilc1000_spi]
>>   wilc_bus_probe [wilc1000_spi] from spi_probe+0x15c/0x1d4
>>   spi_probe from really_probe+0x270/0xb2c
>>   really_probe from __driver_probe_device+0x1dc/0x4e8
>>   __driver_probe_device from driver_probe_device+0x5c/0x140
>>   driver_probe_device from __driver_attach+0x220/0x540
>>   __driver_attach from bus_for_each_dev+0x13c/0x1a8
>>   bus_for_each_dev from bus_add_driver+0x2a0/0x6a4
>>   bus_add_driver from driver_register+0x27c/0x51c
>>   driver_register from do_one_initcall+0xf8/0x564
>>   do_one_initcall from do_init_module+0x2e4/0x82c
>>   do_init_module from load_module+0x59a0/0x70c4
>>   load_module from init_module_from_file+0x100/0x148
>>   init_module_from_file from sys_finit_module+0x2fc/0x924
>>   sys_finit_module from ret_fast_syscall+0x0/0x1c
>> The issue can easily be reproduced, for example by not wiring
>> correctly
>> a wilc device through SPI (and so, make it unresponsive to early SPI
>> commands). It is due to a recent change decoupling wiphy allocation from
>> wiphy registration, however wilc_netdev_cleanup has not been updated
>> accordingly, letting it possibly call wiphy unregister on a wiphy which
>> has never been registered.
>> Fix this crash by moving wiphy_unregister/wiphy_free out of
>> wilc_netdev_cleanup, and by adjusting error paths in both drivers
>> Fixes: fbdf0c5248dc ("wifi: wilc1000: Register wiphy after reading
>> out chipid")
>> Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
> Nice find, thank you for fixing it.
>
> Reviewed-by: Marek Vasut <marex@denx.de>

We are quite late in the cycle so I think I'll queue this to
wireless-next for v6.14.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

  reply	other threads:[~2025-01-07 15:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-23 15:46 [PATCH wireless] wifi: wilc1000: unregister wiphy only if it has been registered Alexis Lothoré
2024-12-23 19:19 ` Marek Vasut
2025-01-07 15:22   ` Kalle Valo [this message]
2025-01-10 12:49 ` Kalle Valo

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=87sepur6mo.fsf@kernel.org \
    --to=kvalo@kernel.org \
    --cc=ajay.kathat@microchip.com \
    --cc=alexis.lothore@bootlin.com \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=thomas.petazzoni@bootlin.com \
    /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 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.