summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorGustavo A. R. Silva <garsilva@embeddedor.com>2017-05-24 01:18:37 +0200
committerDavid S. Miller <davem@davemloft.net>2017-05-25 18:54:02 +0200
commit65d786c21bf8140dac83563306f46fe0b13a9aaa (patch)
treed06216d5b8d3fa595687e5351c9768374191f167 /drivers/net
parentgeneve: fix fill_info when using collect_metadata (diff)
downloadlinux-65d786c21bf8140dac83563306f46fe0b13a9aaa.tar.xz
linux-65d786c21bf8140dac83563306f46fe0b13a9aaa.zip
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 <garsilva@embeddedor.com> Acked-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/gtp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index 4fea1b3dfbb4..7b652bb7ebe4 100644
--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -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 == &gtp_netdev_ops)
+ if (dev && dev->netdev_ops == &gtp_netdev_ops)
gtp = netdev_priv(dev);
put_net(net);