FAILED: patch "[PATCH] rsi: fix use-after-free on failed probe and unbind" failed to apply to 4.19-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From e93cd35101b61e4c79149be2cfc927c4b28dc60c Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Thu, 28 Nov 2019 18:22:00 +0100
Subject: [PATCH] rsi: fix use-after-free on failed probe and unbind
Make sure to stop both URBs before returning after failed probe as well as on disconnect to avoid use-after-free in the completion handler.
Reported-by [email protected]
Fixes a4302bff28e2 ("rsi: add bluetooth rx endpoint")
Fixes dad0d04fa7ba ("rsi: Add RS9113 wireless driver")
Cc stable <[email protected]> # 3.15
Cc Siva Rebbagondla <[email protected]>
Cc Prameela Rani Garnepudi <[email protected]>
Cc Amitkumar Karwar <[email protected]>
Cc Fariya Fatima <[email protected]>
Signed-off-by Johan Hovold <[email protected]>
Signed-off-by Kalle Valo <[email protected]>
drivers/net/wireless/rsi/rsi_91x_usb.c +17 -1
@@ -292,6 +292,15 @@ static void rsi_rx_done_handler(struct urb *urb)dev_kfree_skb (rx_cb->rx_skb); } +static void rsi_rx_urb_kill (struct rsi_hw *adapter,u8 ep_num) +{ +struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev; +struct rx_usb_ctrl_block *rx_cb = &dev->rx_cb[ep_num -1 ]; +struct urb *urb = rx_cb->rx_urb; + +usb_kill_urb (urb); +} +/** * rsi_rx_urb_submit() - This function submits the given URB to the USB stack. * @adapter: Pointer to the adapter structure.
@@ -823,10 +832,13 @@ static int rsi_probe(struct usb_interface *pfunction,if (adapter->priv->coex_mode >1 ) { status =rsi_rx_urb_submit (adapter,BT_EP );if (status) - goto err1; + goto err_kill_wlan_urb; }return 0 ; + +err_kill_wlan_urb: +rsi_rx_urb_kill (adapter,WLAN_EP ); err1:rsi_deinit_usb_interface (adapter); err:
@@ -857,6 +869,10 @@ static void rsi_disconnect(struct usb_interface *pfunction) adapter->priv->bt_adapter =NULL ; } +if (adapter->priv->coex_mode >1 ) +rsi_rx_urb_kill (adapter,BT_EP ); +rsi_rx_urb_kill (adapter,WLAN_EP ); +rsi_reset_card (adapter);rsi_deinit_usb_interface (adapter);rsi_91x_deinit (adapter);