From: Stephen Hemminger <stephen@networkplumber.org>
To: Xin Long <lucien.xin@gmail.com>
Cc: network dev <netdev@vger.kernel.org>,
davem@davemloft.net, kuba@kernel.org,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Alexander Duyck <alexanderduyck@fb.com>
Subject: Re: [PATCH net] rtnetlink: not allow dev gro_max_size to exceed GRO_MAX_SIZE
Date: Fri, 19 May 2023 13:43:18 -0700 [thread overview]
Message-ID: <20230519134318.6508f057@hermes.local> (raw)
In-Reply-To: <25a7b1b138e5ad3c926afce8cd4e08d8b7ef3af6.1684516568.git.lucien.xin@gmail.com>
On Fri, 19 May 2023 13:16:08 -0400
Xin Long <lucien.xin@gmail.com> wrote:
> In commit 0fe79f28bfaf ("net: allow gro_max_size to exceed 65536"),
> it limited GRO_MAX_SIZE to (8 * 65535) to avoid overflows, but also
> deleted the check of GRO_MAX_SIZE when setting the dev gro_max_size.
>
> Currently, dev gro_max_size can be set up to U32_MAX (0xFFFFFFFF),
> and GRO_MAX_SIZE is not even used anywhere.
>
> This patch brings back the GRO_MAX_SIZE check when setting dev
> gro_max_size/gro_ipv4_max_size by users.
>
> Fixes: 0fe79f28bfaf ("net: allow gro_max_size to exceed 65536")
> Reported-by: Xiumei Mu <xmu@redhat.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
> net/core/rtnetlink.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 653901a1bf75..59b24b184cb0 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -2886,6 +2886,11 @@ static int do_setlink(const struct sk_buff *skb,
> if (tb[IFLA_GRO_MAX_SIZE]) {
> u32 gro_max_size = nla_get_u32(tb[IFLA_GRO_MAX_SIZE]);
>
> + if (gro_max_size > GRO_MAX_SIZE) {
> + err = -EINVAL;
> + goto errout;
> + }
> +
Please add extack messages so the error can be reported better.
next prev parent reply other threads:[~2023-05-19 20:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-19 17:16 [PATCH net] rtnetlink: not allow dev gro_max_size to exceed GRO_MAX_SIZE Xin Long
2023-05-19 20:43 ` Stephen Hemminger [this message]
2023-05-21 17:25 ` Eric Dumazet
2023-05-21 23:27 ` Xin Long
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=20230519134318.6508f057@hermes.local \
--to=stephen@networkplumber.org \
--cc=alexanderduyck@fb.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=lucien.xin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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).