Skip to contentSkip to conversation

tun: correctly report an error in tun_flow_init()

PATCH Applied Paul Moore 3 participants 3 messages Dec 6, 2012 – Dec 7, 2012

Subsystems (3)
lore
Share & tools
lore

Paul Moore

author
#0 lore raw

PATCH 1/1 tun: correctly report an error in tun_flow_init()

On error, the error code from tun_flow_init() is lost inside tun_set_iff(), this patch fixes this by assigning the tun_flow_init() error code to the "err" variable which is returned by
the tun_flow_init() function on error.

---
 drivers/net/tun.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/tun.c +2 -1
index a1b2389..14a0454 100644
@@ -1591,7 +1591,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
 
 		tun_net_init(dev);
 
-		if (tun_flow_init(tun))
+		err = tun_flow_init(tun);
+		if (err < 0)
 			goto err_free_dev;
 
 		dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST |
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Paul Moore

On error, the error code from tun_flow_init() is lost inside tun_set_iff(), this patch fixes this by assigning the tun_flow_init() error code to the "err" variable which is returned by
the tun_flow_init() function on error.

Thanks Paul.

Quoted 24 lines
---
 drivers/net/tun.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/tun.c +2 -1
index a1b2389..14a0454 100644
@@ -1591,7 +1591,8 @@ static int tun_set_iff(struct net *net, struct file
 *file, struct ifreq *ifr)
 
 		tun_net_init(dev);
 
-		if (tun_flow_init(tun))
+		err = tun_flow_init(tun);
+		if (err < 0)
 			goto err_free_dev;
 

dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST |

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer Applied
#2 lore raw

From: Jason Wang <[email protected]>
Date: Fri, 07 Dec 2012 13:51:47 +0800

Quoted 9 lines · Paul Moore
Quoted 6 lines

On error, the error code from tun_flow_init() is lost inside tun_set_iff(), this patch fixes this by assigning the tun_flow_init() error code to the "err" variable which is returned by
the tun_flow_init() function on error.

Applied, thanks.