diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2011-11-17 21:20:04 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-18 14:37:09 -0500 |
commit | a7ae1992248e5cf9dc5bd35695ab846d27efe15f (patch) | |
tree | ed3f450a41ca5975aecae2850105ca22f98ca318 /net/ipv6/raw.c | |
parent | 660882432909dbe611f1792eda158188065cb9f1 (diff) |
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>
Diffstat (limited to 'net/ipv6/raw.c')
-rw-r--r-- | net/ipv6/raw.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 204f2e833f04..a1aa869a9ce7 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -611,6 +611,8 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length, | |||
611 | struct sk_buff *skb; | 611 | struct sk_buff *skb; |
612 | int err; | 612 | int err; |
613 | struct rt6_info *rt = (struct rt6_info *)*dstp; | 613 | struct rt6_info *rt = (struct rt6_info *)*dstp; |
614 | int hlen = LL_RESERVED_SPACE(rt->dst.dev); | ||
615 | int tlen = rt->dst.dev->needed_tailroom; | ||
614 | 616 | ||
615 | if (length > rt->dst.dev->mtu) { | 617 | if (length > rt->dst.dev->mtu) { |
616 | ipv6_local_error(sk, EMSGSIZE, fl6, rt->dst.dev->mtu); | 618 | ipv6_local_error(sk, EMSGSIZE, fl6, rt->dst.dev->mtu); |
@@ -620,11 +622,11 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length, | |||
620 | goto out; | 622 | goto out; |
621 | 623 | ||
622 | skb = sock_alloc_send_skb(sk, | 624 | skb = sock_alloc_send_skb(sk, |
623 | length + LL_ALLOCATED_SPACE(rt->dst.dev) + 15, | 625 | length + hlen + tlen + 15, |
624 | flags & MSG_DONTWAIT, &err); | 626 | flags & MSG_DONTWAIT, &err); |
625 | if (skb == NULL) | 627 | if (skb == NULL) |
626 | goto error; | 628 | goto error; |
627 | skb_reserve(skb, LL_RESERVED_SPACE(rt->dst.dev)); | 629 | skb_reserve(skb, hlen); |
628 | 630 | ||
629 | skb->priority = sk->sk_priority; | 631 | skb->priority = sk->sk_priority; |
630 | skb->mark = sk->sk_mark; | 632 | skb->mark = sk->sk_mark; |