[PATCH net] tun: add a missing rcu_read_unlock() in error path

Subsystems: networking drivers, the rest, tun/tap driver

STALE2703d

2 messages, 2 authors, 2019-03-16 · open the first message on its own page

[PATCH net] tun: add a missing rcu_read_unlock() in error path

From: Eric Dumazet <edumazet@google.com>
Date: 2019-03-16 20:09:59

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

Fixes: 4477138fa0ae ("tun: properly test for IFF_UP")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <redacted>
---
 drivers/net/tun.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 0d343359f647ff58fee35462358827e61857c837..e9ca1c088d0b11611e4d80268ced3806db05cffb 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -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;
 	}
 
-- 
2.21.0.225.g810b269d1ac-goog

Re: [PATCH net] tun: add a missing rcu_read_unlock() in error path

From: David Miller <davem@davemloft.net>
Date: 2019-03-16 20:17:32

From: Eric Dumazet <edumazet@google.com>
Date: Sat, 16 Mar 2019 13:09:53 -0700
In my latest patch I missed one rcu_read_unlock(), in case
device is down.

Fixes: 4477138fa0ae ("tun: properly test for IFF_UP")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <redacted>
Applied, thanks Eric.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help