Commit c0762f3b authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Khalid Elmously

Revert "ath9k: Fix general protection fault in ath9k_hif_usb_rx_cb"

BugLink: https://bugs.launchpad.net/bugs/1888690

This reverts commit 90ecba9f1041f436ed2b35ba7a970c7cc5d0df23 which is
commit 2bbcaaee upstream.

It is being reverted upstream, just hasn't made it there yet and is
causing lots of problems.
Reported-by: default avatarHans de Goede <hdegoede@redhat.com>
Cc: Qiujun Huang <hqjagain@gmail.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 788dadab
...@@ -639,9 +639,9 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, ...@@ -639,9 +639,9 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
static void ath9k_hif_usb_rx_cb(struct urb *urb) static void ath9k_hif_usb_rx_cb(struct urb *urb)
{ {
struct rx_buf *rx_buf = (struct rx_buf *)urb->context; struct sk_buff *skb = (struct sk_buff *) urb->context;
struct hif_device_usb *hif_dev = rx_buf->hif_dev; struct hif_device_usb *hif_dev =
struct sk_buff *skb = rx_buf->skb; usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
int ret; int ret;
if (!skb) if (!skb)
...@@ -681,15 +681,14 @@ static void ath9k_hif_usb_rx_cb(struct urb *urb) ...@@ -681,15 +681,14 @@ static void ath9k_hif_usb_rx_cb(struct urb *urb)
return; return;
free: free:
kfree_skb(skb); kfree_skb(skb);
kfree(rx_buf);
} }
static void ath9k_hif_usb_reg_in_cb(struct urb *urb) static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
{ {
struct rx_buf *rx_buf = (struct rx_buf *)urb->context; struct sk_buff *skb = (struct sk_buff *) urb->context;
struct hif_device_usb *hif_dev = rx_buf->hif_dev;
struct sk_buff *skb = rx_buf->skb;
struct sk_buff *nskb; struct sk_buff *nskb;
struct hif_device_usb *hif_dev =
usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
int ret; int ret;
if (!skb) if (!skb)
...@@ -747,7 +746,6 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb) ...@@ -747,7 +746,6 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
return; return;
free: free:
kfree_skb(skb); kfree_skb(skb);
kfree(rx_buf);
urb->context = NULL; urb->context = NULL;
} }
...@@ -793,7 +791,7 @@ static int ath9k_hif_usb_alloc_tx_urbs(struct hif_device_usb *hif_dev) ...@@ -793,7 +791,7 @@ static int ath9k_hif_usb_alloc_tx_urbs(struct hif_device_usb *hif_dev)
init_usb_anchor(&hif_dev->mgmt_submitted); init_usb_anchor(&hif_dev->mgmt_submitted);
for (i = 0; i < MAX_TX_URB_NUM; i++) { for (i = 0; i < MAX_TX_URB_NUM; i++) {
tx_buf = kzalloc(sizeof(*tx_buf), GFP_KERNEL); tx_buf = kzalloc(sizeof(struct tx_buf), GFP_KERNEL);
if (!tx_buf) if (!tx_buf)
goto err; goto err;
...@@ -830,9 +828,8 @@ static void ath9k_hif_usb_dealloc_rx_urbs(struct hif_device_usb *hif_dev) ...@@ -830,9 +828,8 @@ static void ath9k_hif_usb_dealloc_rx_urbs(struct hif_device_usb *hif_dev)
static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev)
{ {
struct rx_buf *rx_buf = NULL;
struct sk_buff *skb = NULL;
struct urb *urb = NULL; struct urb *urb = NULL;
struct sk_buff *skb = NULL;
int i, ret; int i, ret;
init_usb_anchor(&hif_dev->rx_submitted); init_usb_anchor(&hif_dev->rx_submitted);
...@@ -840,12 +837,6 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) ...@@ -840,12 +837,6 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev)
for (i = 0; i < MAX_RX_URB_NUM; i++) { for (i = 0; i < MAX_RX_URB_NUM; i++) {
rx_buf = kzalloc(sizeof(*rx_buf), GFP_KERNEL);
if (!rx_buf) {
ret = -ENOMEM;
goto err_rxb;
}
/* Allocate URB */ /* Allocate URB */
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
if (urb == NULL) { if (urb == NULL) {
...@@ -860,14 +851,11 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) ...@@ -860,14 +851,11 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev)
goto err_skb; goto err_skb;
} }
rx_buf->hif_dev = hif_dev;
rx_buf->skb = skb;
usb_fill_bulk_urb(urb, hif_dev->udev, usb_fill_bulk_urb(urb, hif_dev->udev,
usb_rcvbulkpipe(hif_dev->udev, usb_rcvbulkpipe(hif_dev->udev,
USB_WLAN_RX_PIPE), USB_WLAN_RX_PIPE),
skb->data, MAX_RX_BUF_SIZE, skb->data, MAX_RX_BUF_SIZE,
ath9k_hif_usb_rx_cb, rx_buf); ath9k_hif_usb_rx_cb, skb);
/* Anchor URB */ /* Anchor URB */
usb_anchor_urb(urb, &hif_dev->rx_submitted); usb_anchor_urb(urb, &hif_dev->rx_submitted);
...@@ -893,8 +881,6 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) ...@@ -893,8 +881,6 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev)
err_skb: err_skb:
usb_free_urb(urb); usb_free_urb(urb);
err_urb: err_urb:
kfree(rx_buf);
err_rxb:
ath9k_hif_usb_dealloc_rx_urbs(hif_dev); ath9k_hif_usb_dealloc_rx_urbs(hif_dev);
return ret; return ret;
} }
...@@ -906,21 +892,14 @@ static void ath9k_hif_usb_dealloc_reg_in_urbs(struct hif_device_usb *hif_dev) ...@@ -906,21 +892,14 @@ static void ath9k_hif_usb_dealloc_reg_in_urbs(struct hif_device_usb *hif_dev)
static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev) static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev)
{ {
struct rx_buf *rx_buf = NULL;
struct sk_buff *skb = NULL;
struct urb *urb = NULL; struct urb *urb = NULL;
struct sk_buff *skb = NULL;
int i, ret; int i, ret;
init_usb_anchor(&hif_dev->reg_in_submitted); init_usb_anchor(&hif_dev->reg_in_submitted);
for (i = 0; i < MAX_REG_IN_URB_NUM; i++) { for (i = 0; i < MAX_REG_IN_URB_NUM; i++) {
rx_buf = kzalloc(sizeof(*rx_buf), GFP_KERNEL);
if (!rx_buf) {
ret = -ENOMEM;
goto err_rxb;
}
/* Allocate URB */ /* Allocate URB */
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
if (urb == NULL) { if (urb == NULL) {
...@@ -935,14 +914,11 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev) ...@@ -935,14 +914,11 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev)
goto err_skb; goto err_skb;
} }
rx_buf->hif_dev = hif_dev;
rx_buf->skb = skb;
usb_fill_int_urb(urb, hif_dev->udev, usb_fill_int_urb(urb, hif_dev->udev,
usb_rcvintpipe(hif_dev->udev, usb_rcvintpipe(hif_dev->udev,
USB_REG_IN_PIPE), USB_REG_IN_PIPE),
skb->data, MAX_REG_IN_BUF_SIZE, skb->data, MAX_REG_IN_BUF_SIZE,
ath9k_hif_usb_reg_in_cb, rx_buf, 1); ath9k_hif_usb_reg_in_cb, skb, 1);
/* Anchor URB */ /* Anchor URB */
usb_anchor_urb(urb, &hif_dev->reg_in_submitted); usb_anchor_urb(urb, &hif_dev->reg_in_submitted);
...@@ -968,8 +944,6 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev) ...@@ -968,8 +944,6 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev)
err_skb: err_skb:
usb_free_urb(urb); usb_free_urb(urb);
err_urb: err_urb:
kfree(rx_buf);
err_rxb:
ath9k_hif_usb_dealloc_reg_in_urbs(hif_dev); ath9k_hif_usb_dealloc_reg_in_urbs(hif_dev);
return ret; return ret;
} }
......
...@@ -84,11 +84,6 @@ struct tx_buf { ...@@ -84,11 +84,6 @@ struct tx_buf {
struct list_head list; struct list_head list;
}; };
struct rx_buf {
struct sk_buff *skb;
struct hif_device_usb *hif_dev;
};
#define HIF_USB_TX_STOP BIT(0) #define HIF_USB_TX_STOP BIT(0)
#define HIF_USB_TX_FLUSH BIT(1) #define HIF_USB_TX_FLUSH BIT(1)
......
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