FAILED: patch "[PATCH] tipc: Fix end of loop tests for list_for_each_entry()" failed to apply to 4.9-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From a1f8fec4dac8bc7b172b2bdbd881e015261a6322 Mon Sep 17 00:00:00 2001
From: Dan Carpenter <[email protected]>
Date: Tue, 22 Feb 2022 16:43:12 +0300
Subject: [PATCH] tipc: Fix end of loop tests for list_for_each_entry()
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.
net/tipc/name_table.c +1 -1
@@ -967,7 +967,7 @@ static int __tipc_nl_add_nametable_publ(struct tipc_nl_msg *msg,list_for_each_entry (p, &sr->all_publ, all_publ)if (p->key == *last_key)break ; -if (p->key != *last_key) +if (list_entry_is_head (p, &sr->all_publ, all_publ))return -EPIPE ; }else { p = list_first_entry(&sr->all_publ,
net/tipc/socket.c +1 -1
@@ -3749,7 +3749,7 @@ static int __tipc_nl_list_sk_publ(struct sk_buff *skb,if (p->key == *last_publ)break ; } -if (p->key != *last_publ) { +if (list_entry_is_head (p, &tsk->publications, binding_sock)) {/* We never set seq or call nl_dump_check_consistent() * this means that setting prev_seq here will cause the * consistence check to fail in the netlink callback