netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sowmini Varadhan <sowmini.varadhan@oracle.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	eric.dumazet@gmail.com, dvyukov@google.com,
	Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net 2/2] packet: round up linear to header len
Date: Wed, 8 Feb 2017 07:34:54 -0800	[thread overview]
Message-ID: <20170208153454.GD30741@oracle.com> (raw)
In-Reply-To: <20170207205721.23207-3-willemdebruijn.kernel@gmail.com>

On (02/07/17 15:57), Willem de Bruijn wrote:
> @@ -2816,8 +2816,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);

do we need a similar check in packet_sendsmg_spkt (even if it
is deprecated, would be better to get it to align with packet_snd?)

Also tpacket_fill_skb should ensure that copylen is set up like
the code above?

--Sowmini

  parent reply	other threads:[~2017-02-08 15:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 20:57 [PATCH net 0/2] Fixes for header length truncation Willem de Bruijn
2017-02-07 20:57 ` [PATCH net 1/2] net: introduce device min_header_len Willem de Bruijn
2017-02-07 21:20   ` Eric Dumazet
2017-02-07 21:24   ` Sowmini Varadhan
2017-02-07 20:57 ` [PATCH net 2/2] packet: round up linear to header len Willem de Bruijn
2017-02-07 21:23   ` Eric Dumazet
2017-02-08 15:34   ` Sowmini Varadhan [this message]
2017-02-08 16:37     ` Willem de Bruijn
2017-02-08 16:58       ` Sowmini Varadhan
2017-02-08 17:27         ` Willem de Bruijn
2017-02-08 18:56 ` [PATCH net 0/2] Fixes for header length truncation David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170208153454.GD30741@oracle.com \
    --to=sowmini.varadhan@oracle.com \
    --cc=davem@davemloft.net \
    --cc=dvyukov@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=willemb@google.com \
    --cc=willemdebruijn.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).