netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv4: fix NULL checking in devinet_ioctl()
@ 2013-01-05 21:19 Xi Wang
  2013-01-05 23:10 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Xi Wang @ 2013-01-05 21:19 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Xi Wang

The NULL pointer check `!ifa' should come before its first use.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
---
 net/ipv4/devinet.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index cc06a47..a8e4f26 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
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ipv4: fix NULL checking in devinet_ioctl()
  2013-01-05 21:19 [PATCH] ipv4: fix NULL checking in devinet_ioctl() Xi Wang
@ 2013-01-05 23:10 ` Eric Dumazet
  2013-01-07  5:11   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2013-01-05 23:10 UTC (permalink / raw)
  To: Xi Wang; +Cc: David S. Miller, netdev

On Sat, 2013-01-05 at 16:19 -0500, Xi Wang wrote:
> The NULL pointer check `!ifa' should come before its first use.
> 
> Signed-off-by: Xi Wang <xi.wang@gmail.com>
> ---
>  net/ipv4/devinet.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index cc06a47..a8e4f26 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

Acked-by: Eric Dumazet <edumazet@google.com>

Bug origin : commit fd23c3b31107e2fc483301ee923d8a1db14e53f4
(ipv4: Add hash table of interface addresses) 

in linux-2.6.39

Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ipv4: fix NULL checking in devinet_ioctl()
  2013-01-05 23:10 ` Eric Dumazet
@ 2013-01-07  5:11   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2013-01-07  5:11 UTC (permalink / raw)
  To: eric.dumazet; +Cc: xi.wang, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 05 Jan 2013 15:10:02 -0800

> On Sat, 2013-01-05 at 16:19 -0500, Xi Wang wrote:
>> The NULL pointer check `!ifa' should come before its first use.
>> 
>> Signed-off-by: Xi Wang <xi.wang@gmail.com>
>> ---
>>  net/ipv4/devinet.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
>> index cc06a47..a8e4f26 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
> 
> Acked-by: Eric Dumazet <edumazet@google.com>
> 
> Bug origin : commit fd23c3b31107e2fc483301ee923d8a1db14e53f4
> (ipv4: Add hash table of interface addresses) 
> 
> in linux-2.6.39

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-01-07  5:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-05 21:19 [PATCH] ipv4: fix NULL checking in devinet_ioctl() Xi Wang
2013-01-05 23:10 ` Eric Dumazet
2013-01-07  5:11   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).