[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. 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>
This commit is contained in:
committed by
Adrian Bunk
parent
56f2853fef
commit
666ebed839
@@ -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++;
|
||||
|
||||
@@ -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++;
|
||||
|
||||
Reference in New Issue
Block a user