ipv6: Remove all uses of LL_ALLOCATED_SPACE
ipv6: Remove all uses of LL_ALLOCATED_SPACE The macro LL_ALLOCATED_SPACE was ill-conceived. It applies the alignment to the sum of needed_headroom and needed_tailroom. As the amount that is then reserved for head room is needed_headroom with alignment, this means that the tail room left may be too small. This patch replaces all uses of LL_ALLOCATED_SPACE in net/ipv6 with the macro LL_RESERVED_SPACE and direct reference to needed_tailroom. This also fixes the problem with needed_headroom changing between allocating the skb and reserving the head room. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
6608824329
commit
a7ae199224
@@ -446,6 +446,8 @@ struct sk_buff *ndisc_build_skb(struct net_device *dev,
|
||||
struct sock *sk = net->ipv6.ndisc_sk;
|
||||
struct sk_buff *skb;
|
||||
struct icmp6hdr *hdr;
|
||||
int hlen = LL_RESERVED_SPACE(dev);
|
||||
int tlen = dev->needed_tailroom;
|
||||
int len;
|
||||
int err;
|
||||
u8 *opt;
|
||||
@@ -459,7 +461,7 @@ struct sk_buff *ndisc_build_skb(struct net_device *dev,
|
||||
|
||||
skb = sock_alloc_send_skb(sk,
|
||||
(MAX_HEADER + sizeof(struct ipv6hdr) +
|
||||
len + LL_ALLOCATED_SPACE(dev)),
|
||||
len + hlen + tlen),
|
||||
1, &err);
|
||||
if (!skb) {
|
||||
ND_PRINTK0(KERN_ERR
|
||||
@@ -468,7 +470,7 @@ struct sk_buff *ndisc_build_skb(struct net_device *dev,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
skb_reserve(skb, LL_RESERVED_SPACE(dev));
|
||||
skb_reserve(skb, hlen);
|
||||
ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len);
|
||||
|
||||
skb->transport_header = skb->tail;
|
||||
@@ -1533,6 +1535,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
|
||||
struct inet6_dev *idev;
|
||||
struct flowi6 fl6;
|
||||
u8 *opt;
|
||||
int hlen, tlen;
|
||||
int rd_len;
|
||||
int err;
|
||||
u8 ha_buf[MAX_ADDR_LEN], *ha = NULL;
|
||||
@@ -1590,9 +1593,11 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
|
||||
rd_len &= ~0x7;
|
||||
len += rd_len;
|
||||
|
||||
hlen = LL_RESERVED_SPACE(dev);
|
||||
tlen = dev->needed_tailroom;
|
||||
buff = sock_alloc_send_skb(sk,
|
||||
(MAX_HEADER + sizeof(struct ipv6hdr) +
|
||||
len + LL_ALLOCATED_SPACE(dev)),
|
||||
len + hlen + tlen),
|
||||
1, &err);
|
||||
if (buff == NULL) {
|
||||
ND_PRINTK0(KERN_ERR
|
||||
@@ -1601,7 +1606,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
|
||||
goto release;
|
||||
}
|
||||
|
||||
skb_reserve(buff, LL_RESERVED_SPACE(dev));
|
||||
skb_reserve(buff, hlen);
|
||||
ip6_nd_hdr(sk, buff, dev, &saddr_buf, &ipv6_hdr(skb)->saddr,
|
||||
IPPROTO_ICMPV6, len);
|
||||
|
||||
|
Reference in New Issue
Block a user