Kernel bug: kernel BUG in bch2_bio_compress (2)
Subsystem: bcachefs
Status: fixed

Crash report:
------------[ cut here ]------------
kernel BUG at fs/bcachefs/compress.c:398!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI
CPU: 0 UID: 0 PID: 5328 Comm: bch-rebalance/l Not tainted 6.12.0-rc6-syzkaller-00279-gde2f378f2b77 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
RIP: 0010:__bio_compress fs/bcachefs/compress.c:398 [inline]
RIP: 0010:bch2_bio_compress+0x13a1/0x13e0 fs/bcachefs/compress.c:498
Code: e1 07 38 c1 0f 8c 77 fb ff ff be 14 00 00 00 4c 89 ef e8 e2 36 d7 fd e9 65 fb ff ff e8 88 6f 6d fd 90 0f 0b e8 80 6f 6d fd 90 <0f> 0b e8 78 6f 6d fd 90 0f 0b e8 c0 fb 9f 07 e8 6b 6f 6d fd 90 0f
RSP: 0018:ffffc9000d166c20 EFLAGS: 00010293
RAX: ffffffff84276ae0 RBX: ffff888044747b18 RCX: ffff88801f3e4880
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004
RBP: ffffc9000d166eb0 R08: ffffffff8427593f R09: 0000000000000078
R10: ffffc9000d1672c0 R11: fffff52001a2ce5d R12: 0000000000000000
R13: ffff88804b67b668 R14: dffffc0000000000 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005651105940d8 CR3: 000000000e734000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 bch2_write_extent fs/bcachefs/io_write.c:962 [inline]
 __bch2_write+0x151b/0x5dd0 fs/bcachefs/io_write.c:1458
 bch2_write+0x9b5/0x1760 fs/bcachefs/io_write.c:1631
 closure_queue include/linux/closure.h:270 [inline]
 closure_call include/linux/closure.h:432 [inline]
 bch2_data_update_read_done+0x22e/0x330 fs/bcachefs/data_update.c:426
 move_write fs/bcachefs/move.c:133 [inline]
 bch2_moving_ctxt_do_pending_writes+0x44c/0x8d0 fs/bcachefs/move.c:164
 bch2_moving_ctxt_flush_all+0x1c3/0x2f0 fs/bcachefs/move.c:179
 do_rebalance fs/bcachefs/rebalance.c:379 [inline]
 bch2_rebalance_thread+0x1a87/0x1fc0 fs/bcachefs/rebalance.c:401
 kthread+0x2f0/0x390 kernel/kthread.c:389
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__bio_compress fs/bcachefs/compress.c:398 [inline]
RIP: 0010:bch2_bio_compress+0x13a1/0x13e0 fs/bcachefs/compress.c:498
Code: e1 07 38 c1 0f 8c 77 fb ff ff be 14 00 00 00 4c 89 ef e8 e2 36 d7 fd e9 65 fb ff ff e8 88 6f 6d fd 90 0f 0b e8 80 6f 6d fd 90 <0f> 0b e8 78 6f 6d fd 90 0f 0b e8 c0 fb 9f 07 e8 6b 6f 6d fd 90 0f
RSP: 0018:ffffc9000d166c20 EFLAGS: 00010293
RAX: ffffffff84276ae0 RBX: ffff888044747b18 RCX: ffff88801f3e4880
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004
RBP: ffffc9000d166eb0 R08: ffffffff8427593f R09: 0000000000000078
R10: ffffc9000d1672c0 R11: fffff52001a2ce5d R12: 0000000000000000
R13: ffff88804b67b668 R14: dffffc0000000000 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fddecdff000 CR3: 0000000011e72000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400