Re: [PATCH 5.4 117/203] rsi: fix potential null dereference in rsi_probe()

From: Johan Hovold
Date: Tue Feb 04 2020 - 03:33:29 EST


On Fri, Jan 17, 2020 at 12:17:14AM +0100, Greg Kroah-Hartman wrote:
> From: Denis Efremov <efremov@xxxxxxxxx>
>
> commit f170d44bc4ec2feae5f6206980e7ae7fbf0432a0 upstream.
>
> 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 <amitkarwar@xxxxxxxxx>
> Cc: Siva Rebbagondla <siva8118@xxxxxxxxx>
> Cc: Kalle Valo <kvalo@xxxxxxxxxxxxxx>
> Signed-off-by: Denis Efremov <efremov@xxxxxxxxx>
> Signed-off-by: Kalle Valo <kvalo@xxxxxxxxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

This commit is bogus and was reverted shortly after it was applied in
order to prevent autosel from picking it up for stable (reverted by
c5dcf8f0e850 ("Revert "rsi: fix potential null dereference in
rsi_probe()"")).

The revert has now been picked up by Sasha, but shouldn't an
explicit revert in the same pull-request prevent a bad patch from being
backported in the first place? Seems like something that could be
scripted. But perhaps the net-stable oddities come into play here.

> ---
> drivers/net/wireless/rsi/rsi_91x_usb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/drivers/net/wireless/rsi/rsi_91x_usb.c
> +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c
> @@ -793,7 +793,7 @@ static int rsi_probe(struct usb_interfac
> 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;
> }

Johan