All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Luczaj <mhal@rbox.co>
To: Kuniyuki Iwashima <kuniyu@amazon.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Kuniyuki Iwashima <kuni1840@gmail.com>,
	netdev@vger.kernel.org,
	Billy Jheng Bing-Jhong <billy@starlabs.sg>
Subject: Re: [PATCH v2 net] af_unix: Update unix_sk(sk)->oob_skb under sk_receive_queue lock.
Date: Sun, 12 May 2024 16:47:11 +0200	[thread overview]
Message-ID: <5670c1c4-985d-4e87-9732-ad1cc59bc8db@rbox.co> (raw)
In-Reply-To: <20240510093905.25510-1-kuniyu@amazon.com>

On 5/10/24 11:39, Kuniyuki Iwashima wrote:
> @@ -2655,6 +2661,8 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk,
>  		consume_skb(skb);
>  		skb = NULL;
>  	} else {
> +		spin_lock(&sk->sk_receive_queue.lock);
> +
>  		if (skb == u->oob_skb) {
>  			if (copied) {
>  				skb = NULL;
> @@ -2666,13 +2674,15 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk,
>  			} else if (flags & MSG_PEEK) {
>  				skb = NULL;
>  			} else {
> -				skb_unlink(skb, &sk->sk_receive_queue);
> +				__skb_unlink(skb, &sk->sk_receive_queue);
>  				WRITE_ONCE(u->oob_skb, NULL);
>  				if (!WARN_ON_ONCE(skb_unref(skb)))
>  					kfree_skb(skb);
>  				skb = skb_peek(&sk->sk_receive_queue);
>  			}
>  		}
> +
> +		spin_unlock(&sk->sk_receive_queue.lock);
>  	}
>  	return skb;
>  }

Now it is
  
  spin_lock(&sk->sk_receive_queue.lock)
  kfree_skb
    unix_destruct_scm
      unix_notinflight
        spin_lock(&unix_gc_lock)

I.e. sk_receive_queue.lock -> unix_gc_lock, inversion of what unix_gc() does.
But that's benign, right?

thanks,
Michal

  parent reply	other threads:[~2024-05-12 14:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10  9:39 [PATCH v2 net] af_unix: Update unix_sk(sk)->oob_skb under sk_receive_queue lock Kuniyuki Iwashima
2024-05-10 10:44 ` Paolo Abeni
2024-05-10 10:54   ` Kuniyuki Iwashima
2024-05-10 11:11     ` Paolo Abeni
2024-05-12 14:47 ` Michal Luczaj [this message]
2024-05-13  6:12   ` Kuniyuki Iwashima
2024-05-13  6:40     ` Michal Luczaj
2024-05-13  7:44       ` Kuniyuki Iwashima
2024-05-13  9:14         ` Michal Luczaj
2024-05-13  9:24           ` Kuniyuki Iwashima
2024-05-13 10:15             ` Michal Luczaj
2024-05-13 12:44               ` Kuniyuki Iwashima

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5670c1c4-985d-4e87-9732-ad1cc59bc8db@rbox.co \
    --to=mhal@rbox.co \
    --cc=billy@starlabs.sg \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=kuni1840@gmail.com \
    --cc=kuniyu@amazon.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.