[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240405230129.7543-1-kuniyu@amazon.com>
Date: Fri, 5 Apr 2024 16:01:29 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <rao.shoaib@...cle.com>
CC: <kuniyu@...zon.com>, <davem@...emloft.net>, <edumazet@...gle.com>,
<kuba@...nel.org>, <kuni1840@...il.com>, <netdev@...r.kernel.org>,
<pabeni@...hat.com>, <syzbot+7f7f201cc2668a8fd169@...kaller.appspotmail.com>
Subject: Re: [PATCH v2 net] af_unix: Clear stale u->oob_skb.
From: Rao Shoaib <rao.shoaib@...cle.com>
Date: Fri, 5 Apr 2024 15:43:26 -0700
[...]
> > diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> > index 5b41e2321209..d032eb5fa6df 100644
> > --- a/net/unix/af_unix.c
> > +++ b/net/unix/af_unix.c
> > @@ -2665,7 +2665,9 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk,
> > }
> > } else if (!(flags & MSG_PEEK)) {
> > skb_unlink(skb, &sk->sk_receive_queue);
> > - consume_skb(skb);
> > + WRITE_ONCE(u->oob_skb, NULL);
> > + if (!WARN_ON_ONCE(skb_unref(skb)))
> > + kfree_skb(skb);
> > skb = skb_peek(&sk->sk_receive_queue);
> > }
> > }
>
> Isn't consume_skb doing the same thing() ? .
Only if you disable CONFIG_TRACEPOINTS, otherwise each function
uses different tracepoints, trace_consume_skb() vs trace_kfree_skb().
Here, we clearly drop the skb that's not received by user, so
kfree_skb() should be used.
> The only action needed is to clear out u->oob_skb -- No?
Also, queue_oob() now calls skb_get() and holds another refcnt,
so skb_unref() is needed.
BTW, do you know if MSG_OOB is actually used in production ?
I don't know any real user other than syzbot.
P.S.
Please send mail in plain text format as mailing list drops HTML.
Powered by blists - more mailing lists