提交 d26e597d 编写于 作者: J John Fastabend 提交者: David S. Miller

bpf: sockmap add missing rcu_read_(un)lock in smap_data_ready

References to psock must be done inside RCU critical section.

Fixes: 174a79ff ("bpf: sockmap with sk redirect support")
Signed-off-by: NJohn Fastabend <john.fastabend@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2f857d04
......@@ -227,11 +227,14 @@ static void smap_data_ready(struct sock *sk)
{
struct smap_psock *psock;
write_lock_bh(&sk->sk_callback_lock);
rcu_read_lock();
psock = smap_psock_sk(sk);
if (likely(psock))
if (likely(psock)) {
write_lock_bh(&sk->sk_callback_lock);
strp_data_ready(&psock->strp);
write_unlock_bh(&sk->sk_callback_lock);
write_unlock_bh(&sk->sk_callback_lock);
}
rcu_read_unlock();
}
static void smap_tx_work(struct work_struct *w)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册