diff options
author | David S. Miller <davem@davemloft.net> | 2017-02-11 10:31:11 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-02-11 10:31:11 +0300 |
commit | 35eeacf1820a08305c2b0960febfa190f5a6dd63 (patch) | |
tree | f1227c7384ee01d3f029cc5f82223234e6456c5f /net/packet | |
parent | bed45f79a2afc9d7c279b880dfcac8f27d513b50 (diff) | |
parent | 1ee18329fae936089c6c599250ae92482ff2b81f (diff) | |
download | linux-35eeacf1820a08305c2b0960febfa190f5a6dd63.tar.xz |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'net/packet')
-rw-r--r-- | net/packet/af_packet.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 9854baad66ab..a984f6f9ab4e 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -2776,7 +2776,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) struct virtio_net_hdr vnet_hdr = { 0 }; int offset = 0; struct packet_sock *po = pkt_sk(sk); - int hlen, tlen; + int hlen, tlen, linear; int extra_len = 0; /* @@ -2837,8 +2837,9 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) err = -ENOBUFS; hlen = LL_RESERVED_SPACE(dev); tlen = dev->needed_tailroom; - skb = packet_alloc_skb(sk, hlen + tlen, hlen, len, - __virtio16_to_cpu(vio_le(), vnet_hdr.hdr_len), + linear = __virtio16_to_cpu(vio_le(), vnet_hdr.hdr_len); + linear = max(linear, min_t(int, len, dev->hard_header_len)); + skb = packet_alloc_skb(sk, hlen + tlen, hlen, len, linear, msg->msg_flags & MSG_DONTWAIT, &err); if (skb == NULL) goto out_unlock; |