Skip to content

Commit

Permalink
packet: Add needed_tailroom to packet_sendmsg_spkt
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
herbertx authored and davem330 committed Nov 18, 2011
1 parent 56c978f commit 4ce4091
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/packet/af_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1499,10 +1499,11 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock,

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
Expand Down

0 comments on commit 4ce4091

Please sign in to comment.