]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[IPV4/IPV6] multicast: Check add_grhead() return value
authorAlexey Dobriyan <adobriyan@openvz.org>
Mon, 26 Feb 2007 00:31:58 +0000 (01:31 +0100)
committerAdrian Bunk <bunk@stusta.de>
Mon, 26 Feb 2007 00:31:58 +0000 (01:31 +0100)
add_grhead() allocates memory with GFP_ATOMIC and in at least two places skb
from it passed to skb_put() without checking.

Adrian Bunk:
backported to 2.6.16

Signed-off-by: Alexey Dobriyan <adobriyan@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
net/ipv4/igmp.c
net/ipv6/mcast.c

index 64ce52bf0485a368f016e1de23103e19db004d64..39e30c79f25c8847ba2276c85bd78c737dfa5eb1 100644 (file)
@@ -456,6 +456,8 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc,
                        skb = add_grhead(skb, pmc, type, &pgr);
                        first = 0;
                }
+               if (!skb)
+                       return NULL;
                psrc = (u32 *)skb_put(skb, sizeof(u32));
                *psrc = psf->sf_inaddr;
                scount++; stotal++;
index c75cd1c4d6b8902aef219a69da2ffdbffd29ac3f..0470a18922f7a35b72e51a683e7bdd9449001e0c 100644 (file)
@@ -1582,6 +1582,8 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc,
                        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++;