From: Konstantin Komarov via Linux-kernel-mentees <linux-kernel-mentees@lists.linuxfoundation.org>
To: Abdun Nihaal <abdun.nihaal@gmail.com>
Cc: ntfs3@lists.linux.dev,
linux-kernel-mentees@lists.linuxfoundation.org,
linux-kernel@vger.kernel.org,
syzbot+b892240eac461e488d51@syzkaller.appspotmail.com
Subject: Re: [PATCH] fs/ntfs3: Fix slab-out-of-bounds read in ntfs_trim_fs
Date: Sat, 12 Nov 2022 21:06:53 +0300 [thread overview]
Message-ID: <3399a999-4503-d4f9-d7dd-82a2c18a1a40@paragon-software.com> (raw)
In-Reply-To: <20221001070024.1366018-1-abdun.nihaal@gmail.com>
On 10/1/22 10:00, Abdun Nihaal wrote:
> Syzbot reports an out of bound access in ntfs_trim_fs.
> The cause of this is using a loop termination condition that compares
> window index (iw) with wnd->nbits instead of wnd->nwnd, due to which the
> index used for wnd->free_bits exceeds the size of the array allocated.
>
> Fix the loop condition.
>
> Fixes: 3f3b442b5ad2 ("fs/ntfs3: Add bitmap")
> Link: https://syzkaller.appspot.com/bug?extid=b892240eac461e488d51
> Reported-by: syzbot+b892240eac461e488d51@syzkaller.appspotmail.com
> Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
> ---
> fs/ntfs3/bitmap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c
> index 1675c9a69788..629c1ee97268 100644
> --- a/fs/ntfs3/bitmap.c
> +++ b/fs/ntfs3/bitmap.c
> @@ -1424,7 +1424,7 @@ int ntfs_trim_fs(struct ntfs_sb_info *sbi, struct fstrim_range *range)
>
> down_read_nested(&wnd->rw_lock, BITMAP_MUTEX_CLUSTERS);
>
> - for (; iw < wnd->nbits; iw++, wbit = 0) {
> + for (; iw < wnd->nwnd; iw++, wbit = 0) {
> CLST lcn_wnd = iw * wbits;
> struct buffer_head *bh;
>
Thanks for patch, applied!
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
prev parent reply other threads:[~2022-11-12 18:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-01 7:00 [PATCH] fs/ntfs3: Fix slab-out-of-bounds read in ntfs_trim_fs Abdun Nihaal
2022-11-12 18:06 ` Konstantin Komarov via Linux-kernel-mentees [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=3399a999-4503-d4f9-d7dd-82a2c18a1a40@paragon-software.com \
--to=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=abdun.nihaal@gmail.com \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ntfs3@lists.linux.dev \
--cc=syzbot+b892240eac461e488d51@syzkaller.appspotmail.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;
as well as URLs for NNTP newsgroup(s).