From: Martin Townsend Date: Sun, 17 May 2015 19:44:54 +0000 (+0200) Subject: mac802154: fakelb: Fix potential NULL pointer dereference. X-Git-Tag: firefly_0821_release~176^2~1587^2~183^2~44 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=cb97d9a3eb0be1e33db5535955e6629e800f3f0e;p=firefly-linux-kernel-4.4.55.git mac802154: fakelb: Fix potential NULL pointer dereference. fakelb_hw_deliver creates a copy of the skb's header which can potentially return NULL so we now check for this before actually delivering to the 802.15.4 MAC layer. Signed-off-by: Martin Townsend Signed-off-by: Alexander Aring Signed-off-by: Marcel Holtmann --- diff --git a/drivers/net/ieee802154/fakelb.c b/drivers/net/ieee802154/fakelb.c index 91bbf030a443..230f7da02165 100644 --- a/drivers/net/ieee802154/fakelb.c +++ b/drivers/net/ieee802154/fakelb.c @@ -69,7 +69,8 @@ fakelb_hw_deliver(struct fakelb_dev_priv *priv, struct sk_buff *skb) spin_lock(&priv->lock); if (priv->working) { newskb = pskb_copy(skb, GFP_ATOMIC); - ieee802154_rx_irqsafe(priv->hw, newskb, 0xcc); + if (newskb) + ieee802154_rx_irqsafe(priv->hw, newskb, 0xcc); } spin_unlock(&priv->lock); }