f2fs: fix null pointer panic in tracepoint in __replace_atomic_write_block
Jaegeuk Kim
maintainerPATCH 1/1 f2fs: fix null pointer panic in tracepoint in __replace_atomic_write_block
We got a kernel panic if old_addr is NULL.
Signed-off-by Jaegeuk Kim <[email protected]>
--- fs/f2fs/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/segment.c +1 -1
@@ -257,7 +257,7 @@ static int __replace_atomic_write_block(struct inode *inode, pgoff_t index,f2fs_put_dnode (&dn);trace_f2fs_replace_atomic_write_block (inode,F2FS_I (inode)->cow_inode, - index, *old_addr, new_addr, recover); + index, old_addr ? *old_addr :0 , new_addr, recover);return 0 ; }
Signature · 1 line
2.40.0.348.gf938b09366-goog
Jaegeuk Kim
maintainerWe got a kernel panic if old_addr is NULL.
https://bugzilla.kernel.org/show_bug.cgi?id=217266
BUG: kernel NULL pointer dereference, address: 0000000000000000 Call Trace: <TASK> f2fs_commit_atomic_write+0x619/0x990 [f2fs a1b985b80f5babd6f3ea778384908880812bfa43] __f2fs_ioctl+0xd8e/0x4080 [f2fs a1b985b80f5babd6f3ea778384908880812bfa43] ? vfs_write+0x2ae/0x3f0 ? vfs_write+0x2ae/0x3f0 __x64_sys_ioctl+0x91/0xd0 do_syscall_64+0x5c/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x7f69095fe53f
Fixes 2f3a9ae990a7 ("f2fs: introduce trace_f2fs_replace_atomic_write_block")
Cc <[email protected]>
Signed-off-by Jaegeuk Kim <[email protected]>
--- fs/f2fs/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/segment.c +1 -1
@@ -257,7 +257,7 @@ static int __replace_atomic_write_block(struct inode *inode, pgoff_t index,f2fs_put_dnode (&dn);trace_f2fs_replace_atomic_write_block (inode,F2FS_I (inode)->cow_inode, - index, *old_addr, new_addr, recover); + index, old_addr ? *old_addr :0 , new_addr, recover);return 0 ; }
Signature · 1 line
2.40.0.348.gf938b09366-goog
Quoted 16 lines · Jaegeuk Kim
We got a kernel panic if
old_addris NULL.https://bugzilla.kernel.org/show_bug.cgi?id=217266
BUG: kernel NULL pointer dereference, address: 0000000000000000 Call Trace: <TASK> f2fs_commit_atomic_write+0x619/0x990 [f2fs a1b985b80f5babd6f3ea778384908880812bfa43] __f2fs_ioctl+0xd8e/0x4080 [f2fs a1b985b80f5babd6f3ea778384908880812bfa43] ? vfs_write+0x2ae/0x3f0 ? vfs_write+0x2ae/0x3f0 __x64_sys_ioctl+0x91/0xd0 do_syscall_64+0x5c/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x7f69095fe53f
Quoted 3 lines
Fixes 2f3a9ae990a7 ("f2fs: introduce trace_f2fs_replace_atomic_write_block")Cc <[email protected]>Signed-off-by Jaegeuk Kim <[email protected]>
Thanks for fixing this. :)
Reviewed-by Chao Yu <[email protected]>
Thanks,
This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:
Quoted 6 lines · On Mon, 3 Apr 2023 09:50:38 -0700 you wrote:
We got a kernel panic if
old_addris NULL.Signed-off-by Jaegeuk Kim <[email protected]>--- fs/f2fs/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
- [f2fs-dev] f2fs: fix null pointer panic in tracepoint in __replace_atomic_write_block
https://git.kernel.org/jaegeuk/f2fs/c/053654436fc6
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html