[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1263114404-9340-1-git-send-email-jslaby@suse.cz>
Date: Sun, 10 Jan 2010 10:06:44 +0100
From: Jiri Slaby <jslaby@...e.cz>
To: davem@...emloft.net
Cc: linux-kernel@...r.kernel.org, jirislaby@...il.com,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
"Pekka Savola (ipv6)" <pekkas@...core.fi>,
James Morris <jmorris@...ei.org>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Patrick McHardy <kaber@...sh.net>, netdev@...r.kernel.org
Subject: [PATCH 1/1] NET: ipv6, fix potential null dereference
Stanse found a potential null dereference in snmp6_unregister_dev.
There is a check for idev being NULL, but it is dereferenced
earlier. Move the dereference after the check.
Signed-off-by: Jiri Slaby <jslaby@...e.cz>
Cc: "David S. Miller" <davem@...emloft.net>
Cc: Alexey Kuznetsov <kuznet@....inr.ac.ru>
Cc: "Pekka Savola (ipv6)" <pekkas@...core.fi>
Cc: James Morris <jmorris@...ei.org>
Cc: Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>
Cc: Patrick McHardy <kaber@...sh.net>
Cc: netdev@...r.kernel.org
---
net/ipv6/proc.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index c9605c3..53f4ef5 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -256,11 +256,12 @@ int snmp6_register_dev(struct inet6_dev *idev)
int snmp6_unregister_dev(struct inet6_dev *idev)
{
- struct net *net = dev_net(idev->dev);
- if (!net->mib.proc_net_devsnmp6)
- return -ENOENT;
+ struct net *net;
if (!idev || !idev->stats.proc_dir_entry)
return -EINVAL;
+ net = dev_net(idev->dev);
+ if (!net->mib.proc_net_devsnmp6)
+ return -ENOENT;
remove_proc_entry(idev->stats.proc_dir_entry->name,
net->mib.proc_net_devsnmp6);
idev->stats.proc_dir_entry = NULL;
--
1.6.5.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists