Skip to content

Commit

Permalink
ipv4: fix NULL checking in devinet_ioctl()
Browse files Browse the repository at this point in the history
The NULL pointer check `!ifa' should come before its first use.

[ Bug origin : commit fd23c3b
  (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>
  • Loading branch information
Xi Wang authored and David S. Miller committed Jan 7, 2013
1 parent ae62ca7 commit c7e2e1d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ipv4/devinet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c7e2e1d

Please sign in to comment.