Skip to contentSkip to conversation

rsi: fix potential null dereference in rsi_probe()

PATCH In review Denis Efremov 3 participants 4 messages Oct 2, 2019 – Oct 6, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rsi: fix potential null dereference in rsi_probe()

The id pointer can be NULL in rsi_probe(). It is checked everywhere except for the else branch in the idProduct condition. The patch adds NULL check before the id dereference in the rsi_dbg() call.

Fixes 54fdb318c111 ("rsi: add new device model for 9116")
Cc Amitkumar Karwar <[email protected]>
Cc Siva Rebbagondla <[email protected]>
Cc Kalle Valo <[email protected]>
---
 drivers/net/wireless/rsi/rsi_91x_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rsi/rsi_91x_usb.c +1 -1
index 760eaffeebd6..23a1d00b5f38 100644
@@ -793,7 +793,7 @@ static int rsi_probe(struct usb_interface *pfunction,
 		adapter->device_model = RSI_DEV_9116;
 	} else {
 		rsi_dbg(ERR_ZONE, "%s: Unsupported RSI device id 0x%x\n",
-			__func__, id->idProduct);
+			__func__, id ? id->idProduct : 0x0);
 		goto err1;
 	}
 
Signature · 1 line
2.21.0
#1 lore raw
Quoted 9 lines · Denis Efremov

The id pointer can be NULL in rsi_probe(). It is checked everywhere except for the else branch in the idProduct condition. The patch adds NULL check before the id dereference in the rsi_dbg() call.

Fixes 54fdb318c111 ("rsi: add new device model for 9116")
Cc Amitkumar Karwar <[email protected]>
Cc Siva Rebbagondla <[email protected]>
Cc Kalle Valo <[email protected]>

Patch applied to wireless-drivers-next.git, thanks.

f170d44bc4ec rsi: fix potential null dereference in rsi_probe()

Signature · 3 lines
https://patchwork.kernel.org/patch/11171695/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#2 lore raw
Quoted 3 lines · Kalle Valo
Quoted 1 line · Denis Efremov

The id pointer can be NULL in rsi_probe().

While the existing code in rsi_probe() may lead you to believe that, this statement is false.

Quoted 10 lines
Quoted 9 lines

It is checked everywhere except
for the else branch in the idProduct condition. The patch adds NULL check before the id dereference in the rsi_dbg() call.

Fixes 54fdb318c111 ("rsi: add new device model for 9116")
Cc Amitkumar Karwar <[email protected]>
Cc Siva Rebbagondla <[email protected]>
Cc Kalle Valo <[email protected]>
Quoted 3 lines

Patch applied to wireless-drivers-next.git, thanks.

f170d44bc4ec rsi: fix potential null dereference in rsi_probe()

I just sent a revert to prevent the confusion from spreading (e.g. to stable autosel and contributers looking for things to work on). Hope you don't mind, Kalle.

Johan

#3 lore raw
Quoted 18 lines · Johan Hovold
Quoted 3 lines · Kalle Valo
Quoted 1 line · Denis Efremov

The id pointer can be NULL in rsi_probe().

While the existing code in rsi_probe() may lead you to believe that, this statement is false.

Quoted 10 lines
Quoted 9 lines

It is checked everywhere except
for the else branch in the idProduct condition. The patch adds NULL check before the id dereference in the rsi_dbg() call.

Fixes 54fdb318c111 ("rsi: add new device model for 9116")
Cc Amitkumar Karwar <[email protected]>
Cc Siva Rebbagondla <[email protected]>
Cc Kalle Valo <[email protected]>
Quoted 7 lines
Quoted 3 lines

Patch applied to wireless-drivers-next.git, thanks.

f170d44bc4ec rsi: fix potential null dereference in rsi_probe()

I just sent a revert to prevent the confusion from spreading (e.g. to stable autosel and contributers looking for things to work on). Hope you don't mind, Kalle.

That's great, thanks Johan.

Signature · 1 line
Kalle Valo