diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c index b464c711e9c0..0244055cf480 100644 --- a/net/kcm/kcmsock.c +++ b/net/kcm/kcmsock.c @@ -1850,10 +1850,10 @@ static int kcm_release(struct socket *sock) kcm = kcm_sk(sk); mux = kcm->mux; + lock_sock(sk); sock_orphan(sk); kfree_skb(kcm->seq_skb); - lock_sock(sk); /* Purge queue under lock to avoid race condition with tx_work trying * to act when queue is nonempty. If tx_work runs after this point * it will just return.