All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Soumya Negi <soumya.negi97@gmail.com>
Cc: linux-ntfs-dev@lists.sourceforge.net,
	linux-kernel-mentees@lists.linuxfoundation.org,
	linux-kernel@vger.kernel.org,
	Anton Altaparmakov <anton@tuxera.com>
Subject: Re: [PATCH] ntfs: Ensure $Extend is a directory
Date: Sun, 24 Jul 2022 15:47:01 +0200	[thread overview]
Message-ID: <Yt1NVQEOC6Ki3eUI@kroah.com> (raw)
In-Reply-To: <20220724132107.1163-1-soumya.negi97@gmail.com>

On Sun, Jul 24, 2022 at 06:21:07AM -0700, Soumya Negi wrote:
> Fixes Syzbot bug: kernel BUG in ntfs_lookup_inode_by_name
> https://syzkaller.appspot.com/bug?id=32cf53b48c1846ffc25a185a2e92e170d1a95d71
> 
> Check whether $Extend is a directory or not( for NTFS3.0+) while loading
> system files. If it isn't(as in the case of this bug where the mft record for
> $Extend contains a regular file), load_system_files() returns false.

Please wrap your changelog text at 72 columns like your editor asked you
to when writing this :)

> 
> Reported-by: syzbot+30b7f850c6d98ea461d2@syzkaller.appspotmail.com
> Signed-off-by: Soumya Negi <soumya.negi97@gmail.com>

What commit caused this problem?  What Fixes: tag should go here?
Should it go to stable kernels?  If so, how far back?

> ---
>  fs/ntfs/super.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
> index 5ae8de09b271..18e2902531f9 100644
> --- a/fs/ntfs/super.c
> +++ b/fs/ntfs/super.c
> @@ -2092,10 +2092,15 @@ static bool load_system_files(ntfs_volume *vol)
>  	// TODO: Initialize security.
>  	/* Get the extended system files' directory inode. */
>  	vol->extend_ino = ntfs_iget(sb, FILE_Extend);
> -	if (IS_ERR(vol->extend_ino) || is_bad_inode(vol->extend_ino)) {
> +	if (IS_ERR(vol->extend_ino) || is_bad_inode(vol->extend_ino) ||
> +	    !S_ISDIR(vol->extend_ino->i_mode)) {
> +		static const char *es1 = "$Extend is not a directory";
> +		static const char *es2 = "Failed to load $Extend";
> +		const char *es = !S_ISDIR(vol->extend_ino->i_mode) ? es1 : es2;
> +
>  		if (!IS_ERR(vol->extend_ino))
>  			iput(vol->extend_ino);
> -		ntfs_error(sb, "Failed to load $Extend.");
> +		ntfs_error(sb, "%s.", es);

Are you allowing the system log to be spammed by an untrusted user with
this change?

thanks,

greg k-h
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <gregkh@linuxfoundation.org>
To: Soumya Negi <soumya.negi97@gmail.com>
Cc: Anton Altaparmakov <anton@tuxera.com>,
	Shuah Khan <skhan@linuxfoundation.org>,
	linux-ntfs-dev@lists.sourceforge.net,
	linux-kernel-mentees@lists.linuxfoundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ntfs: Ensure $Extend is a directory
Date: Sun, 24 Jul 2022 15:47:01 +0200	[thread overview]
Message-ID: <Yt1NVQEOC6Ki3eUI@kroah.com> (raw)
In-Reply-To: <20220724132107.1163-1-soumya.negi97@gmail.com>

On Sun, Jul 24, 2022 at 06:21:07AM -0700, Soumya Negi wrote:
> Fixes Syzbot bug: kernel BUG in ntfs_lookup_inode_by_name
> https://syzkaller.appspot.com/bug?id=32cf53b48c1846ffc25a185a2e92e170d1a95d71
> 
> Check whether $Extend is a directory or not( for NTFS3.0+) while loading
> system files. If it isn't(as in the case of this bug where the mft record for
> $Extend contains a regular file), load_system_files() returns false.

Please wrap your changelog text at 72 columns like your editor asked you
to when writing this :)

> 
> Reported-by: syzbot+30b7f850c6d98ea461d2@syzkaller.appspotmail.com
> Signed-off-by: Soumya Negi <soumya.negi97@gmail.com>

What commit caused this problem?  What Fixes: tag should go here?
Should it go to stable kernels?  If so, how far back?

> ---
>  fs/ntfs/super.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
> index 5ae8de09b271..18e2902531f9 100644
> --- a/fs/ntfs/super.c
> +++ b/fs/ntfs/super.c
> @@ -2092,10 +2092,15 @@ static bool load_system_files(ntfs_volume *vol)
>  	// TODO: Initialize security.
>  	/* Get the extended system files' directory inode. */
>  	vol->extend_ino = ntfs_iget(sb, FILE_Extend);
> -	if (IS_ERR(vol->extend_ino) || is_bad_inode(vol->extend_ino)) {
> +	if (IS_ERR(vol->extend_ino) || is_bad_inode(vol->extend_ino) ||
> +	    !S_ISDIR(vol->extend_ino->i_mode)) {
> +		static const char *es1 = "$Extend is not a directory";
> +		static const char *es2 = "Failed to load $Extend";
> +		const char *es = !S_ISDIR(vol->extend_ino->i_mode) ? es1 : es2;
> +
>  		if (!IS_ERR(vol->extend_ino))
>  			iput(vol->extend_ino);
> -		ntfs_error(sb, "Failed to load $Extend.");
> +		ntfs_error(sb, "%s.", es);

Are you allowing the system log to be spammed by an untrusted user with
this change?

thanks,

greg k-h

  reply	other threads:[~2022-07-24 13:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-24 13:21 [PATCH] ntfs: Ensure $Extend is a directory Soumya Negi
2022-07-24 13:21 ` Soumya Negi
2022-07-24 13:47 ` Greg KH [this message]
2022-07-24 13:47   ` Greg KH
2022-07-24 15:34   ` Soumya Negi
2022-07-24 15:34     ` Soumya Negi
2022-07-24 15:54     ` Greg KH
2022-07-24 15:54       ` Greg KH
2022-07-24 22:17       ` Soumya Negi
2022-07-24 22:17         ` Soumya Negi
2022-07-25 19:06         ` Soumya Negi
2022-07-25 19:06           ` Soumya Negi
2022-07-26 16:40           ` Greg KH
2022-07-26 16:40             ` Greg KH

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=Yt1NVQEOC6Ki3eUI@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=anton@tuxera.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-ntfs-dev@lists.sourceforge.net \
    --cc=soumya.negi97@gmail.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.