diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2011-11-17 21:20:05 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-18 14:37:10 -0500 |
commit | 4ce4091256d61f8e9c7296f6643c8bd5bb2a00e5 (patch) | |
tree | ff41287641f6320a993d67afa6c41bff4cfdbc39 /net/packet/af_packet.c | |
parent | 56c978f1da1f630ef18aa668a9748c6c23ab819b (diff) |
packet: Add needed_tailroom to packet_sendmsg_spkt
packet: Add needed_tailroom to packet_sendmsg_spkt
While auditing LL_ALLOCATED_SPACE I noticed that packet_sendmsg_spkt
did not include needed_tailroom when allocating an skb. This isn't
a fatal error as we should always tolerate inadequate tail room but
it isn't optimal.
This patch fixes that.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/packet/af_packet.c')
-rw-r--r-- | net/packet/af_packet.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 71c1a7521d32..0da505c9ac23 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -1499,10 +1499,11 @@ retry: | |||
1499 | 1499 | ||
1500 | if (!skb) { | 1500 | if (!skb) { |
1501 | size_t reserved = LL_RESERVED_SPACE(dev); | 1501 | size_t reserved = LL_RESERVED_SPACE(dev); |
1502 | int tlen = dev->needed_tailroom; | ||
1502 | unsigned int hhlen = dev->header_ops ? dev->hard_header_len : 0; | 1503 | unsigned int hhlen = dev->header_ops ? dev->hard_header_len : 0; |
1503 | 1504 | ||
1504 | rcu_read_unlock(); | 1505 | rcu_read_unlock(); |
1505 | skb = sock_wmalloc(sk, len + reserved, 0, GFP_KERNEL); | 1506 | skb = sock_wmalloc(sk, len + reserved + tlen, 0, GFP_KERNEL); |
1506 | if (skb == NULL) | 1507 | if (skb == NULL) |
1507 | return -ENOBUFS; | 1508 | return -ENOBUFS; |
1508 | /* FIXME: Save some space for broken drivers that write a hard | 1509 | /* FIXME: Save some space for broken drivers that write a hard |