mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Kleikamp <dave.kleikamp@oracle.com>
To: mirimmad@outlook.com
Cc: Immad Mir <mirimmad17@gmail.com>,
	syzbot+f1faa20eec55e0c8644c@syzkaller.appspotmail.com,
	Dave Kleikamp <shaggy@kernel.org>,
	jfs-discussion@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] FS: JFS: Fix null-ptr-deref Read in txBegin
Date: Fri, 23 Jun 2023 08:51:39 -0500	[thread overview]
Message-ID: <3e3e6234-5c29-b3ca-c499-6fdbf611f62c@oracle.com> (raw)
In-Reply-To: <CY5PR12MB6455B012A589AE5A29C52146C623A@CY5PR12MB6455.namprd12.prod.outlook.com>

On 6/23/23 8:44AM, mirimmad@outlook.com wrote:
> From: Immad Mir <mirimmad17@gmail.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@syzkaller.appspotmail.com
> Link: https://syzkaller.appspot.com/bug?id=be7e52c50c5182cc09a09ea6fc456446b2039de3
> 
> Signed-off-by: Immad Mir <mirimmad17@gmail.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
> 

  reply	other threads:[~2023-06-23 13:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-26 16:20 mirimmad
2023-06-23 13:44 ` mirimmad
2023-06-23 13:51   ` Dave Kleikamp [this message]
     [not found] ` <CY5PR12MB64551AB18AB4DB2D3F1CA5A9C65DA@CY5PR12MB6455.namprd12.prod.outlook.com>
     [not found]   ` <a0493c88-358a-9d77-110a-18449314193b@oracle.com>
     [not found]     ` <CAJfv2=A-b7yVtNA_T2kYyk_xK_suWrVX=gC3b+Am4LmNmvq02A@mail.gmail.com>
2023-06-23 13:48       ` Dave Kleikamp

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=3e3e6234-5c29-b3ca-c499-6fdbf611f62c@oracle.com \
    --to=dave.kleikamp@oracle.com \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mirimmad17@gmail.com \
    --cc=mirimmad@outlook.com \
    --cc=shaggy@kernel.org \
    --cc=syzbot+f1faa20eec55e0c8644c@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

all inboxes | Powered by JetHome®