diff mbox series

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

Message ID 20190316200953.28881-1-edumazet@google.com
State Accepted
Delegated to: David Miller
Headers show
Series [net] tun: add a missing rcu_read_unlock() in error path | expand

Commit Message

Eric Dumazet March 16, 2019, 8:09 p.m. UTC
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 <syzkaller@googlegroups.com>
---
 drivers/net/tun.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Miller March 16, 2019, 8:17 p.m. UTC | #1
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 <syzkaller@googlegroups.com>

Applied, thanks Eric.
diff mbox series

Patch

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;
 	}