aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorXi Wang <xi.wang@gmail.com>2013-01-05 11:19:24 +0000
committerDavid S. Miller <davem@davemloft.net>2013-01-06 21:11:18 -0800
commitc7e2e1d72ed7707239d20525e0ebcad7e3303659 (patch)
tree1ada00f778308f034bfc082b03f740955599f526 /net
parentae62ca7b03217be5e74759dc6d7698c95df498b3 (diff)
ipv4: fix NULL checking in devinet_ioctl()
The NULL pointer check `!ifa' should come before its first use. [ Bug origin : commit fd23c3b31107e2fc483301ee923d8a1db14e53f4 (ipv4: Add hash table of interface addresses) in linux-2.6.39 ] Signed-off-by: Xi Wang <xi.wang@gmail.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/devinet.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index cc06a47f121..a8e4f2665d5 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -823,9 +823,9 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg)
if (!ifa) {
ret = -ENOBUFS;
ifa = inet_alloc_ifa();
- INIT_HLIST_NODE(&ifa->hash);
if (!ifa)
break;
+ INIT_HLIST_NODE(&ifa->hash);
if (colon)
memcpy(ifa->ifa_label, ifr.ifr_name, IFNAMSIZ);
else