Subject: Re: [PATCH v5 net-next 3/5] rtnetlink: do not acquire RTNL in rtnl_getlink() with RTEXT_FILTER_NAME_ONLY

From: Jakub Kicinski <[email-masked]>
Date: Tue, 26 May 2026 19:30:03 -0700

On Mon, 25 May 2026 08:35:40 +0000 Eric Dumazet wrote:
> +	need_rtnl = !(ext_filter_mask & RTEXT_FILTER_NAME_ONLY);
> +
> +retry:
> +	if (need_rtnl) {
> +		rtnl_lock();

I'm probably paranoid but can't shake the feeling that we should add 
a check here that the device is still registered / alive. Running full
rtnl_fill_ifinfo() after we may have already called ndo_uninit() seems
a little risky.

I don't want to delay the series any longer tho, please follow up
if you agree. Otherwise we can defer until/unless syzbot proves us
wrong..

> +		/* Synchronize the carrier state so we don't report a state
> +		 * that we're not actually going to honour immediately; if
> +		 * the driver just did a carrier off->on transition, we can
> +		 * only TX if link watch work has run, but without this we'd
> +		 * already report carrier on, even if it doesn't work yet.
> +		 */
> +		linkwatch_sync_dev(dev);
> +	}
> +
>  	err = -ENOBUFS;
>  	nskb = nlmsg_new_large(if_nlmsg_size(dev, ext_filter_mask));
> -	if (nskb == NULL)
> -		goto out;
> +	if (nskb)
> +		err = rtnl_fill_ifinfo(nskb, dev, net,
> +				       RTM_NEWLINK, NETLINK_CB(skb).portid,
> +				       nlh->nlmsg_seq, 0, 0, ext_filter_mask,
> +				       0, NULL, 0, netnsid, GFP_KERNEL);