From: Ryan Cai <ycaibb@gmail.com>
To: Shoaib Rao <rao.shoaib@oracle.com>, <davem@davemloft.net>,
<kuba@kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>,
<andrii@kernel.org>, <kafai@fb.com>, <songliubraving@fb.com>,
<yhs@fb.com>, <john.fastabend@gmail.com>, <kpsingh@kernel.org>,
<cong.wang@bytedance.com>, <viro@zeniv.linux.org.uk>,
<edumazet@google.com>, <jiang.wang@bytedance.com>,
<christian.brauner@ubuntu.com>, <kuniyu@amazon.co.jp>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<bpf@vger.kernel.org>
Subject: Re: [PATCH] af_unix: missing lock releases in af_unix.c
Date: Wed, 05 Jan 2022 17:19:00 +0800 [thread overview]
Message-ID: <9BADB912-9338-4798-94C4-AA6268C4CA06@gmail.com> (raw)
In-Reply-To: <555a3e2b-3981-672d-c6cf-5ecb357d2fa6@oracle.com>
Hi, Shoaib
After further checking, the lock is indeed released at the out_free. My patch is invalid. Sorry for the inconvenience.
Best,
Ryan
On 4/1/2022, 2:47 AM, "Shoaib Rao" <rao.shoaib@oracle.com> wrote:
On 1/3/22 05:58, Ryan Cai wrote:
> In method __unix_dgram_recvmsg, the lock u->iolock is not released when skb is true and loop breaks.
>
> Signed-off-by: Ryan Cai <ycaibb@gmail.com>
> ---
> net/unix/af_unix.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> index b0bfc78e421c..b97972948d9d 100644
> --- a/net/unix/af_unix.c
> +++ b/net/unix/af_unix.c
> @@ -2305,6 +2305,7 @@ int __unix_dgram_recvmsg(struct sock *sk, struct msghdr *msg, size_t size,
> if (skb) {
> if (!(flags & MSG_PEEK))
> scm_stat_del(sk, skb);
> + mutex_unlock(&u->iolock);
> break;
> }
>
It seems to me that the unlock at the end will release the mutex?
out_free:
skb_free_datagram(sk, skb);
mutex_unlock(&u->iolock);
Shoaib
prev parent reply other threads:[~2022-01-05 9:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220103135830.59118-1-ycaibb@gmail.com>
2022-01-03 18:43 ` Shoaib Rao
2022-01-05 9:19 ` Ryan Cai [this message]
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=9BADB912-9338-4798-94C4-AA6268C4CA06@gmail.com \
--to=ycaibb@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=christian.brauner@ubuntu.com \
--cc=cong.wang@bytedance.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jiang.wang@bytedance.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rao.shoaib@oracle.com \
--cc=songliubraving@fb.com \
--cc=viro@zeniv.linux.org.uk \
--cc=yhs@fb.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®