]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
tipc: Fix end of loop tests for list_for_each_entry()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 22 Feb 2022 13:43:12 +0000 (16:43 +0300)
committerPaolo Pisati <paolo.pisati@canonical.com>
Mon, 7 Mar 2022 10:45:58 +0000 (11:45 +0100)
commit29eb99b5a6fbca51ffe40bb1858f5790a452355c
treef8aa56eb53df5a26892dfd6ab56241876fb89a3f
parent590b229af09d0438c676eca835ad52502b45baa7
tipc: Fix end of loop tests for list_for_each_entry()

BugLink: https://bugs.launchpad.net/bugs/1963891
commit a1f8fec4dac8bc7b172b2bdbd881e015261a6322 upstream.

These tests are supposed to check if the loop exited via a break or not.
However the tests are wrong because if we did not exit via a break then
"p" is not a valid pointer.  In that case, it's the equivalent of
"if (*(u32 *)sr == *last_key) {".  That's going to work most of the time,
but there is a potential for those to be equal.

Fixes: 1593123a6a49 ("tipc: add name table dump to new netlink api")
Fixes: 1a1a143daf84 ("tipc: add publication dump to new netlink api")
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>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
net/tipc/name_table.c
net/tipc/socket.c