netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] missing dev_put() on error path in vif_add()
@ 2009-11-11 12:03 Dan Carpenter
  2009-11-12  2:50 ` Wang Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2009-11-11 12:03 UTC (permalink / raw)
  To: netdev; +Cc: davem

The other error paths in front of this one have a dev_put() but this one 
got missed.

Found by smatch static checker.

regards,
dan carpenter

Signed-off-by: Dan Carpenter <error27@gmail.com>

--- orig/net/ipv4/ipmr.c	2009-11-11 13:34:20.000000000 +0200
+++ devel/net/ipv4/ipmr.c	2009-11-11 13:34:59.000000000 +0200
@@ -483,8 +483,10 @@
 		return -EINVAL;
 	}
 
-	if ((in_dev = __in_dev_get_rtnl(dev)) == NULL)
+	if ((in_dev = __in_dev_get_rtnl(dev)) == NULL) {
+		dev_put(dev);
 		return -EADDRNOTAVAIL;
+	}
 	IPV4_DEVCONF(in_dev->cnf, MC_FORWARDING)++;
 	ip_rt_multicast_event(in_dev);
 

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

* Re: [patch] missing dev_put() on error path in vif_add()
  2009-11-11 12:03 [patch] missing dev_put() on error path in vif_add() Dan Carpenter
@ 2009-11-12  2:50 ` Wang Chen
  2009-11-14  3:57   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Wang Chen @ 2009-11-12  2:50 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: netdev, davem

Dan Carpenter said the following on 2009-11-11 20:03:
> The other error paths in front of this one have a dev_put() but this one 
> got missed.
> 
> Found by smatch static checker.
> 
> regards,
> dan carpenter
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> --- orig/net/ipv4/ipmr.c	2009-11-11 13:34:20.000000000 +0200
> +++ devel/net/ipv4/ipmr.c	2009-11-11 13:34:59.000000000 +0200
> @@ -483,8 +483,10 @@
>  		return -EINVAL;
>  	}
>  
> -	if ((in_dev = __in_dev_get_rtnl(dev)) == NULL)
> +	if ((in_dev = __in_dev_get_rtnl(dev)) == NULL) {
> +		dev_put(dev);
>  		return -EADDRNOTAVAIL;
> +	}
>  	IPV4_DEVCONF(in_dev->cnf, MC_FORWARDING)++;
>  	ip_rt_multicast_event(in_dev);
>  

It's my fault. Introduced in 7dc00c82cbb0119cf4663f65bbaa2cc55f961db2.

Acked-by: Wang Chen <ellre923@gmail.com>

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

* Re: [patch] missing dev_put() on error path in vif_add()
  2009-11-12  2:50 ` Wang Chen
@ 2009-11-14  3:57   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2009-11-14  3:57 UTC (permalink / raw)
  To: ellre923; +Cc: error27, netdev

From: Wang Chen <ellre923@gmail.com>
Date: Thu, 12 Nov 2009 10:50:02 +0800

> Dan Carpenter said the following on 2009-11-11 20:03:
>> The other error paths in front of this one have a dev_put() but this one 
>> got missed.
>> 
>> Found by smatch static checker.
 ...
>> Signed-off-by: Dan Carpenter <error27@gmail.com>
 ...
> It's my fault. Introduced in 7dc00c82cbb0119cf4663f65bbaa2cc55f961db2.
> 
> Acked-by: Wang Chen <ellre923@gmail.com>

Applied, thanks.

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

end of thread, other threads:[~2009-11-14  3:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-11 12:03 [patch] missing dev_put() on error path in vif_add() Dan Carpenter
2009-11-12  2:50 ` Wang Chen
2009-11-14  3:57   ` 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).