summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCengiz Can <cengiz@kernel.wtf>2020-12-07 11:14:24 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-12-21 13:28:18 +0100
commit4dd9051068f536453e7e8fedc7c6cc873a0910d7 (patch)
tree17625e98118ca81945ecf18cd582f07383f32832
parent2ab0a44384cbaa26b5bc6469e27c36afbd860c55 (diff)
downloadlinux-stable-4dd9051068f536453e7e8fedc7c6cc873a0910d7.tar.gz
linux-stable-4dd9051068f536453e7e8fedc7c6cc873a0910d7.tar.bz2
linux-stable-4dd9051068f536453e7e8fedc7c6cc873a0910d7.zip
net: tipc: prevent possible null deref of link
[ Upstream commit 0398ba9e5a4b5675aa571e0445689d3c2e499c2d ] `tipc_node_apply_property` does a null check on a `tipc_link_entry` pointer but also accesses the same pointer out of the null check block. This triggers a warning on Coverity Static Analyzer because we're implying that `e->link` can BE null. Move "Update MTU for node link entry" line into if block to make sure that we're not in a state that `e->link` is null. Signed-off-by: Cengiz Can <cengiz@kernel.wtf> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/tipc/node.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 8c9c12072a78..052c41cec89b 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -2170,9 +2170,11 @@ void tipc_node_apply_property(struct net *net, struct tipc_bearer *b,
&xmitq);
else if (prop == TIPC_NLA_PROP_MTU)
tipc_link_set_mtu(e->link, b->mtu);
+
+ /* Update MTU for node link entry */
+ e->mtu = tipc_link_mss(e->link);
}
- /* Update MTU for node link entry */
- e->mtu = tipc_link_mss(e->link);
+
tipc_node_write_unlock(n);
tipc_bearer_xmit(net, bearer_id, &xmitq, &e->maddr, NULL);
}