RE: [PATCH] wifi: rtw88: usb: kill and free rx urbs on probe failure

From: Ping-Ke Shih
Date: Thu Aug 24 2023 - 21:14:35 EST




> -----Original Message-----
> From: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
> Sent: Wednesday, August 23, 2023 3:50 PM
> To: linux-wireless@xxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx; Ping-Ke Shih <pkshih@xxxxxxxxxxx>; Kalle Valo <kvalo@xxxxxxxxxx>; Ilgaz
> Öcal <ilgaz@xxxxxxxxxxxx>; kernel@xxxxxxxxxxxxxx
> Subject: [PATCH] wifi: rtw88: usb: kill and free rx urbs on probe failure
>
> After rtw_usb_alloc_rx_bufs() has been called rx urbs have been
> allocated and must be freed in the error path. After rtw_usb_init_rx()
> has been called they are submitted, so they also must be killed.
>
> Add these forgotten steps to the probe error path.
>
> Besides the lost memory this also fixes a problem when the driver
> fails to download the firmware in rtw_chip_info_setup(). In this
> case it can happen that the completion of the rx urbs handler runs
> at a time when we already freed our data structures resulting in
> a kernel crash.
>
> fixes: a82dfd33d1237 ("wifi: rtw88: Add common USB chip support")
> Cc: stable@xxxxxxxxxxxxxxx
> Reported-by: Ilgaz Öcal <ilgaz@xxxxxxxxxxxx>
> Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>

Acked-by: Ping-Ke Shih <pkshih@xxxxxxxxxxx>