aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee802154/raw.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
commitae641949df01b85117845bec45328eab6d6fada1 (patch)
treeed8d5aedd678f86e8554dc0b1c080a43ef4b331d /net/ieee802154/raw.c
parenta7ae1992248e5cf9dc5bd35695ab846d27efe15f (diff)
net: Remove all uses of LL_ALLOCATED_SPACE
net: 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 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/ieee802154/raw.c')
-rw-r--r--net/ieee802154/raw.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ieee802154/raw.c b/net/ieee802154/raw.c
index 10970ca8574..f96bae8fd33 100644
--- a/net/ieee802154/raw.c
+++ b/net/ieee802154/raw.c
@@ -108,6 +108,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
108 struct net_device *dev; 108 struct net_device *dev;
109 unsigned mtu; 109 unsigned mtu;
110 struct sk_buff *skb; 110 struct sk_buff *skb;
111 int hlen, tlen;
111 int err; 112 int err;
112 113
113 if (msg->msg_flags & MSG_OOB) { 114 if (msg->msg_flags & MSG_OOB) {
@@ -137,12 +138,14 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
137 goto out_dev; 138 goto out_dev;
138 } 139 }
139 140
140 skb = sock_alloc_send_skb(sk, LL_ALLOCATED_SPACE(dev) + size, 141 hlen = LL_RESERVED_SPACE(dev);
142 tlen = dev->needed_tailroom;
143 skb = sock_alloc_send_skb(sk, hlen + tlen + size,
141 msg->msg_flags & MSG_DONTWAIT, &err); 144 msg->msg_flags & MSG_DONTWAIT, &err);
142 if (!skb) 145 if (!skb)
143 goto out_dev; 146 goto out_dev;
144 147
145 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 148 skb_reserve(skb, hlen);
146 149
147 skb_reset_mac_header(skb); 150 skb_reset_mac_header(skb);
148 skb_reset_network_header(skb); 151 skb_reset_network_header(skb);