summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXi Wang <xi.wang@gmail.com>2013-01-05 12:19:24 +0100
committerDavid S. Miller <davem@davemloft.net>2013-01-07 06:11:18 +0100
commitc7e2e1d72ed7707239d20525e0ebcad7e3303659 (patch)
tree1ada00f778308f034bfc082b03f740955599f526
parenttcp: fix MSG_SENDPAGE_NOTLAST logic (diff)
downloadlinux-c7e2e1d72ed7707239d20525e0ebcad7e3303659.tar.xz
linux-c7e2e1d72ed7707239d20525e0ebcad7e3303659.zip
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>
-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 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)
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