From: Gustavo A. R. Silva Date: Tue, 23 May 2017 23:18:37 +0000 (-0500) Subject: net: fix potential null pointer dereference X-Git-Tag: MMI-PSA29.97-13-9~5530^2~11 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=65d786c21bf8140dac83563306f46fe0b13a9aaa;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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 Acked-by: Pablo Neira Ayuso Signed-off-by: David S. Miller --- 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 == >p_netdev_ops) + if (dev && dev->netdev_ops == >p_netdev_ops) gtp = netdev_priv(dev); put_net(net);