netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: bridge: fix potential NULL pointer dereference
@ 2017-06-05 21:30 Gustavo A. R. Silva
  2017-06-05 22:05 ` Nikolay Aleksandrov
  0 siblings, 1 reply; 6+ messages in thread
From: Gustavo A. R. Silva @ 2017-06-05 21:30 UTC (permalink / raw)
  To: Stephen Hemminger, David S. Miller
  Cc: bridge, netdev, linux-kernel, Gustavo A. R. Silva

Add NULL check before dereferencing pointer _p_ inside br_afspec().

Addresses-Coverity-ID: 1401872
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 net/bridge/br_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 1e63ec4..ad85a9c 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -776,7 +776,7 @@ int br_setlink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags)
 			goto out;
 	}
 
-	if (afspec) {
+	if (p && afspec) {
 		err = br_afspec((struct net_bridge *)netdev_priv(dev), p,
 				afspec, RTM_SETLINK);
 	}
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-06-06 20:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-05 21:30 [PATCH] net: bridge: fix potential NULL pointer dereference Gustavo A. R. Silva
2017-06-05 22:05 ` Nikolay Aleksandrov
2017-06-05 22:26   ` [PATCH net] net: bridge: fix a null pointer dereference in br_afspec Nikolay Aleksandrov
2017-06-06  5:28     ` Roopa Prabhu
2017-06-06 20:06     ` David Miller
2017-06-06  3:13   ` [PATCH] net: bridge: fix potential NULL pointer dereference Gustavo A. R. Silva

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).