summaryrefslogtreecommitdiff
path: root/drivers/staging/rtl8192u/r8192U_core.c
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2016-01-04 20:30:58 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-07 20:17:18 -0800
commitd0aaa57df2d8f5d355c64935dcff58cd4ab9fe2f (patch)
treed3623b8d353f8a1d1d2b37061e44b76817234f04 /drivers/staging/rtl8192u/r8192U_core.c
parentf06104fb322524eb8102c49c1fd916d901a81ee3 (diff)
staging: r8192U: Fix check pointer after usage problem
In routine rtl8192_tx_isr(), pointer skb is dereferenced before it is checked for NULL. This patch has only been compile-tested, as I do not have the hardware. This problem was reported at https://bugzilla.kernel.org/show_bug.cgi?id=109951. Fixes: bugzilla.kernel.org: #109951 Reported-by: Yong Shi <brave_shi@163.com> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Cc: Yong Shi <brave_shi@163.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8192u/r8192U_core.c')
-rw-r--r--drivers/staging/rtl8192u/r8192U_core.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index 07f4e7a5469a..3c589636139a 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1092,10 +1092,17 @@ static int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
static void rtl8192_tx_isr(struct urb *tx_urb)
{
struct sk_buff *skb = (struct sk_buff *)tx_urb->context;
- struct net_device *dev = (struct net_device *)(skb->cb);
+ struct net_device *dev;
struct r8192_priv *priv = NULL;
- cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
- u8 queue_index = tcb_desc->queue_index;
+ cb_desc *tcb_desc;
+ u8 queue_index;
+
+ if (!skb)
+ return;
+
+ dev = (struct net_device *)(skb->cb);
+ tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
+ queue_index = tcb_desc->queue_index;
priv = ieee80211_priv(dev);
@@ -1113,11 +1120,9 @@ static void rtl8192_tx_isr(struct urb *tx_urb)
}
/* free skb and tx_urb */
- if (skb != NULL) {
- dev_kfree_skb_any(skb);
- usb_free_urb(tx_urb);
- atomic_dec(&priv->tx_pending[queue_index]);
- }
+ dev_kfree_skb_any(skb);
+ usb_free_urb(tx_urb);
+ atomic_dec(&priv->tx_pending[queue_index]);
/*
* Handle HW Beacon: