Commit 5c1187d1 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

rsi: fix non-atomic allocation in completion handler

commit b9b9f9fe upstream.

USB completion handlers are called in atomic context and must
specifically not allocate memory using GFP_KERNEL.

Fixes: a1854fae ("rsi: improve RX packet handling in USB interface")
Cc: stable <stable@vger.kernel.org> # 4.17
Cc: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 71b815b0
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/types.h>
#include <net/rsi_91x.h> #include <net/rsi_91x.h>
#include "rsi_usb.h" #include "rsi_usb.h"
#include "rsi_hal.h" #include "rsi_hal.h"
...@@ -29,7 +30,7 @@ MODULE_PARM_DESC(dev_oper_mode, ...@@ -29,7 +30,7 @@ MODULE_PARM_DESC(dev_oper_mode,
"9[Wi-Fi STA + BT LE], 13[Wi-Fi STA + BT classic + BT LE]\n" "9[Wi-Fi STA + BT LE], 13[Wi-Fi STA + BT classic + BT LE]\n"
"6[AP + BT classic], 14[AP + BT classic + BT LE]"); "6[AP + BT classic], 14[AP + BT classic + BT LE]");
static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num); static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num, gfp_t flags);
/** /**
* rsi_usb_card_write() - This function writes to the USB Card. * rsi_usb_card_write() - This function writes to the USB Card.
...@@ -283,7 +284,7 @@ static void rsi_rx_done_handler(struct urb *urb) ...@@ -283,7 +284,7 @@ static void rsi_rx_done_handler(struct urb *urb)
status = 0; status = 0;
out: out:
if (rsi_rx_urb_submit(dev->priv, rx_cb->ep_num)) if (rsi_rx_urb_submit(dev->priv, rx_cb->ep_num, GFP_ATOMIC))
rsi_dbg(ERR_ZONE, "%s: Failed in urb submission", __func__); rsi_dbg(ERR_ZONE, "%s: Failed in urb submission", __func__);
if (status) if (status)
...@@ -296,7 +297,7 @@ static void rsi_rx_done_handler(struct urb *urb) ...@@ -296,7 +297,7 @@ static void rsi_rx_done_handler(struct urb *urb)
* *
* Return: 0 on success, a negative error code on failure. * Return: 0 on success, a negative error code on failure.
*/ */
static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num) static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num, gfp_t mem_flags)
{ {
struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev; 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 rx_usb_ctrl_block *rx_cb = &dev->rx_cb[ep_num - 1];
...@@ -326,7 +327,7 @@ static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num) ...@@ -326,7 +327,7 @@ static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num)
rsi_rx_done_handler, rsi_rx_done_handler,
rx_cb); rx_cb);
status = usb_submit_urb(urb, GFP_KERNEL); status = usb_submit_urb(urb, mem_flags);
if (status) { if (status) {
rsi_dbg(ERR_ZONE, "%s: Failed in urb submission\n", __func__); rsi_dbg(ERR_ZONE, "%s: Failed in urb submission\n", __func__);
dev_kfree_skb(skb); dev_kfree_skb(skb);
...@@ -783,12 +784,12 @@ static int rsi_probe(struct usb_interface *pfunction, ...@@ -783,12 +784,12 @@ static int rsi_probe(struct usb_interface *pfunction,
rsi_dbg(INIT_ZONE, "%s: Device Init Done\n", __func__); rsi_dbg(INIT_ZONE, "%s: Device Init Done\n", __func__);
} }
status = rsi_rx_urb_submit(adapter, WLAN_EP); status = rsi_rx_urb_submit(adapter, WLAN_EP, GFP_KERNEL);
if (status) if (status)
goto err1; goto err1;
if (adapter->priv->coex_mode > 1) { if (adapter->priv->coex_mode > 1) {
status = rsi_rx_urb_submit(adapter, BT_EP); status = rsi_rx_urb_submit(adapter, BT_EP, GFP_KERNEL);
if (status) if (status)
goto err1; goto err1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment