From: Xiubo Li <xiubli@redhat.com>
To: Aaron Tomlin <atomlin@redhat.com>
Cc: jlayton@kernel.org, idryomov@gmail.com, vshankar@redhat.com,
ceph-devel@vger.kernel.org
Subject: Re: [PATCH v2] ceph: fix possible NULL pointer dereference for req->r_session
Date: Mon, 18 Apr 2022 18:52:46 +0800 [thread overview]
Message-ID: <53d24ea4-554b-2df3-e4ee-6761f6ae5c8e@redhat.com> (raw)
In-Reply-To: <20220418104318.4fb3jpdgnhje4b5d@ava.usersys.com>
On 4/18/22 6:43 PM, Aaron Tomlin wrote:
> On Mon 2022-04-18 09:44 +0800, Xiubo Li wrote:
>> The request will be inserted into the ci->i_unsafe_dirops before
>> assigning the req->r_session, so it's possible that we will hit
>> NULL pointer dereference bug here.
>>
>> URL: https://tracker.ceph.com/issues/55327
>> Signed-off-by: Xiubo Li <xiubli@redhat.com>
>> ---
>> fs/ceph/caps.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
>> index 69af17df59be..c70fd747c914 100644
>> --- a/fs/ceph/caps.c
>> +++ b/fs/ceph/caps.c
>> @@ -2333,6 +2333,8 @@ static int unsafe_request_wait(struct inode *inode)
>> list_for_each_entry(req, &ci->i_unsafe_dirops,
>> r_unsafe_dir_item) {
>> s = req->r_session;
>> + if (!s)
>> + continue;
>> if (unlikely(s->s_mds >= max_sessions)) {
>> spin_unlock(&ci->i_unsafe_lock);
>> for (i = 0; i < max_sessions; i++) {
>> @@ -2353,6 +2355,8 @@ static int unsafe_request_wait(struct inode *inode)
>> list_for_each_entry(req, &ci->i_unsafe_iops,
>> r_unsafe_target_item) {
>> s = req->r_session;
>> + if (!s)
>> + continue;
>> if (unlikely(s->s_mds >= max_sessions)) {
>> spin_unlock(&ci->i_unsafe_lock);
>> for (i = 0; i < max_sessions; i++) {
>> --
>> 2.36.0.rc1
> Tested-by: Aaron Tomlin <atomlin@redhat.com>
>
Hi Aaron,
Thanks very much for you testing.
BTW, did you test this by using Livepatch or something else ?
-- Xiubo
next prev parent reply other threads:[~2022-04-18 10:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-18 1:44 [PATCH v2] ceph: fix possible NULL pointer dereference for req->r_session Xiubo Li
2022-04-18 9:54 ` Jeff Layton
2022-04-18 10:41 ` Aaron Tomlin
2022-04-18 10:43 ` Aaron Tomlin
2022-04-18 10:52 ` Xiubo Li [this message]
2022-04-18 14:45 ` Aaron Tomlin
2022-04-19 1:01 ` Xiubo Li
2022-04-25 9:03 ` Ilya Dryomov
2022-04-25 9:23 ` Xiubo Li
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=53d24ea4-554b-2df3-e4ee-6761f6ae5c8e@redhat.com \
--to=xiubli@redhat.com \
--cc=atomlin@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=jlayton@kernel.org \
--cc=vshankar@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.