mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Hui Peng <benquike@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Kory Maincent <kory.maincent@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ethtool: tsinfo: release net_device reference in ethnl_tsinfo_start()
Date: Thu, 24 Sep 2026 09:07:15 -0700	[thread overview]
Message-ID: <20260924090715.029f1550@kernel.org> (raw)
In-Reply-To: <20260919204803.2811673-1-benquike@gmail.com>

On Sat, 19 Sep 2026 20:48:03 +0000 Hui Peng wrote:
> -	if (ctx->req_info->base.dev) {
> -		struct net_device *dev = ctx->req_info->base.dev;
> +	if (ctx->single_dev) {
> +		struct net_device *dev = dev_get_by_index(net, ctx->pos_ifindex);
>  
> +		if (!dev)
> +			return -ENODEV;
>  		netdev_lock_ops_compat(dev);
>  		ret = ethnl_tsinfo_dump_one_net_topo(skb, dev, cb);
>  		netdev_unlock_ops_compat(dev);
> +		dev_put(dev);
>  		return ret;

This issue gotta be theoretical, can you build a repro that actually
triggers multi-skb dump for a single netdev? We don't have that much
info, it's gonna fit.

If you can trigger pls update the commit msg, if you can't let's instead
make this "official" by adding:

diff --git a/net/ethtool/tsinfo.c b/net/ethtool/tsinfo.c
index c9b680a9cc3f..cbb5d6b7f3e3 100644
--- a/net/ethtool/tsinfo.c
+++ b/net/ethtool/tsinfo.c
@@ -482,6 +482,7 @@ int ethnl_tsinfo_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
                netdev_lock_ops_compat(dev);
                ret = ethnl_tsinfo_dump_one_net_topo(skb, dev, cb);
                netdev_unlock_ops_compat(dev);
+               /* We don't want to hold the device ref across messages */
+               WARN_ON_ONCE(ret == -EMSGSIZE);
                return ret;
        }
 

      parent reply	other threads:[~2026-09-24 16:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-19 20:48 Hui Peng
2026-09-23 21:11 ` netdev-bot+sashiko
2026-09-24 16:07 ` Jakub Kicinski [this message]

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=20260924090715.029f1550@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=benquike@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kory.maincent@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®