rtlwifi: Fix a double free in _rtl_usb_tx_urb_setup()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 13 May 2020 09:39:51 +0000 (12:39 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 18 May 2020 12:15:25 +0000 (15:15 +0300)
commitbeb12813bc75d4a23de43b85ad1c7cb28d27631e
tree955a00396d27062ddd4c9fb7d3441ada9495842e
parenteda31200e68d38fbb974e7ad02bcc2de2cfe6863
rtlwifi: Fix a double free in _rtl_usb_tx_urb_setup()

Seven years ago we tried to fix a leak but actually introduced a double
free instead.  It was an understandable mistake because the code was a
bit confusing and the free was done in the wrong place.  The "skb"
pointer is freed in both _rtl_usb_tx_urb_setup() and _rtl_usb_transmit().
The free belongs _rtl_usb_transmit() instead of _rtl_usb_tx_urb_setup()
and I've cleaned the code up a bit to hopefully make it more clear.

Fixes: 36ef0b473fbf ("rtlwifi: usb: add missing freeing of skbuff")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200513093951.GD347693@mwanda
drivers/net/wireless/realtek/rtlwifi/usb.c