]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Fix allocation failure handling in multicast
authorAlexey Dobriyan <adobriyan@openvz.org>
Wed, 7 Feb 2007 05:58:27 +0000 (21:58 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 9 Mar 2007 18:50:20 +0000 (10:50 -0800)
[IPV4/IPV6] multicast: Check add_grhead() return value

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/ipv4/igmp.c
net/ipv6/mcast.c

index 0017ccb01d6d3dd0891036cc1a7837bfad7da738..024ae56cab256b34b379d482ab9659600135b90a 100644 (file)
@@ -455,6 +455,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 = (__be32 *)skb_put(skb, sizeof(__be32));
                *psrc = psf->sf_inaddr;
                scount++; stotal++;
index 882cde4b404754c97089e573981eb9ce17e74d4b..e3ec216958328ff12820d9f858a6041f847a758e 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++;