udp_tunnel: Fix end of loop test in udp_tunnel_nic_unregister()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 22 Feb 2022 13:42:51 +0000 (16:42 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 2 Mar 2022 10:47:59 +0000 (11:47 +0100)
commit6b6094db77e65ccde68bff0ce3118bb3aa5d7e10
tree9bb7b5e674b0c60ed89a45ab7c88d67f23138221
parent4039254acbd4dfe778cc1502d53e9932e4dbd1c1
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>
net/ipv4/udp_tunnel_nic.c