[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <10b42aa8-4eda-c761-be12-9fe54e9f15d8@paragon-software.com>
Date: Fri, 30 Dec 2022 11:22:07 +0400
From: Konstantin Komarov <almaz.alexandrovich@...agon-software.com>
To: Abdun Nihaal <abdun.nihaal@...il.com>
CC: <ntfs3@...ts.linux.dev>, <linux-kernel@...r.kernel.org>,
<skhan@...uxfoundation.org>,
<linux-kernel-mentees@...ts.linuxfoundation.org>,
<syzbot+f45957555ed4a808cc7a@...kaller.appspotmail.com>
Subject: Re: [PATCH] fs/ntfs3: Fix NULL dereference in ni_write_inode
On 30.10.2022 11:02, Abdun Nihaal wrote:
> Syzbot reports a NULL dereference in ni_write_inode.
> When creating a new inode, if allocation fails in mi_init function
> (called in mi_format_new function), mi->mrec is set to NULL.
> In the error path of this inode creation, mi->mrec is later
> dereferenced in ni_write_inode.
>
> Add a NULL check to prevent NULL dereference.
>
> Link: https://syzkaller.appspot.com/bug?extid=f45957555ed4a808cc7a
> Reported-and-tested-by: syzbot+f45957555ed4a808cc7a@...kaller.appspotmail.com
> Signed-off-by: Abdun Nihaal <abdun.nihaal@...il.com>
> ---
> fs/ntfs3/frecord.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
> index 70a80f9412f7..e55bbd209ef8 100644
> --- a/fs/ntfs3/frecord.c
> +++ b/fs/ntfs3/frecord.c
> @@ -3243,6 +3243,9 @@ int ni_write_inode(struct inode *inode, int sync, const char *hint)
> return 0;
> }
>
> + if (!ni->mi.mrec)
> + goto out;
> +
> if (is_rec_inuse(ni->mi.mrec) &&
> !(sbi->flags & NTFS_FLAGS_LOG_REPLAYING) && inode->i_nlink) {
> bool modified = false;
Thank you for your work, applied!
Powered by blists - more mailing lists