mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
To: Edward Adam Davis <eadavis@qq.com>,
	<syzbot+bcf9e1868c1a0c7e04f1@syzkaller.appspotmail.com>
Cc: <linux-kernel@vger.kernel.org>, <ntfs3@lists.linux.dev>,
	<syzkaller-bugs@googlegroups.com>
Subject: Re: [PATCH] fs/ntfs3: prevent infinite loops caused by the next valid being the same
Date: Fri, 16 Jan 2026 14:43:26 +0100	[thread overview]
Message-ID: <dabd5f3b-8fea-4db5-9899-c1f238efb70d@paragon-software.com> (raw)
In-Reply-To: <tencent_D46CCC9550EA26ED7ECE4079366D542E790A@qq.com>

On 12/28/25 04:53, Edward Adam Davis wrote:

> When processing valid within the range [valid : pos), if valid cannot
> be retrieved correctly, for example, if the retrieved valid value is
> always the same, this can trigger a potential infinite loop, similar
> to the hung problem reported by syzbot [1].
>
> Adding a check for the valid value within the loop body, and terminating
> the loop and returning -EINVAL if the value is the same as the current
> value, can prevent this.
>
> [1]
> INFO: task syz.4.21:6056 blocked for more than 143 seconds.
> Call Trace:
>   rwbase_write_lock+0x14f/0x750 kernel/locking/rwbase_rt.c:244
>   inode_lock include/linux/fs.h:1027 [inline]
>   ntfs_file_write_iter+0xe6/0x870 fs/ntfs3/file.c:1284
>
> Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation")
> Reported-by: syzbot+bcf9e1868c1a0c7e04f1@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=bcf9e1868c1a0c7e04f1
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> ---
>   fs/ntfs3/file.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
> index 2e7b2e566ebe..04292674f889 100644
> --- a/fs/ntfs3/file.c
> +++ b/fs/ntfs3/file.c
> @@ -1077,8 +1077,12 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
>   			goto out;
>   
>   		if (lcn == SPARSE_LCN) {
> -			ni->i_valid = valid =
> -				frame_vbo + ((u64)clen << sbi->cluster_bits);
> +			valid = frame_vbo + ((u64)clen << sbi->cluster_bits);
> +			if (ni->i_valid == valid) {
> +				err = -EINVAL;
> +				goto out;
> +			}
> +			ni->i_valid = valid;
>   			continue;
>   		}
>   

Applied to my tree, thanks for the patch.

Regards,
Konstantin


      reply	other threads:[~2026-01-16 13:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-27  3:34 [syzbot] [ntfs3?] INFO: task hung in ntfs_file_write_iter (2) syzbot
2025-12-28  3:53 ` [PATCH] fs/ntfs3: prevent infinite loops caused by the next valid being the same Edward Adam Davis
2026-01-16 13:43   ` Konstantin Komarov [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=dabd5f3b-8fea-4db5-9899-c1f238efb70d@paragon-software.com \
    --to=almaz.alexandrovich@paragon-software.com \
    --cc=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs3@lists.linux.dev \
    --cc=syzbot+bcf9e1868c1a0c7e04f1@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®