]> git.baikalelectronics.ru Git - kernel.git/commit
tun: fix rcu_read_lock imbalance in tun_build_skb
authorXin Long <lucien.xin@gmail.com>
Sun, 19 Nov 2017 11:31:04 +0000 (19:31 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 19 Nov 2017 12:22:31 +0000 (21:22 +0900)
commit66dff206babdf1ac14c09adeed775222f3076c54
treeca78d6425d2624b845c0b57b34e1f740a5fda841
parent917930f3cdb02a2f501a627536f7839325550f6b
tun: fix rcu_read_lock imbalance in tun_build_skb

rcu_read_lock in tun_build_skb is used to rcu_dereference tun->xdp_prog
safely, rcu_read_unlock should be done in every return path.

Now I could see one place missing it, where it returns NULL in switch-case
XDP_REDIRECT,  another palce using rcu_read_lock wrongly, where it returns
NULL in if (xdp_xmit) chunk.

So fix both in this patch.

Fixes: aa34d85a2e5f ("tap: XDP support")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c