[syzbot] [jfs?] KASAN: null-ptr-deref Read in txBegin

36 views
Skip to first unread message

syzbot

unread,
Feb 18, 2023, 2:59:46 PM2/18/23
to jfs-dis...@lists.sourceforge.net, linux-...@vger.kernel.org, linux-...@vger.kernel.org, sha...@kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 82eac0c830b7 Merge tag 'for-linus' of git://git.kernel.org..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=108c3220c80000
kernel config: https://syzkaller.appspot.com/x/.config?x=42ba4da8e1e6af9f
dashboard link: https://syzkaller.appspot.com/bug?extid=f1faa20eec55e0c8644c
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12dea55f480000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/da7d342f68c6/disk-82eac0c8.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/bc04dc7d5c40/vmlinux-82eac0c8.xz
kernel image: https://storage.googleapis.com/syzbot-assets/9cbbc3b0e69a/bzImage-82eac0c8.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/40deef8f8496/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+f1faa2...@syzkaller.appspotmail.com

read_mapping_page failed!
ERROR: (device loop0): txCommit:
==================================================================
BUG: KASAN: null-ptr-deref in instrument_atomic_read include/linux/instrumented.h:72 [inline]
BUG: KASAN: null-ptr-deref in _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline]
BUG: KASAN: null-ptr-deref in txBegin+0x131/0x6c0 fs/jfs/jfs_txnmgr.c:366
Read of size 8 at addr 0000000000000040 by task syz-executor.0/5172

CPU: 0 PID: 5172 Comm: syz-executor.0 Not tainted 6.2.0-rc8-syzkaller-00019-g82eac0c830b7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
print_report+0xe6/0x4f0 mm/kasan/report.c:420
kasan_report+0x13a/0x170 mm/kasan/report.c:517
kasan_check_range+0x283/0x290 mm/kasan/generic.c:189
instrument_atomic_read include/linux/instrumented.h:72 [inline]
_test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline]
txBegin+0x131/0x6c0 fs/jfs/jfs_txnmgr.c:366
jfs_link+0x1ac/0x5e0 fs/jfs/namei.c:802
vfs_link+0x662/0x810 fs/namei.c:4529
do_linkat+0x5b4/0x9d0 fs/namei.c:4600
__do_sys_linkat fs/namei.c:4628 [inline]
__se_sys_linkat fs/namei.c:4625 [inline]
__x64_sys_linkat+0xdd/0xf0 fs/namei.c:4625
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7ff38288c0f9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ff383575168 EFLAGS: 00000246 ORIG_RAX: 0000000000000109
RAX: ffffffffffffffda RBX: 00007ff3829abf80 RCX: 00007ff38288c0f9
RDX: 0000000000000004 RSI: 0000000020000040 RDI: 0000000000000004
RBP: 00007ff3828e7ae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000020000080 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffe4ad3d6bf R14: 00007ff383575300 R15: 0000000000022000
</TASK>
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

Immad Mir

unread,
Mar 21, 2023, 12:28:54 PM3/21/23
to syzkaller-bugs
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index ffd4feece..21d442de2 100644
--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -358,6 +358,9 @@ tid_t txBegin(struct super_block *sb, int flag)
 
  INCREMENT(TxStat.txBegin);
 
+ if (!log)
+ jfs_error(sb, "%s: log is NULL\n", __func__);
+
       retry:
  if (!(flag & COMMIT_FORCE)) {
  /*
Message has been deleted

syzbot

unread,
Mar 21, 2023, 12:52:34 PM3/21/23
to mirim...@gmail.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KASAN: null-ptr-deref Read in txBegin

loop0: detected capacity change from 0 to 32768
find_entry called with index = 0
read_mapping_page failed!
ERROR: (device loop0): txCommit:
ERROR: (device loop0): txBegin: txBegin: log is NULL
==================================================================
BUG: KASAN: null-ptr-deref in instrument_atomic_read include/linux/instrumented.h:72 [inline]
BUG: KASAN: null-ptr-deref in _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline]
BUG: KASAN: null-ptr-deref in txBegin+0x158/0x6e0 fs/jfs/jfs_txnmgr.c:369
Read of size 8 at addr 0000000000000040 by task syz-executor.0/5605

CPU: 1 PID: 5605 Comm: syz-executor.0 Not tainted 6.3.0-rc3-syzkaller-00012-g17214b70a159-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
print_report+0xe6/0x540 mm/kasan/report.c:433
kasan_report+0x176/0x1b0 mm/kasan/report.c:536
kasan_check_range+0x283/0x290 mm/kasan/generic.c:187
instrument_atomic_read include/linux/instrumented.h:72 [inline]
_test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline]
txBegin+0x158/0x6e0 fs/jfs/jfs_txnmgr.c:369
jfs_link+0x1ac/0x5e0 fs/jfs/namei.c:802
vfs_link+0x4ed/0x680 fs/namei.c:4522
do_linkat+0x5cc/0x9e0 fs/namei.c:4593
__do_sys_linkat fs/namei.c:4621 [inline]
__se_sys_linkat fs/namei.c:4618 [inline]
__x64_sys_linkat+0xdd/0xf0 fs/namei.c:4618
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f08d2a8c0f9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f08d3844168 EFLAGS: 00000246 ORIG_RAX: 0000000000000109
RAX: ffffffffffffffda RBX: 00007f08d2babf80 RCX: 00007f08d2a8c0f9
RDX: 0000000000000004 RSI: 0000000020000040 RDI: 0000000000000004
RBP: 00007f08d2ae7b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000020000080 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffdfe18d37f R14: 00007f08d3844300 R15: 0000000000022000
</TASK>
==================================================================


Tested on:

commit: 17214b70 Merge tag 'fsverity-for-linus' of git://git.k..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1783ac5ec80000
kernel config: https://syzkaller.appspot.com/x/.config?x=d40f6d44826f6cf7
dashboard link: https://syzkaller.appspot.com/bug?extid=f1faa20eec55e0c8644c
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=14c96a86c80000

Immad Mir

unread,
Mar 21, 2023, 1:14:40 PM3/21/23
to syzkaller-bugs
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index ffd4feece..13342b2e4 100644

--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -358,6 +358,9 @@ tid_t txBegin(struct super_block *sb, int flag)
 
  INCREMENT(TxStat.txBegin);
 
+ if (!log)
+ return 0;

+
       retry:
  if (!(flag & COMMIT_FORCE)) {
  /*
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index b29d68b5e..ad2a8fc6f 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -800,6 +800,8 @@ static int jfs_link(struct dentry *old_dentry,
  goto out;
 
  tid = txBegin(ip->i_sb, 0);
+ if (tid == 0)
+ goto out;
 
  mutex_lock_nested(&JFS_IP(dir)->commit_mutex, COMMIT_MUTEX_PARENT);
  mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD);

syzbot

unread,
Mar 21, 2023, 1:36:22 PM3/21/23
to mirim...@gmail.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
BUG: sleeping function called from invalid context in dput

loop0: detected capacity change from 0 to 32768
find_entry called with index = 0
read_mapping_page failed!
ERROR: (device loop0): txCommit:
BUG: sleeping function called from invalid context at fs/dcache.c:897
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 5609, name: syz-executor.0
preempt_count: 1, expected: 0
RCU nest depth: 0, expected: 0
3 locks held by syz-executor.0/5609:
#0: ffff88802a094460 (sb_writers#14){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:394
#1: ffff88806e073d00 (&type->i_mutex_dir_key#8/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:793 [inline]
#1: ffff88806e073d00 (&type->i_mutex_dir_key#8/1){+.+.}-{3:3}, at: filename_create+0x25a/0x530 fs/namei.c:3808
#2: ffffffff8d3041f8 (jfsTxnLock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:350 [inline]
#2: ffffffff8d3041f8 (jfsTxnLock){+.+.}-{2:2}, at: txBegin+0xa8/0x6d0 fs/jfs/jfs_txnmgr.c:357
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 0 PID: 5609 Comm: syz-executor.0 Not tainted 6.3.0-rc3-syzkaller-00012-g17214b70a159-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
__might_resched+0x5cf/0x780 kernel/sched/core.c:10058
dput+0x40/0x420 fs/dcache.c:897
done_path_create fs/namei.c:3857 [inline]
do_linkat+0x2fd/0x9e0 fs/namei.c:4596
__do_sys_linkat fs/namei.c:4621 [inline]
__se_sys_linkat fs/namei.c:4618 [inline]
__x64_sys_linkat+0xdd/0xf0 fs/namei.c:4618
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f14b288c0f9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f14b3652168 EFLAGS: 00000246 ORIG_RAX: 0000000000000109
RAX: ffffffffffffffda RBX: 00007f14b29abf80 RCX: 00007f14b288c0f9
RDX: 0000000000000004 RSI: 0000000020000040 RDI: 0000000000000004
RBP: 00007f14b28e7b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000020000080 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffc29036edf R14: 00007f14b3652300 R15: 0000000000022000
</TASK>
BUG: scheduling while atomic: syz-executor.0/5609/0x00000002
1 lock held by syz-executor.0/5609:
#0: ffffffff8d3041f8 (jfsTxnLock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:350 [inline]
#0: ffffffff8d3041f8 (jfsTxnLock){+.+.}-{2:2}, at: txBegin+0xa8/0x6d0 fs/jfs/jfs_txnmgr.c:357
Modules linked in:
Preemption disabled at:
[<0000000000000000>] 0x0


Tested on:

commit: 17214b70 Merge tag 'fsverity-for-linus' of git://git.k..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=169869bec80000
kernel config: https://syzkaller.appspot.com/x/.config?x=d40f6d44826f6cf7
dashboard link: https://syzkaller.appspot.com/bug?extid=f1faa20eec55e0c8644c
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=16489fa6c80000

Immad Mir

unread,
Mar 22, 2023, 6:40:11 AM3/22/23
to syzkaller-bugs
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index b29d68b5e..cd43b68e2 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -799,6 +799,8 @@ static int jfs_link(struct dentry *old_dentry,
  if (rc)
  goto out;
 
+ if (!(JFS_SBI(ip->i_sb)->log))
+ goto out;

  tid = txBegin(ip->i_sb, 0);
 
  mutex_lock_nested(&JFS_IP(dir)->commit_mutex, COMMIT_MUTEX_PARENT);

syzbot

unread,
Mar 22, 2023, 2:06:24 PM3/22/23
to mirim...@gmail.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+f1faa2...@syzkaller.appspotmail.com

Tested on:

commit: a1effab7 Merge tag 'vfio-v6.3-rc4' of https://github.c..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=118808eec80000
kernel config: https://syzkaller.appspot.com/x/.config?x=d40f6d44826f6cf7
dashboard link: https://syzkaller.appspot.com/bug?extid=f1faa20eec55e0c8644c
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=125eabf6c80000

Note: testing is done by a robot and is best-effort only.

syzbot

unread,
May 13, 2023, 11:33:40 AM5/13/23
to jfs-dis...@lists.sourceforge.net, linux-...@vger.kernel.org, linux-...@vger.kernel.org, mirim...@gmail.com, miri...@outlook.com, sha...@kernel.org, sk...@linuxfoundation.org, syzkall...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 14f8db1c0f9a Merge branch 'for-next/core' into for-kernelci
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=12f5764e280000
kernel config: https://syzkaller.appspot.com/x/.config?x=a837a8ba7e88bb45
dashboard link: https://syzkaller.appspot.com/bug?extid=f1faa20eec55e0c8644c
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15b9e24e280000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=105d3e46280000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/ad6ce516eed3/disk-14f8db1c.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/1f38c2cc7667/vmlinux-14f8db1c.xz
kernel image: https://storage.googleapis.com/syzbot-assets/d795115eee39/Image-14f8db1c.gz.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/014681b264cc/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+f1faa2...@syzkaller.appspotmail.com

WARNING: The mand mount option has been deprecated and
and is ignored by this kernel. Remove the mand
option from the mount to silence this warning.
=======================================================
Unable to handle kernel paging request at virtual address dfff800000000008
KASAN: null-ptr-deref in range [0x0000000000000040-0x0000000000000047]
Mem abort info:
ESR = 0x0000000096000006
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x06: level 2 translation fault
Data abort info:
ISV = 0, ISS = 0x00000006
CM = 0, WnR = 0
[dfff800000000008] address between user and kernel address ranges
Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 5926 Comm: syz-executor228 Not tainted 6.3.0-rc7-syzkaller-g14f8db1c0f9a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : generic_test_bit include/asm-generic/bitops/generic-non-atomic.h:128 [inline]
pc : txBegin+0x138/0x5e0 fs/jfs/jfs_txnmgr.c:366
lr : txBegin+0x104/0x5e0 fs/jfs/jfs_txnmgr.c:357
sp : ffff80001eb37660
x29: ffff80001eb37680 x28: dfff800000000000 x27: dfff800000000000
x26: ffff800016308bc8 x25: 0000000000000040 x24: 0000000000000000
x23: ffff800016306520 x22: ffff0000d6a57c30 x21: 0000000000000150
x20: 0000000000000008 x19: 0000000000000000 x18: ffff80001eb37360
x17: ffff800008ad82e4 x16: ffff80000831ae40 x15: 000000000000bb8c
x14: 000000003eb35159 x13: dfff800000000000 x12: ffff700003d66eb4
x11: 0000000000000001 x10: 0000000000000000 x9 : 0000000000000000
x8 : 1ffff00002c5f670 x7 : 0000000000000000 x6 : 0000000000000000
x5 : ffff800019238f80 x4 : 0000000000000008 x3 : ffff80000831af70
x2 : 0000000000000001 x1 : 0000000000000000 x0 : 0000000000000000
Call trace:
txBegin+0x138/0x5e0 fs/jfs/jfs_txnmgr.c:362
__jfs_xattr_set+0xc8/0x190 fs/jfs/xattr.c:915
jfs_xattr_set+0x58/0x70 fs/jfs/xattr.c:941
__vfs_setxattr+0x3d8/0x400 fs/xattr.c:203
__vfs_setxattr_noperm+0x110/0x528 fs/xattr.c:237
__vfs_setxattr_locked+0x1ec/0x218 fs/xattr.c:298
vfs_setxattr+0x1a8/0x344 fs/xattr.c:324
do_setxattr fs/xattr.c:609 [inline]
setxattr+0x208/0x29c fs/xattr.c:632
path_setxattr+0x17c/0x258 fs/xattr.c:651
__do_sys_setxattr fs/xattr.c:667 [inline]
__se_sys_setxattr fs/xattr.c:663 [inline]
__arm64_sys_setxattr+0xbc/0xd8 fs/xattr.c:663
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x198 arch/arm64/kernel/syscall.c:193
el0_svc+0x4c/0x15c arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591
Code: 9400012e aa1703e0 95954bf6 350002f8 (387c6a88)
---[ end trace 0000000000000000 ]---
----------------
Code disassembly (best guess):
0: 9400012e bl 0x4b8
4: aa1703e0 mov x0, x23
8: 95954bf6 bl 0x6552fe0
c: 350002f8 cbnz w24, 0x68
* 10: 387c6a88 ldrb w8, [x20, x28] <-- trapping instruction


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

Immad Mir

unread,
Jun 22, 2023, 11:36:10 AM6/22/23
to syzkaller-bugs
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index b29d68b5e..257b856b9 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -798,8 +798,12 @@ 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 {
+ 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);

Immad Mir

unread,
Jun 22, 2023, 12:00:24 PM6/22/23
to syzkaller-bugs

diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index b29d68b5e..4a7ab141d 100644

--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -798,8 +798,12 @@ 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 {
+ 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

014_Mir_Immad_ECE_20

unread,
Jun 26, 2023, 12:34:36 PM6/26/23
to syzkaller-bugs

diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index b29d68b5e..4a7ab141d 100644

--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -798,8 +798,12 @@ 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 {
+ 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 all
Reply to author
Forward
0 new messages