Skip to contentSkip to conversation

staging: rtl8723bs: disable SDIO function on block size failure

PATCH In review Myeonghun Pak 2 participants 2 messages Jul 31 – Aug 4 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723bs: disable SDIO function on block size failure

sdio_init() enables the SDIO function before configuring the block size. If sdio_set_block_size() fails, the function jumps to the release path and returns the error without disabling the SDIO function. The caller then frees the dvobj directly, so the enabled SDIO function is left active on that probe failure path.

Disable the SDIO function before releasing the host when block size configuration fails.

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Fixes 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
---
 drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/rtl8723bs/os_dep/sdio_intf.c +3 -1
index c43a0391a5ca..47e87aaf76e2 100644
@@ -122,8 +122,10 @@ static u32 sdio_init(struct dvobj_priv *dvobj)
 		goto release;
 
 	err = sdio_set_block_size(func, 512);
-	if (err)
+	if (err) {
+		sdio_disable_func(func);
 		goto release;
+	}
 
 	psdio_data->block_transfer_len = 512;
 	psdio_data->tx_block_mode = 1;
Signature · 1 line
2.47.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Myeonghun Pak

sdio_init() enables the SDIO function before configuring the block size. If sdio_set_block_size() fails, the function jumps to the release path and returns the error without disabling the SDIO function. The caller then frees the dvobj directly, so the enabled SDIO function is left active on that probe failure path.

Disable the SDIO function before releasing the host when block size configuration fails.

Quoted 8 lines

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Fixes 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")

---

Looks good.

regards,
dan carpenter