Misc fixes for ocfs2_read_blocks
Joseph Qi
maintainerv5 cover Misc fixes for ocfs2_read_blocks
This series contains 2 fixes for ocfs2_read_blocks().
The first patch fix the issue reported by syzbot, which detects bad unlock balance in ocfs2_read_blocks().
The second patch fix an issue reported by Heming Zhao when reviewing above fix.
Lizhi Xu (2):
ocfs2: remove unreasonable unlock in ocfs2_read_blocks
ocfs2: Fix possible null-ptr-deref in ocfs2_set_buffer_uptodate
fs/ocfs2/buffer_head_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.39.3
Joseph Qi
maintainerPATCH v5 1/2 ocfs2: remove unreasonable unlock in ocfs2_read_blocks
From: Lizhi Xu <[email protected]>
There was a lock release before exiting, so remove the unreasonable unlock.
--- fs/ocfs2/buffer_head_io.c | 1 - 1 file changed, 1 deletion(-)
fs/ocfs2/buffer_head_io.c +0 -1
@@ -235,7 +235,6 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,if (bhs[i] ==NULL ) { bhs[i] =sb_getblk (sb, block++);if (bhs[i] ==NULL ) { -ocfs2_metadata_cache_io_unlock (ci); status = -ENOMEM ;mlog_errno (status);/* Don't forget to put previous bh! */
Signature · 1 line
2.39.3
Joseph Qi
maintainerPATCH v5 2/2 ocfs2: Fix possible null-ptr-deref in ocfs2_set_buffer_uptodate
In reply to Joseph QiFrom: Lizhi Xu <[email protected]>
When doing cleanup, if flags without OCFS2_BH_READAHEAD, it may trigger NULL pointer dereference in the following ocfs2_set_buffer_uptodate() if bh is NULL.
--- fs/ocfs2/buffer_head_io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ocfs2/buffer_head_io.c +2 -1
@@ -388,7 +388,8 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,/* Always set the buffer in the cache, even if it was * a forced read, or read-ahead which hasn't yet * completed. */ -ocfs2_set_buffer_uptodate (ci, bh); +if (bh) +ocfs2_set_buffer_uptodate (ci, bh); }ocfs2_metadata_cache_io_unlock (ci);
Signature · 1 line
2.39.3