* [PATCH] net: tipc: prevent possible null deref of link
@ 2020-12-07 8:14 Cengiz Can
2020-12-08 23:54 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Cengiz Can @ 2020-12-07 8:14 UTC (permalink / raw)
To: Jon Maloy, Ying Xue, David S . Miller, Jakub Kicinski
Cc: netdev, tipc-discussion, linux-kernel, Cengiz Can
`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>
---
net/tipc/node.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/tipc/node.c b/net/tipc/node.c
index c95d037fde51..83978d5dae59 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -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);
}
--
2.29.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: tipc: prevent possible null deref of link
2020-12-07 8:14 [PATCH] net: tipc: prevent possible null deref of link Cengiz Can
@ 2020-12-08 23:54 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-12-08 23:54 UTC (permalink / raw)
To: cengiz; +Cc: jmaloy, ying.xue, kuba, netdev, tipc-discussion, linux-kernel
From: Cengiz Can <cengiz@kernel.wtf>
Date: Mon, 7 Dec 2020 11:14:24 +0300
> `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>
> ---
Applied, thanks.,
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-08 23:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-07 8:14 [PATCH] net: tipc: prevent possible null deref of link Cengiz Can
2020-12-08 23:54 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).