From: Eric Dumazet <eric.dumazet@gmail.com>
To: Michael Chan <michael.chan@broadcom.com>,
davem@davemloft.net, maheshb@google.com, edumazet@google.com
Cc: dja@axrens.net, netdev@vger.kernel.org
Subject: Re: [PATCH RFC] net: Validate size of non-TSO packets in validate_xmit_skb().
Date: Tue, 26 Feb 2019 07:16:22 -0800 [thread overview]
Message-ID: <b1cea6c7-d750-aa53-cb5b-00181bde8b6f@gmail.com> (raw)
In-Reply-To: <1551178601-16564-1-git-send-email-michael.chan@broadcom.com>
On 02/26/2019 02:56 AM, Michael Chan wrote:
> There have been reports of oversize UDP packets being sent to the
> driver to be transmitted, causing error conditions. The issue is
> likely caused by the dst of the SKB switching between 'lo' with
> 64K MTU and the hardware device with a smaller MTU. Patches are
> being proposed by Mahesh Bandewar <maheshb@google.com> to fix the
> issue.
>
> Separately, we should add a length check in validate_xmit_skb()
> to drop these oversize packets before they reach the driver.
Why ?
We keep adding checks in the 'fast path' and make slower and slower after each release.
We need to fix the root cause really.
> This patch only validates non-TSO packets. Complete validation
> of segmented TSO packet size will probably be too slow.
>
> Signed-off-by: Michael Chan <michael.chan@broadcom.com>
> ---
> net/core/dev.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 5d03889..50c5174 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3373,6 +3373,13 @@ static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device
> }
> }
>
> + if (!skb_is_gso(skb) &&
> + skb->len > (dev->mtu + dev->hard_header_len + VLAN_HLEN)) {
> + net_warn_ratelimited("%s(): Dropping %d bytes oversize skb.\n",
> + __func__, skb->len);
> + goto out_kfree_skb;
> + }
> +
> skb = validate_xmit_xfrm(skb, features, again);
>
> return skb;
>
next prev parent reply other threads:[~2019-02-26 15:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-26 10:56 [PATCH RFC] net: Validate size of non-TSO packets in validate_xmit_skb() Michael Chan
2019-02-26 15:16 ` Eric Dumazet [this message]
2019-02-26 17:13 ` David Miller
2019-02-26 18:22 ` Michael Chan
2019-02-26 21:16 ` 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=b1cea6c7-d750-aa53-cb5b-00181bde8b6f@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=dja@axrens.net \
--cc=edumazet@google.com \
--cc=maheshb@google.com \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
/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