From: Alexey Dobriyan <adobriyan@openvz.org>
To: David Stevens <dlstevens@us.ibm.com>, davem@davemloft.net
Cc: kuznet@ms2.inr.ac.ru, netdev@vger.kernel.org
Subject: [PATCH] igmp: check add_grhead() return value
Date: Mon, 5 Feb 2007 18:04:33 +0300 [thread overview]
Message-ID: <20070205150432.GA5961@localhost.sw.ru> (raw)
In-Reply-To: <OF52248A96.35A5CA3C-ON88257273.003E5791-88257273.003F9122@us.ibm.com>
OK, now that we aren't seeing crashes which can be attributed to these
NULL dereferences any longer.
--------------------------------------
add_grhead() allocates memory with GFP_ATOMIC and in at least two places skb
from it passed to skb_put() without checking.
Signed-off-by: Alexey Dobriyan <adobriyan@openvz.org>
---
net/ipv4/igmp.c | 2 ++
net/ipv6/mcast.c | 2 ++
2 files changed, 4 insertions(+)
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -455,6 +455,8 @@ static struct sk_buff *add_grec(struct s
skb = add_grhead(skb, pmc, type, &pgr);
first = 0;
}
+ if (!skb)
+ return NULL;
psrc = (__be32 *)skb_put(skb, sizeof(__be32));
*psrc = psf->sf_inaddr;
scount++; stotal++;
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1582,6 +1582,8 @@ static struct sk_buff *add_grec(struct s
skb = add_grhead(skb, pmc, type, &pgr);
first = 0;
}
+ if (!skb)
+ return NULL;
psrc = (struct in6_addr *)skb_put(skb, sizeof(*psrc));
*psrc = psf->sf_addr;
scount++; stotal++;
next prev parent reply other threads:[~2007-02-05 14:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-30 10:57 igmp: possible NULL dereference after GFP_ATOMIC allocation? Alexey Dobriyan
2007-01-30 11:34 ` David Stevens
2007-01-30 15:04 ` Alexey Dobriyan
2007-01-31 9:39 ` Jarek Poplawski
2007-02-05 15:04 ` Alexey Dobriyan [this message]
2007-02-06 22:35 ` [PATCH] igmp: check add_grhead() return value 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=20070205150432.GA5961@localhost.sw.ru \
--to=adobriyan@openvz.org \
--cc=davem@davemloft.net \
--cc=dlstevens@us.ibm.com \
--cc=kuznet@ms2.inr.ac.ru \
--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.