Skip to contentSkip to conversation

sit: do not report an error from ipip6_fill_info()

PATCH Applied Eric Dumazet 4 participants 4 messages Sep 12 – Sep 15

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sit: do not report an error from ipip6_fill_info()

ipip6_fill_info() returns -ENODEV if tunnel->sit_parms is NULL.

This can not happen yet: sit_parms is only cleared from ipip6_dev_free(), the priv_destructor, which runs long after RTM_DELLINK has been built.

Returning an error from a fill_info() handler is still a trap, because rtnl_dump_ifinfo() stops at the first failure and propagates it, letting one device hide all the remaining ones.

Return 0 instead, there is nothing to report for a device that is going away.

---
 net/ipv6/sit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/sit.c +2 -1
index 14ba3cfb304a83ee37e3be5b09a57c371f1977c3..a7ec800216ade169985d389ad1dc672f0358f4ee 100644
@@ -1853,9 +1853,10 @@ static int ipip6_fill_info(struct sk_buff *skb, const struct net_device *dev)
 
 	rcu_read_lock();
 	parm = rcu_dereference(tunnel->sit_parms);
+	/* If the device is being dismantled, there is nothing to report. */
 	if (!parm) {
 		rcu_read_unlock();
-		return -ENODEV;
+		return 0;
 	}
 
 	if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) ||
Signature · 1 line
2.55.0.1007.g17ff1f9808-goog
Reviewed-by Xuanqiang Luo on v1 1/1
#1 lore raw
Quoted 6 lines · Eric Dumazet

ipip6_fill_info() returns -ENODEV if tunnel->sit_parms is NULL.

This can not happen yet: sit_parms is only cleared from ipip6_dev_free(), the priv_destructor, which runs long after RTM_DELLINK has been built.

Quoted 8 lines

Returning an error from a fill_info() handler is still a trap, because rtnl_dump_ifinfo() stops at the first failure and propagates it, letting one device hide all the remaining ones.

Return 0 instead, there is nothing to report for a device that is going away.

Thanks,
Xuanqiang

Acked-by on v1 1/1
#2 lore raw
In reply to Eric Dumazet
Quoted 6 lines

ipip6_fill_info() returns -ENODEV if tunnel->sit_parms is NULL.

This can not happen yet: sit_parms is only cleared from ipip6_dev_free(), the priv_destructor, which runs long after RTM_DELLINK has been built.

Quoted 8 lines

Returning an error from a fill_info() handler is still a trap, because rtnl_dump_ifinfo() stops at the first failure and propagates it, letting one device hide all the remaining ones.

Return 0 instead, there is nothing to report for a device that is going away.

Quoted 24 lines
---
 net/ipv6/sit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/sit.c +2 -1
index 14ba3cfb304a83ee37e3be5b09a57c371f1977c3..a7ec800216ade169985d389ad1dc672f0358f4ee 100644
@@ -1853,9 +1853,10 @@ static int ipip6_fill_info(struct sk_buff *skb, const struct net_device *dev)
 
 	rcu_read_lock();
 	parm = rcu_dereference(tunnel->sit_parms);
+	/* If the device is being dismantled, there is nothing to report. */
 	if (!parm) {
 		rcu_read_unlock();
-		return -ENODEV;
+		return 0;
 	}
 
 	if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) ||
Signature · 1 line
2.55.0.1007.g17ff1f9808-goog
#3 lore raw
In reply to Eric Dumazet
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Sat, 12 Sep 2026 00:54:42 +0000 you wrote:

ipip6_fill_info() returns -ENODEV if tunnel->sit_parms is NULL.

This can not happen yet: sit_parms is only cleared from ipip6_dev_free(), the priv_destructor, which runs long after RTM_DELLINK has been built.

Returning an error from a fill_info() handler is still a trap, because rtnl_dump_ifinfo() stops at the first failure and propagates it, letting one device hide all the remaining ones.

[...]

Here is the summary with links:
- [net-next] sit: do not report an error from ipip6_fill_info()

    https://git.kernel.org/netdev/net-next/c/f7cd8d2dc74d

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html