net: fix potential null pointer dereference
Subsystems (3)
PATCH 1/1 net: fix potential null pointer dereference
Add null check to avoid a potential null pointer dereference.
Addresses-Coverity-ID: 1408831
Signed-off-by Gustavo A. R. Silva <[email protected]>
--- drivers/net/gtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/gtp.c +1 -1
@@ -873,7 +873,7 @@ static struct gtp_dev *gtp_find_dev(struct net *src_net, struct nlattr *nla[])/* Check if there's an existing gtpX device to configure */ dev =dev_get_by_index_rcu (net,nla_get_u32 (nla[GTPA_LINK ])); -if (dev->netdev_ops == >p_netdev_ops) +if (dev && dev->netdev_ops == >p_netdev_ops) gtp =netdev_priv (dev);put_net (net);
Signature · 1 line
2.5.0
Quoted 4 lines · Gustavo A. R. Silva
Add null check to avoid a potential null pointer dereference.
Addresses-Coverity-ID: 1408831
Signed-off-by Gustavo A. R. Silva <[email protected]>
This is a fix for the net.git tree BTW.
From: "Gustavo A. R. Silva" <[email protected]>
Date: Tue, 23 May 2017 18:18:37 -0500
Quoted 4 lines
Add null check to avoid a potential null pointer dereference.
Addresses-Coverity-ID: 1408831
Signed-off-by Gustavo A. R. Silva <[email protected]>
Applied, thank you.