Thread (5 messages) flat view 5 messages, 4 authors, 2018-06-22

Re: [PATCH] net: bridge: fix potential null pointer dereference on return from br_port_get_rtnl()

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2018-06-21 23:21:23
Also in: bridge, lkml

On Fri, 22 Jun 2018 07:20:56 +0900 (KST)
David Miller [off-list ref] wrote:
From: Garry McNulty <redacted>
Date: Thu, 21 Jun 2018 21:14:27 +0100
quoted
br_port_get_rtnl() can return NULL if the network device is not a bridge
port (IFF_BRIDGE_PORT flag not set). br_port_slave_changelink() and
br_port_fill_slave_info() callbacks dereference this pointer without
checking. Currently this is not a problem because slave devices always
set this flag. Add null check in case these conditions ever change.

Detected by CoverityScan, CID 1339613 ("Dereference null return value")

Signed-off-by: Garry McNulty <redacted>  
I don't think this is reasonable.

The bridge code will never, ever, install a slave that doesn't have
that bit set.  It's the most fundamental aspect of how these objects
are managed.
Agree with dave. Workarounds for static tools are ok if they don't introduce
other paths. But if your fix introduces another error path which can never
be reached, it is hurting not helping.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help