Skip to contentSkip to conversation

tun: add a missing rcu_read_unlock() in error path

PATCH Applied Eric Dumazet 2 participants 2 messages Mar 16, 2019

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

PATCH 1/1 tun: add a missing rcu_read_unlock() in error path

In my latest patch I missed one rcu_read_unlock(), in case device is down.

Fixes 4477138fa0ae ("tun: properly test for IFF_UP")
---
 drivers/net/tun.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/tun.c +1 -0
index 0d343359f647ff58fee35462358827e61857c837..e9ca1c088d0b11611e4d80268ced3806db05cffb 100644
@@ -1960,6 +1960,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
 	rcu_read_lock();
 	if (unlikely(!(tun->dev->flags & IFF_UP))) {
 		err = -EIO;
+		rcu_read_unlock();
 		goto drop;
 	}
 
Signature · 1 line
2.21.0.225.g810b269d1ac-goog