linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: fix potential null pointer dereference
@ 2017-05-23 23:18 Gustavo A. R. Silva
  2017-05-24  9:29 ` Pablo Neira Ayuso
  2017-05-25 16:54 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2017-05-23 23:18 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Harald Welte
  Cc: osmocom-net-gprs, netdev, linux-kernel, 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 <garsilva@embeddedor.com>
---
 drivers/net/gtp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index 4fea1b3..7b652bb 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);
-- 
2.5.0

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

* Re: [PATCH] net: fix potential null pointer dereference
  2017-05-23 23:18 [PATCH] net: fix potential null pointer dereference Gustavo A. R. Silva
@ 2017-05-24  9:29 ` Pablo Neira Ayuso
  2017-05-25 16:54 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2017-05-24  9:29 UTC (permalink / raw)
  To: Gustavo A. R. Silva; +Cc: Harald Welte, osmocom-net-gprs, netdev, linux-kernel

On Tue, May 23, 2017 at 06:18:37PM -0500, Gustavo A. R. Silva wrote:
> 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>

This is a fix for the net.git tree BTW.

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

* Re: [PATCH] net: fix potential null pointer dereference
  2017-05-23 23:18 [PATCH] net: fix potential null pointer dereference Gustavo A. R. Silva
  2017-05-24  9:29 ` Pablo Neira Ayuso
@ 2017-05-25 16:54 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-05-25 16:54 UTC (permalink / raw)
  To: garsilva; +Cc: pablo, laforge, osmocom-net-gprs, netdev, linux-kernel

From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Date: Tue, 23 May 2017 18:18:37 -0500

> Add null check to avoid a potential null pointer dereference.
> 
> Addresses-Coverity-ID: 1408831
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>

Applied, thank you.

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

end of thread, other threads:[~2017-05-25 16:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-23 23:18 [PATCH] net: fix potential null pointer dereference Gustavo A. R. Silva
2017-05-24  9:29 ` Pablo Neira Ayuso
2017-05-25 16:54 ` David Miller

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