[PATCH 1/2] wifi: mm81x: report a failed command urb to the caller
From: YuanZhe Liu
Date: Sat Nov 21 2026 - 11:49:52 EST
mm81x_usb_cmd() waits for the command urb and takes the return value of
wait_event_interruptible_timeout() as the command result. The completion
callback stores the urb status in musb->errors, but the wait only tells
whether the callback ran, not whether the transfer succeeded, so a command
that completed with -EPIPE or -EPROTO is reported as successful.
mm81x_usb_mem_read() and mm81x_usb_mem_write() then submit the data urb
even though the command that programs its address, direction and length
never reached the device. On top of the useless transfer, the device can
interpret the data phase in the context of the previous command.
Return musb->errors from mm81x_usb_cmd() so that both callers stop before
the data phase.
Fixes: b1906cea00b0 ("wifi: mm81x: add mm81x Wi-Fi HaLow driver")
Cc: stable@xxxxxxxxxxxxxxx
Co-developed-by: Bin Yu <byu@xxxxxxxxxxxxx>
Signed-off-by: Bin Yu <byu@xxxxxxxxxxxxx>
Co-developed-by: Cheng Wen <wencheng@xxxxxxxxxxxxx>
Signed-off-by: Cheng Wen <wencheng@xxxxxxxxxxxxx>
Signed-off-by: YuanZhe Liu <25031212351@xxxxxxxxxxxxxxxxx>
---
drivers/net/wireless/morsemicro/mm81x/usb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/morsemicro/mm81x/usb.c b/drivers/net/wireless/morsemicro/mm81x/usb.c
index ec94936b157b..98ca9575b990 100644
--- a/drivers/net/wireless/morsemicro/mm81x/usb.c
+++ b/drivers/net/wireless/morsemicro/mm81x/usb.c
@@ -266,7 +266,7 @@ static int mm81x_usb_cmd(struct mm81x_usb *musb,
}
musb->ongoing_cmd = false;
- return writesize;
+ return musb->errors ? musb->errors : writesize;
error:
musb->ongoing_cmd = false;
--
2.34.1