Skip to contentSkip to conversation

missing dev_put() on error path in vif_add()

PATCH Applied Dan Carpenter 3 participants 3 messages Nov 11, 2009 – Nov 14, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 missing dev_put() on error path in vif_add()

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

net/ipv4/ipmr.c +3 -1
@@ -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);
 
Acked-by on v1 1/1
#1 lore raw

Dan Carpenter said the following on 2009-11-11 20:03:

Quoted 14 lines

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

net/ipv4/ipmr.c +0 -0
@@ -483,8 +483,10 @@
 		return -EINVAL;

net/ipv4/ipmr.c line 492

Quoted 10 lines
net/ipv4/ipmr.c +3 -1
 	}
 
-	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.

maintainer Applied
#2 lore raw

From: Wang Chen <[email protected]>
Date: Thu, 12 Nov 2009 10:50:02 +0800

Quoted 5 lines

Dan Carpenter said the following on 2009-11-11 20:03:

Quoted 4 lines

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

Found by smatch static checker.

...

Quoted 1 line
Quoted 1 line

...

Quoted 3 lines

It's my fault. Introduced in 7dc00c82cbb0119cf4663f65bbaa2cc55f961db2.

Applied, thanks.