* [PATCH v2] wifi: wilc1000: Handle wilc_sdio_cmd52() failure in wilc_sdio_read_init()
@ 2025-05-19 1:54 Wentao Liang
2025-06-30 13:37 ` Johannes Berg
0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2025-05-19 1:54 UTC (permalink / raw)
To: ajay.kathat, claudiu.beznea, kvalo
Cc: linux-wireless, linux-kernel, Wentao Liang, stable
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>
---
v2: Fix code error.
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 8ff49b08bbd2..e85aa5c605ef 100644
--- a/drivers/net/wireless/microchip/wilc1000/sdio.c
+++ b/drivers/net/wireless/microchip/wilc1000/sdio.c
@@ -808,6 +808,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);
@@ -826,7 +827,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->dev, "Fail cmd 52, get IRQ register...\n");
+ return ret;
+ }
+
irq_flags = cmd.data;
if (sdio_priv->irq_gpio)
--
2.42.0.windows.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] wifi: wilc1000: Handle wilc_sdio_cmd52() failure in wilc_sdio_read_init()
2025-05-19 1:54 [PATCH v2] wifi: wilc1000: Handle wilc_sdio_cmd52() failure in wilc_sdio_read_init() Wentao Liang
@ 2025-06-30 13:37 ` Johannes Berg
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2025-06-30 13:37 UTC (permalink / raw)
To: Wentao Liang, ajay.kathat, claudiu.beznea, kvalo
Cc: linux-wireless, linux-kernel, stable
On Mon, 2025-05-19 at 09:54 +0800, Wentao Liang wrote:
> 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().
This seems fairly much pointless, if the caller is never going to check
the return value anyway?
> 2.42.0.windows.2
Really? Did you even _build_ the changes yourself?
johannes
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-30 13:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-19 1:54 [PATCH v2] wifi: wilc1000: Handle wilc_sdio_cmd52() failure in wilc_sdio_read_init() Wentao Liang
2025-06-30 13:37 ` Johannes Berg
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).