From: Wentao Liang <vulab@iscas.ac.cn>
To: ajay.kathat@microchip.com, claudiu.beznea@tuxon.dev, kvalo@kernel.org
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
Wentao Liang <vulab@iscas.ac.cn>,
stable@vger.kernel.org
Subject: [PATCH] wifi: wilc1000: Handle wilc_sdio_cmd52() failure in wilc_sdio_read_init()
Date: Sat, 17 May 2025 23:46:11 +0800 [thread overview]
Message-ID: <20250517154611.910-1-vulab@iscas.ac.cn> (raw)
The wilc_sdio_read_init() calls wilc_sdio_cmd52() but does not check the
return value. This could lead to execution with potentially invalid data
if wilc_sdio_cmd52() fails. A proper implementation can be found in
wilc_sdio_read_reg().
Add error handling for wilc_sdio_cmd52(). If wilc_sdio_cmd52() fails,
log an error message via dev_err().
Fixes: eda308be643f ("staging: wilc1000: refactor interrupt handling for sdio")
Cc: stable@vger.kernel.org # v5.7
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/net/wireless/microchip/wilc1000/sdio.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/microchip/wilc1000/sdio.c b/drivers/net/wireless/microchip/wilc1000/sdio.c
index e7a2bc9f9902..d0e8b812b622 100644
--- a/drivers/net/wireless/microchip/wilc1000/sdio.c
+++ b/drivers/net/wireless/microchip/wilc1000/sdio.c
@@ -809,6 +809,7 @@ static int wilc_sdio_read_int(struct wilc *wilc, u32 *int_status)
u32 tmp;
u8 irq_flags;
struct sdio_cmd52 cmd;
+ int ret;
wilc_sdio_read_size(wilc, &tmp);
@@ -827,7 +828,12 @@ static int wilc_sdio_read_int(struct wilc *wilc, u32 *int_status)
cmd.raw = 0;
cmd.read_write = 0;
cmd.data = 0;
- wilc_sdio_cmd52(wilc, &cmd);
+ ret = wilc_sdio_cmd52(wilc, &cmd);
+ if (ret) {
+ dev_err(&func->devm, "Fail cmd 52, get IRQ register...\n");
+ return ret;
+ }
+
irq_flags = cmd.data;
if (sdio_priv->irq_gpio)
--
2.42.0.windows.2
next reply other threads:[~2025-05-17 15:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-17 15:46 Wentao Liang [this message]
2025-05-17 18:01 ` [PATCH] wifi: wilc1000: Handle wilc_sdio_cmd52() failure in wilc_sdio_read_init() Markus Elfring
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=20250517154611.910-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=ajay.kathat@microchip.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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