public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [jfs?] [fat?] general protection fault in txEnd
@ 2022-12-23 23:37 syzbot
  2023-03-30 10:03 ` Aleksandr Nogikh
  0 siblings, 1 reply; 6+ messages in thread
From: syzbot @ 2022-12-23 23:37 UTC (permalink / raw)
  To: jfs-discussion, linux-kernel, shaggy, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    aeba12b26c79 Merge tag 'nfsd-6.2-1' of git://git.kernel.or..
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=17485bf0480000
kernel config:  https://syzkaller.appspot.com/x/.config?x=4d348fc1e0f483c9
dashboard link: https://syzkaller.appspot.com/bug?extid=1d096d31de6a0491b55e
compiler:       Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=117aef10480000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=15206090480000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/661fe33f851b/disk-aeba12b2.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c938bdcf3ad0/vmlinux-aeba12b2.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e7f738de30b7/bzImage-aeba12b2.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/9ee3cffc6151/mount_0.gz

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

ERROR: (device loop0): remounting filesystem as read-only
general protection fault, probably for non-canonical address 0xdffffc0000000029: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000148-0x000000000000014f]
CPU: 1 PID: 5116 Comm: syz-executor317 Not tainted 6.1.0-syzkaller-13781-gaeba12b26c79 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
RIP: 0010:txEnd+0x1dc/0x560 fs/jfs/jfs_txnmgr.c:534
Code: 00 84 c0 0f 85 d8 02 00 00 66 41 89 1e 41 0f b7 c5 89 05 e7 5c 0b 0f 4c 8b 74 24 08 49 8d 9e 4c 01 00 00 48 89 d8 48 c1 e8 03 <42> 8a 04 20 84 c0 0f 85 c8 02 00 00 8b 2b 8d 75 ff 89 33 31 ff e8
RSP: 0018:ffffc90003d5f9f0 EFLAGS: 00010203
RAX: 0000000000000029 RBX: 000000000000014c RCX: 0000000000000000
RDX: ffff88807eb93a80 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 1ffff920004c6227 R08: ffffffff830c3c2f R09: fffffbfff20fb43a
R10: fffffbfff20fb43a R11: 1ffffffff20fb439 R12: dffffc0000000000
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000110
FS:  00007f2738801700(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f273fc23000 CR3: 000000007e7a4000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 add_missing_indices fs/jfs/jfs_dtree.c:2658 [inline]
 jfs_readdir+0x277c/0x44b0 fs/jfs/jfs_dtree.c:3004
 iterate_dir+0x257/0x5f0
 __do_sys_getdents fs/readdir.c:286 [inline]
 __se_sys_getdents+0x1db/0x4d0 fs/readdir.c:271
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f273fc76709
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 71 15 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:00007f27388012f8 EFLAGS: 00000246 ORIG_RAX: 000000000000004e
RAX: ffffffffffffffda RBX: 00007f273fd017b0 RCX: 00007f273fc76709
RDX: 000000000000004c RSI: 0000000020000100 RDI: 0000000000000004
RBP: 0030656c69662f2e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 61746f7571727375
R13: 726765746e696f6e R14: 7261637369646f6e R15: 00007f273fd017b8
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:txEnd+0x1dc/0x560 fs/jfs/jfs_txnmgr.c:534
Code: 00 84 c0 0f 85 d8 02 00 00 66 41 89 1e 41 0f b7 c5 89 05 e7 5c 0b 0f 4c 8b 74 24 08 49 8d 9e 4c 01 00 00 48 89 d8 48 c1 e8 03 <42> 8a 04 20 84 c0 0f 85 c8 02 00 00 8b 2b 8d 75 ff 89 33 31 ff e8
RSP: 0018:ffffc90003d5f9f0 EFLAGS: 00010203
RAX: 0000000000000029 RBX: 000000000000014c RCX: 0000000000000000
RDX: ffff88807eb93a80 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 1ffff920004c6227 R08: ffffffff830c3c2f R09: fffffbfff20fb43a
R10: fffffbfff20fb43a R11: 1ffffffff20fb439 R12: dffffc0000000000
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000110
FS:  00007f2738801700(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f273fc23000 CR3: 000000007e7a4000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	00 84 c0 0f 85 d8 02 	add    %al,0x2d8850f(%rax,%rax,8)
   7:	00 00                	add    %al,(%rax)
   9:	66 41 89 1e          	mov    %bx,(%r14)
   d:	41 0f b7 c5          	movzwl %r13w,%eax
  11:	89 05 e7 5c 0b 0f    	mov    %eax,0xf0b5ce7(%rip)        # 0xf0b5cfe
  17:	4c 8b 74 24 08       	mov    0x8(%rsp),%r14
  1c:	49 8d 9e 4c 01 00 00 	lea    0x14c(%r14),%rbx
  23:	48 89 d8             	mov    %rbx,%rax
  26:	48 c1 e8 03          	shr    $0x3,%rax
* 2a:	42 8a 04 20          	mov    (%rax,%r12,1),%al <-- trapping instruction
  2e:	84 c0                	test   %al,%al
  30:	0f 85 c8 02 00 00    	jne    0x2fe
  36:	8b 2b                	mov    (%rbx),%ebp
  38:	8d 75 ff             	lea    -0x1(%rbp),%esi
  3b:	89 33                	mov    %esi,(%rbx)
  3d:	31 ff                	xor    %edi,%edi
  3f:	e8                   	.byte 0xe8


---
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 syzkaller@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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [syzbot] [jfs?] [fat?] general protection fault in txEnd
  2022-12-23 23:37 syzbot
@ 2023-03-30 10:03 ` Aleksandr Nogikh
  0 siblings, 0 replies; 6+ messages in thread
From: Aleksandr Nogikh @ 2023-03-30 10:03 UTC (permalink / raw)
  To: syzbot; +Cc: jfs-discussion, linux-kernel, shaggy, syzkaller-bugs

#syz set subsystems: jfs

On Sat, Dec 24, 2022 at 12:37 AM syzbot
<syzbot+1d096d31de6a0491b55e@syzkaller.appspotmail.com> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit:    aeba12b26c79 Merge tag 'nfsd-6.2-1' of git://git.kernel.or..
> git tree:       upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=17485bf0480000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=4d348fc1e0f483c9
> dashboard link: https://syzkaller.appspot.com/bug?extid=1d096d31de6a0491b55e
> compiler:       Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=117aef10480000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=15206090480000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/661fe33f851b/disk-aeba12b2.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/c938bdcf3ad0/vmlinux-aeba12b2.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/e7f738de30b7/bzImage-aeba12b2.xz
> mounted in repro: https://storage.googleapis.com/syzbot-assets/9ee3cffc6151/mount_0.gz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+1d096d31de6a0491b55e@syzkaller.appspotmail.com
>
> ERROR: (device loop0): remounting filesystem as read-only
> general protection fault, probably for non-canonical address 0xdffffc0000000029: 0000 [#1] PREEMPT SMP KASAN
> KASAN: null-ptr-deref in range [0x0000000000000148-0x000000000000014f]
> CPU: 1 PID: 5116 Comm: syz-executor317 Not tainted 6.1.0-syzkaller-13781-gaeba12b26c79 #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
> RIP: 0010:txEnd+0x1dc/0x560 fs/jfs/jfs_txnmgr.c:534
> Code: 00 84 c0 0f 85 d8 02 00 00 66 41 89 1e 41 0f b7 c5 89 05 e7 5c 0b 0f 4c 8b 74 24 08 49 8d 9e 4c 01 00 00 48 89 d8 48 c1 e8 03 <42> 8a 04 20 84 c0 0f 85 c8 02 00 00 8b 2b 8d 75 ff 89 33 31 ff e8
> RSP: 0018:ffffc90003d5f9f0 EFLAGS: 00010203
> RAX: 0000000000000029 RBX: 000000000000014c RCX: 0000000000000000
> RDX: ffff88807eb93a80 RSI: 0000000000000000 RDI: 0000000000000000
> RBP: 1ffff920004c6227 R08: ffffffff830c3c2f R09: fffffbfff20fb43a
> R10: fffffbfff20fb43a R11: 1ffffffff20fb439 R12: dffffc0000000000
> R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000110
> FS:  00007f2738801700(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007f273fc23000 CR3: 000000007e7a4000 CR4: 00000000003506e0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
>  <TASK>
>  add_missing_indices fs/jfs/jfs_dtree.c:2658 [inline]
>  jfs_readdir+0x277c/0x44b0 fs/jfs/jfs_dtree.c:3004
>  iterate_dir+0x257/0x5f0
>  __do_sys_getdents fs/readdir.c:286 [inline]
>  __se_sys_getdents+0x1db/0x4d0 fs/readdir.c:271
>  do_syscall_x64 arch/x86/entry/common.c:50 [inline]
>  do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
>  entry_SYSCALL_64_after_hwframe+0x63/0xcd
> RIP: 0033:0x7f273fc76709
> Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 71 15 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:00007f27388012f8 EFLAGS: 00000246 ORIG_RAX: 000000000000004e
> RAX: ffffffffffffffda RBX: 00007f273fd017b0 RCX: 00007f273fc76709
> RDX: 000000000000004c RSI: 0000000020000100 RDI: 0000000000000004
> RBP: 0030656c69662f2e R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 61746f7571727375
> R13: 726765746e696f6e R14: 7261637369646f6e R15: 00007f273fd017b8
>  </TASK>
> Modules linked in:
> ---[ end trace 0000000000000000 ]---
> RIP: 0010:txEnd+0x1dc/0x560 fs/jfs/jfs_txnmgr.c:534
> Code: 00 84 c0 0f 85 d8 02 00 00 66 41 89 1e 41 0f b7 c5 89 05 e7 5c 0b 0f 4c 8b 74 24 08 49 8d 9e 4c 01 00 00 48 89 d8 48 c1 e8 03 <42> 8a 04 20 84 c0 0f 85 c8 02 00 00 8b 2b 8d 75 ff 89 33 31 ff e8
> RSP: 0018:ffffc90003d5f9f0 EFLAGS: 00010203
> RAX: 0000000000000029 RBX: 000000000000014c RCX: 0000000000000000
> RDX: ffff88807eb93a80 RSI: 0000000000000000 RDI: 0000000000000000
> RBP: 1ffff920004c6227 R08: ffffffff830c3c2f R09: fffffbfff20fb43a
> R10: fffffbfff20fb43a R11: 1ffffffff20fb439 R12: dffffc0000000000
> R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000110
> FS:  00007f2738801700(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007f273fc23000 CR3: 000000007e7a4000 CR4: 00000000003506e0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> ----------------
> Code disassembly (best guess):
>    0:   00 84 c0 0f 85 d8 02    add    %al,0x2d8850f(%rax,%rax,8)
>    7:   00 00                   add    %al,(%rax)
>    9:   66 41 89 1e             mov    %bx,(%r14)
>    d:   41 0f b7 c5             movzwl %r13w,%eax
>   11:   89 05 e7 5c 0b 0f       mov    %eax,0xf0b5ce7(%rip)        # 0xf0b5cfe
>   17:   4c 8b 74 24 08          mov    0x8(%rsp),%r14
>   1c:   49 8d 9e 4c 01 00 00    lea    0x14c(%r14),%rbx
>   23:   48 89 d8                mov    %rbx,%rax
>   26:   48 c1 e8 03             shr    $0x3,%rax
> * 2a:   42 8a 04 20             mov    (%rax,%r12,1),%al <-- trapping instruction
>   2e:   84 c0                   test   %al,%al
>   30:   0f 85 c8 02 00 00       jne    0x2fe
>   36:   8b 2b                   mov    (%rbx),%ebp
>   38:   8d 75 ff                lea    -0x1(%rbp),%esi
>   3b:   89 33                   mov    %esi,(%rbx)
>   3d:   31 ff                   xor    %edi,%edi
>   3f:   e8                      .byte 0xe8
>
>
> ---
> 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 syzkaller@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
>
> --
> You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-bugs+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/00000000000094982205f0874589%40google.com.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [syzbot] [jfs?] [fat?] general protection fault in txEnd
@ 2026-03-28  2:20 Rafael Alejandro Diaz Cruz
  0 siblings, 0 replies; 6+ messages in thread
From: Rafael Alejandro Diaz Cruz @ 2026-03-28  2:20 UTC (permalink / raw)
  To: linux-kernel, skhan, syzkaller-bugs

[-- Attachment #1: Type: text/plain, Size: 10 bytes --]

#syz test

[-- Attachment #2: 0001-jfs-prevent-null-log-deference-from-superblock-durin.patch --]
[-- Type: text/x-diff, Size: 1310 bytes --]

From b530db0e1844ca2b8fecf527dd5d5457e329adf0 Mon Sep 17 00:00:00 2001
From: rafad900 <19312533+rafad900@users.noreply.github.com>
Date: Fri, 27 Mar 2026 18:58:45 -0700
Subject: [PATCH] jfs: prevent null log deference from superblock during read
 only mode

Its not possible to use jfs_create() while the file system is in read
only mode. However, there is not a way for jfs_create() to handle this case
when txBegin fails. So jfs_create() continues to with the changes to the
filesystem and tries to txCommit() them, but when trying to write the changes
to the ->log of the superblock, we reach an error telling us that system
cannot write and enters panic.

Signed-off-by: rafad900 <19312533+rafad900@users.noreply.github.com>
---
 fs/jfs/namei.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 60c4a0e0fca5..25b303276b82 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -97,6 +97,10 @@ static int jfs_create(struct mnt_idmap *idmap, struct inode *dip,
 	}
 
 	tid = txBegin(dip->i_sb, 0);
+	if (tid == 0) {
+		jfs_err("jfs_create: unable to create tblk due to read only filesystem");
+		return -EROFS;
+	}
 
 	mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT);
 	mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [syzbot] [jfs?] [fat?] general protection fault in txEnd
@ 2026-03-30 21:15 Rafael Alejandro Diaz Cruz
  2026-03-30 21:45 ` [syzbot] [jfs] " syzbot
  0 siblings, 1 reply; 6+ messages in thread
From: Rafael Alejandro Diaz Cruz @ 2026-03-30 21:15 UTC (permalink / raw)
  To: linux-kernel, skhan, syzkaller-bugs

[-- Attachment #1: Type: text/plain, Size: 10 bytes --]

#syz test

[-- Attachment #2: 0001-jfs-prevent-null-log-deference-from-superblock-durin.patch --]
[-- Type: text/x-diff, Size: 972 bytes --]

From f5d32d2cad197e1cd5e335ec85490bda11aec429 Mon Sep 17 00:00:00 2001
From: rafad900 <19312533+rafad900@users.noreply.github.com>
Date: Mon, 30 Mar 2026 13:33:13 -0700
Subject: [PATCH]     jfs: prevent null log deference from superblock during
 read only mode Clearing the inode pointer is necessary to ensure no memory
 leaks after txBegin fails to initialize the superblock during read only mode.

Signed-off-by: rafad900 <19312533+rafad900@users.noreply.github.com>
---
 fs/jfs/namei.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 25b303276b82..6d5a1f8f72ab 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -99,6 +99,9 @@ static int jfs_create(struct mnt_idmap *idmap, struct inode *dip,
 	tid = txBegin(dip->i_sb, 0);
 	if (tid == 0) {
 		jfs_err("jfs_create: unable to create tblk due to read only filesystem");
+		free_ea_wmap(ip);
+		clear_nlink(ip);
+		discard_new_inode(ip);
 		return -EROFS;
 	}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [syzbot] [jfs] general protection fault in txEnd
  2026-03-30 21:15 [syzbot] [jfs?] [fat?] general protection fault in txEnd Rafael Alejandro Diaz Cruz
@ 2026-03-30 21:45 ` syzbot
  0 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2026-03-30 21:45 UTC (permalink / raw)
  To: linux-kernel, rafad900, skhan, syzkaller-bugs

Hello,

syzbot tried to test the proposed patch but the build/boot failed:

failed to apply patch:
checking file fs/jfs/namei.c
Hunk #1 FAILED at 99.
1 out of 1 hunk FAILED



Tested on:

commit:         d0c3bcd5 Merge tag 'libcrypto-for-linus' of git://git...
git tree:       upstream
kernel config:  https://syzkaller.appspot.com/x/.config?x=14b6a9313e132a6b
dashboard link: https://syzkaller.appspot.com/bug?extid=1d096d31de6a0491b55e
compiler:       
patch:          https://syzkaller.appspot.com/x/patch.diff?x=168d01ca580000


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [syzbot] [jfs?] [fat?] general protection fault in txEnd
@ 2026-03-30 23:32 Rafael Alejandro Diaz Cruz
  0 siblings, 0 replies; 6+ messages in thread
From: Rafael Alejandro Diaz Cruz @ 2026-03-30 23:32 UTC (permalink / raw)
  To: linux-kernel, skhan, syzkaller-bugs

[-- Attachment #1: Type: text/plain, Size: 10 bytes --]

#syz test

[-- Attachment #2: 0001-jfs-prevent-null-log-deference-from-superblock-durin.patch --]
[-- Type: text/x-diff, Size: 1151 bytes --]

From da93920ddc6ccfe238f98e6e060700566f4052c0 Mon Sep 17 00:00:00 2001
From: rafad900 <19312533+rafad900@users.noreply.github.com>
Date: Mon, 30 Mar 2026 13:33:13 -0700
Subject: [PATCH]     jfs: prevent null log deference from superblock during
 read only mode

    Clearing the inode pointer is necessary to ensure no memory leaks
    after txBegin fails to initialize the superblock during read only
    mode.

Signed-off-by: rafad900 <19312533+rafad900@users.noreply.github.com>
---
 fs/jfs/namei.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 60c4a0e0fca5..3a5f45cdeae0 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -97,7 +97,13 @@ static int jfs_create(struct mnt_idmap *idmap, struct inode *dip,
 	}
 
 	tid = txBegin(dip->i_sb, 0);
-
+	if (tid == 0) {
+		jfs_err("jfs_create: unable to create tblk due to read only filesystem");
+		free_ea_wmap(ip);
+		clear_nlink(ip);
+		discard_new_inode(ip);
+		return -EROFS;
+	}
 	mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT);
 	mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-30 23:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-30 21:15 [syzbot] [jfs?] [fat?] general protection fault in txEnd Rafael Alejandro Diaz Cruz
2026-03-30 21:45 ` [syzbot] [jfs] " syzbot
  -- strict thread matches above, loose matches on Subject: below --
2026-03-30 23:32 [syzbot] [jfs?] [fat?] " Rafael Alejandro Diaz Cruz
2026-03-28  2:20 Rafael Alejandro Diaz Cruz
2022-12-23 23:37 syzbot
2023-03-30 10:03 ` Aleksandr Nogikh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox