Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: stephen@networkplumber.org
Cc: netdev@vger.kernel.org, dsahern@kernel.org, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, kuniyu@google.com, idosch@nvidia.com,
	sd@queasysnail.net, sdf.kernel@gmail.com, parri.andrea@gmail.com,
	nickgarlis@gmail.com, willemb@google.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2 1/3] rtnetlink: return EMSGSIZE when first dump entry does not fit
Date: Thu, 12 Nov 2026 05:27:09 +0000	[thread overview]
Message-ID: <179446122919.2199510.14139950363270003881@kernel.org> (raw)
In-Reply-To: <20261110172925.3293312-2-stephen@networkplumber.org>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The concern: in rtnl_dumpit() (net/core/rtnetlink.c), this patch
  only turns an err == -EMSGSIZE returned with an empty skb into an…

--

rtnetlink: return EMSGSIZE when first dump entry does not fit

This patch changes rtnl_dumpit() for handlers registered with
RTNL_FLAG_DUMP_SPLIT_NLM_DONE. With the patch, an -EMSGSIZE return on an
empty skb is passed back to user space as an error and is no longer
dropped. Before, a first entry too large for the initial NLMSG_GOODSIZE
skb ended the dump with NLMSG_DONE and status 0.

> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index e141340172ce3..2777796a4ed2c 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -7043,7 +7043,10 @@ static int rtnl_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
>  	 * Some applications which parse netlink manually depend on this.
>  	 */
>  	if (cb->flags & RTNL_FLAG_DUMP_SPLIT_NLM_DONE) {
> -		if (err < 0 && err != -EMSGSIZE)
> +		/* -EMSGSIZE with nothing in the skb is an error, as returning
> +		 * a length of 0 would end the dump as if it was complete.
> +		 */
> +		if (err < 0 && (err != -EMSGSIZE || !skb->len))
>  			return err;

[Severity: Low]

Does this also cover the IPv6 route dump? inet6_dump_fib() is registered
with RTNL_FLAG_DUMP_SPLIT_NLM_DONE too, but it does not use -EMSGSIZE to
report that a route did not fit.

When the first route does not fit, rt6_dump_route() returns 0, and
fib6_dump_node() turns that into a positive return:

net/ipv6/ip6_fib.c:fib6_dump_node() {
    ...
		res = rt6_dump_route(rt, w->args, w->skip_in_node);
		if (res >= 0) {
			/* Frame is full, suspend walking */
			w->leaf = rt;
			...
			w->skip_in_node += res;

			return 1;
		}
    ...
}

inet6_dump_fib() passes that positive value back up. With err > 0, the
new check above never fires, and rtnl_dumpit() still reaches
"return skb->len" with skb->len == 0.

With only this patch applied, would an oversized IPv6 multipath route
still end the dump with NLMSG_DONE and status 0?

The AF_UNSPEC path has the same dependency. rtnl_dump_all() ends with
"return skb->len ? : ret", so it only reports an error if the IPv6
handler returns -EMSGSIZE.

The next patch in the series, "ipv6: return EMSGSIZE when first route in
dump does not fit", appears to close this gap. It adds the following to
inet6_dump_fib():

	if (err > 0 && !skb->len)
		err = -EMSGSIZE;

The selftest "selftests: net: netlink-dumps: test dump of route larger
than skb" also checks both AF_INET and AF_INET6.

The commit message here says in general terms that an oversized route
entry silently truncates the dump. Could it say that this patch only
fixes handlers that return -EMSGSIZE, and that the IPv6 case is fixed
by the following patch?

>  		if (!err)
>  			cb->data = NULL;

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261110172925.3293312-1-stephen%40networkplumber.org

  reply	other threads:[~2026-11-12  5:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 17:26 [PATCH net v2 0/3] rtnetlink: fix truncation of dump entry Stephen Hemminger
2026-11-10 17:26 ` [PATCH net v2 1/3] rtnetlink: return EMSGSIZE when first dump entry does not fit Stephen Hemminger
2026-11-12  5:27   ` netdev-bot+sashiko [this message]
2026-11-12 15:31   ` Ido Schimmel
2026-11-10 17:26 ` [PATCH net v2 2/3] ipv6: return EMSGSIZE when first route in dump " Stephen Hemminger
2026-11-12 15:31   ` Ido Schimmel
2026-11-12 16:17     ` Stephen Hemminger
2026-11-10 17:26 ` [PATCH net v2 3/3] selftests: net: netlink-dumps: test dump of route larger than skb Stephen Hemminger
2026-11-12  5:27   ` netdev-bot+sashiko
2026-11-11  2:23 ` [PATCH net v2 0/3] rtnetlink: fix truncation of dump entry Hangbin Liu

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=179446122919.2199510.14139950363270003881@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nickgarlis@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=parri.andrea@gmail.com \
    --cc=sd@queasysnail.net \
    --cc=sdf.kernel@gmail.com \
    --cc=stephen@networkplumber.org \
    --cc=willemb@google.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