Skip to content

Commit

Permalink
bpf, sockmap: Zap ingress queues after stopping strparser
Browse files Browse the repository at this point in the history
We don't want strparser to run and pass skbs into skmsg handlers when
the psock is null. We just sk_drop them in this case. When removing
a live socket from map it means extra drops that we do not need to
incur. Move the zap below strparser close to avoid this condition.

This way we stop the stream parser first stopping it from processing
packets and then delete the psock.

Fixes: a136678 ("bpf: sk_msg, zap ingress queue on psock down")
Signed-off-by: John Fastabend <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Acked-by: Jakub Sitnicki <[email protected]>
Acked-by: Martin KaFai Lau <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
  • Loading branch information
jrfastab authored and anakryiko committed Jul 27, 2021
1 parent d6371c7 commit 343597d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/core/skmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,6 @@ static void sk_psock_destroy(struct work_struct *work)

void sk_psock_drop(struct sock *sk, struct sk_psock *psock)
{
sk_psock_stop(psock, false);

write_lock_bh(&sk->sk_callback_lock);
sk_psock_restore_proto(sk, psock);
rcu_assign_sk_user_data(sk, NULL);
Expand All @@ -784,6 +782,8 @@ void sk_psock_drop(struct sock *sk, struct sk_psock *psock)
sk_psock_stop_verdict(sk, psock);
write_unlock_bh(&sk->sk_callback_lock);

sk_psock_stop(psock, false);

INIT_RCU_WORK(&psock->rwork, sk_psock_destroy);
queue_rcu_work(system_wq, &psock->rwork);
}
Expand Down

0 comments on commit 343597d

Please sign in to comment.