Skip to content

Commit 47cfdc3

Browse files
mirimmadkleikamp
authored andcommitted
FS: JFS: Fix null-ptr-deref Read in txBegin
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. Reported-By: syzbot+f1faa20eec55e0c8644c@syzkaller.appspotmail.com Link: https://syzkaller.appspot.com/bug?id=be7e52c50c5182cc09a09ea6fc456446b2039de3 Signed-off-by: Immad Mir <mirimmad17@gmail.com> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
1 parent 4e30233 commit 47cfdc3

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

fs/jfs/namei.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,11 @@ static int jfs_link(struct dentry *old_dentry,
799799
if (rc)
800800
goto out;
801801

802+
if (isReadOnly(ip)) {
803+
jfs_error(ip->i_sb, "read-only filesystem\n");
804+
return -EROFS;
805+
}
806+
802807
tid = txBegin(ip->i_sb, 0);
803808

804809
mutex_lock_nested(&JFS_IP(dir)->commit_mutex, COMMIT_MUTEX_PARENT);

0 commit comments

Comments
 (0)