diff options
author | Xi Wang <xi.wang@gmail.com> | 2013-01-05 06:19:24 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-07 00:11:18 -0500 |
commit | c7e2e1d72ed7707239d20525e0ebcad7e3303659 (patch) | |
tree | 1ada00f778308f034bfc082b03f740955599f526 /net | |
parent | ae62ca7b03217be5e74759dc6d7698c95df498b3 (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.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index cc06a47f1216..a8e4f2665d5e 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) | |||
823 | if (!ifa) { | 823 | if (!ifa) { |
824 | ret = -ENOBUFS; | 824 | ret = -ENOBUFS; |
825 | ifa = inet_alloc_ifa(); | 825 | ifa = inet_alloc_ifa(); |
826 | INIT_HLIST_NODE(&ifa->hash); | ||
827 | if (!ifa) | 826 | if (!ifa) |
828 | break; | 827 | break; |
828 | INIT_HLIST_NODE(&ifa->hash); | ||
829 | if (colon) | 829 | if (colon) |
830 | memcpy(ifa->ifa_label, ifr.ifr_name, IFNAMSIZ); | 830 | memcpy(ifa->ifa_label, ifr.ifr_name, IFNAMSIZ); |
831 | else | 831 | else |