[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3e3e6234-5c29-b3ca-c499-6fdbf611f62c@oracle.com>
Date: Fri, 23 Jun 2023 08:51:39 -0500
From: Dave Kleikamp <dave.kleikamp@...cle.com>
To: mirimmad@...look.com
Cc: Immad Mir <mirimmad17@...il.com>,
syzbot+f1faa20eec55e0c8644c@...kaller.appspotmail.com,
Dave Kleikamp <shaggy@...nel.org>,
jfs-discussion@...ts.sourceforge.net, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] FS: JFS: Fix null-ptr-deref Read in txBegin
On 6/23/23 8:44AM, mirimmad@...look.com wrote:
> From: Immad Mir <mirimmad17@...il.com>
>
> Syzkaller reported an issue where txBegin may be called
> on a superblock in a read-only mounted filesystem which leads
> to NULL pointer deref. This could be solved by checking if
> the filesystem is read-only before calling txBegin, and returning
> with appropiate error code.
Looks good. I'm going to change it to just an if clause without the else
and push it to jfs-next.
Thanks,
>
> Reported-By: syzbot+f1faa20eec55e0c8644c@...kaller.appspotmail.com
> Link: https://syzkaller.appspot.com/bug?id=be7e52c50c5182cc09a09ea6fc456446b2039de3
>
> Signed-off-by: Immad Mir <mirimmad17@...il.com>
> ---
> fs/jfs/namei.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
> index b29d68b5e..12e95431c 100644
> --- a/fs/jfs/namei.c
> +++ b/fs/jfs/namei.c
> @@ -798,8 +798,13 @@ static int jfs_link(struct dentry *old_dentry,
> rc = dquot_initialize(dir);
> if (rc)
> goto out;
> -
> - tid = txBegin(ip->i_sb, 0);
> + if (!isReadOnly(ip)) {
> + tid = txBegin(ip->i_sb, 0);
> + } else {
> + jfs_error(ip->i_sb, "read-only filesystem\n");
> + rc = -EROFS;
> + goto out;
> + }
>
> mutex_lock_nested(&JFS_IP(dir)->commit_mutex, COMMIT_MUTEX_PARENT);
> mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD);
> --
> 2.40.0
>
Powered by blists - more mailing lists