All of lore.kernel.org
 help / color / mirror / Atom feed
From: Myungho Jung <mhjungk@gmail.com>
To: chunkeey@googlemail.com
Cc: netdev@vger.kernel.org, Myungho Jung <mhjungk@gmail.com>
Subject: [PATCH] p54: add null pointer check before releasing socket buffer
Date: Sun,  9 Apr 2017 22:23:20 -0700	[thread overview]
Message-ID: <1491801800-4371-1-git-send-email-mhjungk@gmail.com> (raw)

Kernel panic is caused by trying to dereference null pointer. Check if
the pointer is null before freeing space.

Signed-off-by: Myungho Jung <mhjungk@gmail.com>
---
 drivers/net/wireless/intersil/p54/txrx.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intersil/p54/txrx.c b/drivers/net/wireless/intersil/p54/txrx.c
index 1af7da0..8956061 100644
--- a/drivers/net/wireless/intersil/p54/txrx.c
+++ b/drivers/net/wireless/intersil/p54/txrx.c
@@ -503,7 +503,9 @@ static void p54_rx_eeprom_readback(struct p54_common *priv,
 
 	priv->eeprom = NULL;
 	tmp = p54_find_and_unlink_skb(priv, hdr->req_id);
-	dev_kfree_skb_any(tmp);
+	if (unlikely(!tmp))
+		dev_kfree_skb_any(tmp);
+
 	complete(&priv->eeprom_comp);
 }
 
@@ -597,7 +599,9 @@ static void p54_rx_stats(struct p54_common *priv, struct sk_buff *skb)
 	}
 
 	tmp = p54_find_and_unlink_skb(priv, hdr->req_id);
-	dev_kfree_skb_any(tmp);
+	if (unlikely(!tmp))
+		dev_kfree_skb_any(tmp);
+
 	complete(&priv->stat_comp);
 }
 
-- 
2.7.4

             reply	other threads:[~2017-04-10  5:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-10  5:23 Myungho Jung [this message]
2017-04-10 12:12 ` [PATCH] p54: add null pointer check before releasing socket buffer Christian Lamparter
2017-04-10 20:54   ` Myungho Jung
2017-04-10 20:54     ` Myungho Jung
2017-04-10 21:22     ` Christian Lamparter
2017-04-10 21:38       ` Eric Dumazet
2017-04-10 21:38         ` Eric Dumazet
2017-04-10 14:03 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1491801800-4371-1-git-send-email-mhjungk@gmail.com \
    --to=mhjungk@gmail.com \
    --cc=chunkeey@googlemail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.