提交 783e3988 编写于 作者: J Jason Wang 提交者: Michael S. Tsirkin

vhost: lock receive queue, not the socket

vhost takes a sock lock to try and prevent
the skb from being pulled from the receive queue
after skb_peek.  However this is not the right lock to use for that,
sk_receive_queue.lock is. Fix that up.
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
上级 94249369
......@@ -213,12 +213,13 @@ static int peek_head_len(struct sock *sk)
{
struct sk_buff *head;
int len = 0;
unsigned long flags;
lock_sock(sk);
spin_lock_irqsave(&sk->sk_receive_queue.lock, flags);
head = skb_peek(&sk->sk_receive_queue);
if (head)
if (likely(head))
len = head->len;
release_sock(sk);
spin_unlock_irqrestore(&sk->sk_receive_queue.lock, flags);
return len;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册