diff options
| author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-02-22 16:42:51 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-03-02 11:51:06 +0100 |
| commit | 53742bde27b4987195c33701fe58d626017e4515 (patch) | |
| tree | 7b75dbf0d634db3c4eab120feb6ec371d21663c2 /net | |
| parent | d64fe6cf35dcf04bacea0e3570ba7f15fd33c4ee (diff) | |
| download | linux-53742bde27b4987195c33701fe58d626017e4515.tar.gz linux-53742bde27b4987195c33701fe58d626017e4515.tar.bz2 linux-53742bde27b4987195c33701fe58d626017e4515.zip | |
udp_tunnel: Fix end of loop test in udp_tunnel_nic_unregister()
commit de7b2efacf4e83954aed3f029d347dfc0b7a4f49 upstream.
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
| -rw-r--r-- | net/ipv4/udp_tunnel_nic.c | 2 |
1 files changed, 1 insertions, 1 deletions
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); |
