aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/mcast.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2011-11-17 21:20:04 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-18 14:37:09 -0500
commita7ae1992248e5cf9dc5bd35695ab846d27efe15f (patch)
treeed3f450a41ca5975aecae2850105ca22f98ca318 /net/ipv6/mcast.c
parent660882432909dbe611f1792eda158188065cb9f1 (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/mcast.c')
-rw-r--r--net/ipv6/mcast.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index ee7839f4d6e3..7b94bebb73b1 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1343,13 +1343,15 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size)
1343 struct mld2_report *pmr; 1343 struct mld2_report *pmr;
1344 struct in6_addr addr_buf; 1344 struct in6_addr addr_buf;
1345 const struct in6_addr *saddr; 1345 const struct in6_addr *saddr;
1346 int hlen = LL_RESERVED_SPACE(dev);
1347 int tlen = dev->needed_tailroom;
1346 int err; 1348 int err;
1347 u8 ra[8] = { IPPROTO_ICMPV6, 0, 1349 u8 ra[8] = { IPPROTO_ICMPV6, 0,
1348 IPV6_TLV_ROUTERALERT, 2, 0, 0, 1350 IPV6_TLV_ROUTERALERT, 2, 0, 0,
1349 IPV6_TLV_PADN, 0 }; 1351 IPV6_TLV_PADN, 0 };
1350 1352
1351 /* we assume size > sizeof(ra) here */ 1353 /* we assume size > sizeof(ra) here */
1352 size += LL_ALLOCATED_SPACE(dev); 1354 size += hlen + tlen;
1353 /* limit our allocations to order-0 page */ 1355 /* limit our allocations to order-0 page */
1354 size = min_t(int, size, SKB_MAX_ORDER(0, 0)); 1356 size = min_t(int, size, SKB_MAX_ORDER(0, 0));
1355 skb = sock_alloc_send_skb(sk, size, 1, &err); 1357 skb = sock_alloc_send_skb(sk, size, 1, &err);
@@ -1357,7 +1359,7 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size)
1357 if (!skb) 1359 if (!skb)
1358 return NULL; 1360 return NULL;
1359 1361
1360 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 1362 skb_reserve(skb, hlen);
1361 1363
1362 if (ipv6_get_lladdr(dev, &addr_buf, IFA_F_TENTATIVE)) { 1364 if (ipv6_get_lladdr(dev, &addr_buf, IFA_F_TENTATIVE)) {
1363 /* <draft-ietf-magma-mld-source-05.txt>: 1365 /* <draft-ietf-magma-mld-source-05.txt>:
@@ -1723,6 +1725,8 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
1723 struct mld_msg *hdr; 1725 struct mld_msg *hdr;
1724 const struct in6_addr *snd_addr, *saddr; 1726 const struct in6_addr *snd_addr, *saddr;
1725 struct in6_addr addr_buf; 1727 struct in6_addr addr_buf;
1728 int hlen = LL_RESERVED_SPACE(dev);
1729 int tlen = dev->needed_tailroom;
1726 int err, len, payload_len, full_len; 1730 int err, len, payload_len, full_len;
1727 u8 ra[8] = { IPPROTO_ICMPV6, 0, 1731 u8 ra[8] = { IPPROTO_ICMPV6, 0,
1728 IPV6_TLV_ROUTERALERT, 2, 0, 0, 1732 IPV6_TLV_ROUTERALERT, 2, 0, 0,
@@ -1744,7 +1748,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
1744 IPSTATS_MIB_OUT, full_len); 1748 IPSTATS_MIB_OUT, full_len);
1745 rcu_read_unlock(); 1749 rcu_read_unlock();
1746 1750
1747 skb = sock_alloc_send_skb(sk, LL_ALLOCATED_SPACE(dev) + full_len, 1, &err); 1751 skb = sock_alloc_send_skb(sk, hlen + tlen + full_len, 1, &err);
1748 1752
1749 if (skb == NULL) { 1753 if (skb == NULL) {
1750 rcu_read_lock(); 1754 rcu_read_lock();
@@ -1754,7 +1758,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
1754 return; 1758 return;
1755 } 1759 }
1756 1760
1757 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 1761 skb_reserve(skb, hlen);
1758 1762
1759 if (ipv6_get_lladdr(dev, &addr_buf, IFA_F_TENTATIVE)) { 1763 if (ipv6_get_lladdr(dev, &addr_buf, IFA_F_TENTATIVE)) {
1760 /* <draft-ietf-magma-mld-source-05.txt>: 1764 /* <draft-ietf-magma-mld-source-05.txt>: