net: tipc: prevent possible null deref of link
Subsystems (3)
PATCH 1/1 net: tipc: prevent possible null deref of link
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.
--- net/tipc/node.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/tipc/node.c +4 -2
@@ -2181,9 +2181,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 ); }
Signature · 1 line
2.29.2
From: Cengiz Can <[email protected]>
Date: Mon, 7 Dec 2020 11:14:24 +0300
Quoted 11 lines
tipc_node_apply_propertydoes a null check on atipc_link_entrypointer 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->linkcan 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->linkis null.Signed-off-by Cengiz Can <[email protected]>---
Applied, thanks.,