Commit 1e061ab2 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller
Browse files

[SCTP]: Replace spin_lock_irqsave with spin_lock_bh

This patch replaces the spin_lock_irqsave call on the receive queue
lock in SCTP with spin_lock_bh.  Despite the proliferation of
spin_lock_irqsave calls in this stack, it is only entered from the
IPv4/IPv6 stack and user space.  That is, it is never entered from
hardirq context.

The call in question is only called from recvmsg which means that
IRQs aren't disabled.  Therefore it is safe to replace it with
Signed-off-by: default avatarHerbert Xu <>
Signed-off-by: default avatarDavid S. Miller <>
parent e0f9f858
...@@ -4368,15 +4368,11 @@ static struct sk_buff *sctp_skb_recv_datagram(struct sock *sk, int flags, ...@@ -4368,15 +4368,11 @@ static struct sk_buff *sctp_skb_recv_datagram(struct sock *sk, int flags,
* However, this function was corrent in any case. 8) * However, this function was corrent in any case. 8)
*/ */
if (flags & MSG_PEEK) { if (flags & MSG_PEEK) {
unsigned long cpu_flags; spin_lock_bh(&sk->sk_receive_queue.lock);
skb = skb_peek(&sk->sk_receive_queue); skb = skb_peek(&sk->sk_receive_queue);
if (skb) if (skb)
atomic_inc(&skb->users); atomic_inc(&skb->users);
sctp_spin_unlock_irqrestore(&sk->sk_receive_queue.lock, spin_unlock_bh(&sk->sk_receive_queue.lock);
} else { } else {
skb = skb_dequeue(&sk->sk_receive_queue); skb = skb_dequeue(&sk->sk_receive_queue);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment