* [PATCH net] udp_tunnel: Fix end of loop test in udp_tunnel_nic_unregister()
@ 2022-02-22 13:42 Dan Carpenter
2022-02-23 12:40 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-02-22 13:42 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski
Cc: Hideaki YOSHIFUJI, David Ahern, netdev, kernel-janitors
This test is checking if we exited the list via break or not. However
if it did not exit via a break then "node" does not point to a valid
udp_tunnel_nic_shared_node struct. It will work because of the way
the structs are laid out it's the equivalent of
"if (info->shared->udp_tunnel_nic_info != dev)" which will always be
true, but it's not the right way to test.
Fixes: 74cc6d182d03 ("udp_tunnel: add the ability to share port tables")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
net/ipv4/udp_tunnel_nic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/udp_tunnel_nic.c b/net/ipv4/udp_tunnel_nic.c
index b91003538d87..bc3a043a5d5c 100644
--- a/net/ipv4/udp_tunnel_nic.c
+++ b/net/ipv4/udp_tunnel_nic.c
@@ -846,7 +846,7 @@ udp_tunnel_nic_unregister(struct net_device *dev, struct udp_tunnel_nic *utn)
list_for_each_entry(node, &info->shared->devices, list)
if (node->dev == dev)
break;
- if (node->dev != dev)
+ if (list_entry_is_head(node, &info->shared->devices, list))
return;
list_del(&node->list);
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] udp_tunnel: Fix end of loop test in udp_tunnel_nic_unregister()
2022-02-22 13:42 [PATCH net] udp_tunnel: Fix end of loop test in udp_tunnel_nic_unregister() Dan Carpenter
@ 2022-02-23 12:40 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-02-23 12:40 UTC (permalink / raw)
To: Dan Carpenter; +Cc: davem, kuba, yoshfuji, dsahern, netdev, kernel-janitors
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:
On Tue, 22 Feb 2022 16:42:51 +0300 you wrote:
> This test is checking if we exited the list via break or not. However
> if it did not exit via a break then "node" does not point to a valid
> udp_tunnel_nic_shared_node struct. It will work because of the way
> the structs are laid out it's the equivalent of
> "if (info->shared->udp_tunnel_nic_info != dev)" which will always be
> true, but it's not the right way to test.
>
> [...]
Here is the summary with links:
- [net] udp_tunnel: Fix end of loop test in udp_tunnel_nic_unregister()
https://git.kernel.org/netdev/net/c/de7b2efacf4e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-23 12:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-22 13:42 [PATCH net] udp_tunnel: Fix end of loop test in udp_tunnel_nic_unregister() Dan Carpenter
2022-02-23 12:40 ` patchwork-bot+netdevbpf
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).