packet: Add needed_tailroom to packet_sendmsg_spkt
authorHerbert Xu <herbert@gondor.apana.org.au>
Fri, 18 Nov 2011 02:20:05 +0000 (02:20 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Nov 2011 19:37:10 +0000 (14:37 -0500)
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>
net/packet/af_packet.c

index 71c1a7521d326195f873899390ef4fc8fe30a612..0da505c9ac233b9cf2ca4f20475dc8d987ef68d5 100644 (file)
@@ -1499,10 +1499,11 @@ retry:
 
        if (!skb) {
                size_t reserved = LL_RESERVED_SPACE(dev);
+               int tlen = dev->needed_tailroom;
                unsigned int hhlen = dev->header_ops ? dev->hard_header_len : 0;
 
                rcu_read_unlock();
-               skb = sock_wmalloc(sk, len + reserved, 0, GFP_KERNEL);
+               skb = sock_wmalloc(sk, len + reserved + tlen, 0, GFP_KERNEL);
                if (skb == NULL)
                        return -ENOBUFS;
                /* FIXME: Save some space for broken drivers that write a hard