mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
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:
parent
6608824329
commit
a7ae199224
4 changed files with 27 additions and 12 deletions
|
@ -631,6 +631,7 @@ int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
|
|||
struct ipv6hdr *tmp_hdr;
|
||||
struct frag_hdr *fh;
|
||||
unsigned int mtu, hlen, left, len;
|
||||
int hroom, troom;
|
||||
__be32 frag_id = 0;
|
||||
int ptr, offset = 0, err=0;
|
||||
u8 *prevhdr, nexthdr = 0;
|
||||
|
@ -797,6 +798,8 @@ slow_path:
|
|||
*/
|
||||
|
||||
*prevhdr = NEXTHDR_FRAGMENT;
|
||||
hroom = LL_RESERVED_SPACE(rt->dst.dev);
|
||||
troom = rt->dst.dev->needed_tailroom;
|
||||
|
||||
/*
|
||||
* Keep copying data until we run out.
|
||||
|
@ -815,7 +818,8 @@ slow_path:
|
|||
* Allocate buffer.
|
||||
*/
|
||||
|
||||
if ((frag = alloc_skb(len+hlen+sizeof(struct frag_hdr)+LL_ALLOCATED_SPACE(rt->dst.dev), GFP_ATOMIC)) == NULL) {
|
||||
if ((frag = alloc_skb(len + hlen + sizeof(struct frag_hdr) +
|
||||
hroom + troom, GFP_ATOMIC)) == NULL) {
|
||||
NETDEBUG(KERN_INFO "IPv6: frag: no memory for new fragment!\n");
|
||||
IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
|
||||
IPSTATS_MIB_FRAGFAILS);
|
||||
|
@ -828,7 +832,7 @@ slow_path:
|
|||
*/
|
||||
|
||||
ip6_copy_metadata(frag, skb);
|
||||
skb_reserve(frag, LL_RESERVED_SPACE(rt->dst.dev));
|
||||
skb_reserve(frag, hroom);
|
||||
skb_put(frag, len + hlen + sizeof(struct frag_hdr));
|
||||
skb_reset_network_header(frag);
|
||||
fh = (struct frag_hdr *)(skb_network_header(frag) + hlen);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue