mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heming Zhao <heming.zhao@suse.com>
To: Joseph Qi <joseph.qi@linux.alibaba.com>,
	Lizhi Xu <lizhi.xu@windriver.com>
Cc: jlbec@evilplan.org, linux-kernel@vger.kernel.org,
	mark@fasheh.com, ocfs2-devel@lists.linux.dev,
	syzbot+ab134185af9ef88dfed5@syzkaller.appspotmail.com,
	syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH V3 2/2] ocfs2: Fix uaf in ocfs2_set_buffer_uptodate
Date: Wed, 21 Aug 2024 10:39:39 +0800	[thread overview]
Message-ID: <7d0d7bbc-6265-4f60-ba2c-a9c15771e95e@suse.com> (raw)
In-Reply-To: <416247e6-5da7-401c-815f-a4cf8ae37d51@linux.alibaba.com>

On 8/21/24 10:34, Joseph Qi wrote:
> And this is not a UAF case, but NULL pointer dereference.
> So I suggest change the subject to:
> ocfs2: fix possible NULL pointer dereference in ocfs2_set_buffer_uptodate

I agree with above too.
I didn't care about the patch subject in previous review jobs, 'UAF' is not suitable.

-Heming

> 
> On 8/21/24 8:08 AM, Joseph Qi wrote:
>>
>>
>> On 8/20/24 5:45 PM, Lizhi Xu wrote:
>>> In the for-loop after the 'read_failure' label, the condition
>>> '(bh == NULL) && flags includes OCFS2_BH_READAHEAD' is missing.
>>> When this contidion is true, this for-loop will call ocfs2_set_buffer
>>> _uptodate(ci, bh), which then triggers a NULL pointer access error.
>>>
>>
>> Or it may simplified as the following:
>>
>> When doing cleanup, if flags without OCFS2_BH_READAHEAD, it may trigger
>> NULL pointer dereference in the following ocfs2_set_buffer_uptodate() if
>> bh is NULL.
>>
>>> Changes from V2:
>>> * Make the code more concise
>>>
>>
>> This is not the right place for changelog.
>>
>> Thanks,
>> Joseph
>>
>>> Reported-and-suggested-by: Heming Zhao <heming.zhao@suse.com>
>>> Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
>>> Reviewed-by: Heming Zhao <heming.zhao@suse.com>
>>> ---
>>>   fs/ocfs2/buffer_head_io.c | 3 ++-
>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c
>>> index e62c7e1de4eb..8f714406528d 100644
>>> --- a/fs/ocfs2/buffer_head_io.c
>>> +++ b/fs/ocfs2/buffer_head_io.c
>>> @@ -388,7 +388,8 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
>>>   		/* Always set the buffer in the cache, even if it was
>>>   		 * a forced read, or read-ahead which hasn't yet
>>>   		 * completed. */
>>> -		ocfs2_set_buffer_uptodate(ci, bh);
>>> +		if (bh)
>>> +			ocfs2_set_buffer_uptodate(ci, bh);
>>>   	}
>>>   	ocfs2_metadata_cache_io_unlock(ci);
>>>   


  reply	other threads:[~2024-08-21  2:39 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-18 17:06 [syzbot] [ocfs2?] WARNING: bad unlock balance in ocfs2_read_blocks syzbot
2024-08-19  2:01 ` [syzbot] " syzbot
2024-08-19  2:51 ` [PATCH] ocfs2: remove unreasonable unlock Lizhi Xu
2024-08-20  4:04   ` heming.zhao
2024-08-20  5:59     ` Lizhi Xu
2024-08-20  6:55     ` [PATCH V2 1/2] " Lizhi Xu
2024-08-20  6:55       ` [PATCH V2 2/2] ocfs2: Fix uaf in ocfs2_read_blocks Lizhi Xu
2024-08-20  7:15         ` Heming Zhao
2024-08-20  7:37           ` [PATCH V3] ocfs2: Fix uaf in ocfs2_set_buffer_uptodate Lizhi Xu
2024-08-20  8:32             ` Heming Zhao
2024-08-20  9:45               ` [PATCH V3 1/2] ocfs2: remove unreasonable unlock Lizhi Xu
2024-08-20  9:45                 ` [PATCH V3 2/2] ocfs2: Fix uaf in ocfs2_set_buffer_uptodate Lizhi Xu
2024-08-20 11:32                   ` Heming Zhao
2024-08-20 13:44                     ` [PATCH] ocfs2: remove unreasonable unlock Lizhi Xu
2024-08-21  0:08                   ` [PATCH V3 2/2] ocfs2: Fix uaf in ocfs2_set_buffer_uptodate Joseph Qi
2024-08-21  2:34                     ` Joseph Qi
2024-08-21  2:39                       ` Heming Zhao [this message]
2024-08-21  5:55                         ` Lizhi Xu
2024-08-21  6:14                           ` [PATCH V4 2/2] ocfs2: Fix possible null-ptr-deref " Lizhi Xu
2024-08-21  6:23                             ` heming.zhao
2024-08-21  6:55                               ` Lizhi Xu
2024-08-21  7:37                                 ` heming.zhao
2024-08-21  7:58                                   ` Joseph Qi
2024-08-21  9:14                                     ` Lizhi Xu
2024-08-21 11:40                                       ` Heming Zhao
2024-08-21 21:39                                         ` Andrew Morton
2024-09-02  0:54                                           ` Andrew Morton
2024-09-02  1:03                                             ` Heming Zhao
2024-09-02  2:20                                               ` Joseph Qi
2024-09-02 14:23                                                 ` Lizhi Xu
2024-08-21  7:59                             ` Joseph Qi
2024-08-20 23:55                 ` [PATCH V3 1/2] ocfs2: remove unreasonable unlock Joseph Qi
2024-08-20  7:28       ` [PATCH V2 " Heming Zhao

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=7d0d7bbc-6265-4f60-ba2c-a9c15771e95e@suse.com \
    --to=heming.zhao@suse.com \
    --cc=jlbec@evilplan.org \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizhi.xu@windriver.com \
    --cc=mark@fasheh.com \
    --cc=ocfs2-devel@lists.linux.dev \
    --cc=syzbot+ab134185af9ef88dfed5@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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®