From: Devansh Soni <devanshsoni874@gmail.com>
To: gregkh@linuxfoundation.org
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
Devansh Soni <devanshsoni874@gmail.com>
Subject: [PATCH] staging: rtl8723bs: fix missing unregister_netdev on sdio_alloc_irq failure
Date: Fri, 19 Jun 2026 18:27:24 +0530 [thread overview]
Message-ID: <20260619125724.12458-1-devanshsoni874@gmail.com> (raw)
In rtw_drv_init(), if rtw_drv_register_netdev() succeeds but
sdio_alloc_irq() fails, the error path jumps to free_if1 and calls
rtw_sdio_if1_deinit(). However, rtw_sdio_if1_deinit() calls
rtw_free_netdev() without a preceding unregister_netdev(), freeing a
still-registered netdev but leaving stale sysfs entries behind.
Signed-off-by: Devansh Soni <devanshsoni874@gmail.com>
---
drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
index d0feb28b7..6ddc08794 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
@@ -359,10 +359,13 @@ static int rtw_drv_init(
status = sdio_alloc_irq(dvobj);
if (status != _SUCCESS)
- goto free_if1;
+ goto free_netdev;
status = _SUCCESS;
+free_netdev:
+ if (status != _SUCCESS)
+ rtw_unregister_netdevs(dvobj);
free_if1:
if (status != _SUCCESS && if1)
rtw_sdio_if1_deinit(if1);
--
2.54.0
reply other threads:[~2026-06-19 12:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260619125724.12458-1-devanshsoni874@gmail.com \
--to=devanshsoni874@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/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