Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 6306ff3

Browse files
Lizhi Xubrauner
authored andcommitted
jfs: fix log->bdev_handle null ptr deref in lbmStartIO
When sbi->flag is JFS_NOINTEGRITY in lmLogOpen(), log->bdev_handle can't be inited, so it value will be NULL. Therefore, add the "log ->no_integrity=1" judgment in lbmStartIO() to avoid such problems. Reported-and-tested-by: [email protected] Signed-off-by: Lizhi Xu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent b3856da commit 6306ff3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/jfs/jfs_logmgr.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2110,10 +2110,14 @@ static void lbmStartIO(struct lbuf * bp)
21102110
{
21112111
struct bio *bio;
21122112
struct jfs_log *log = bp->l_log;
2113+
struct block_device *bdev = NULL;
21132114

21142115
jfs_info("lbmStartIO");
21152116

2116-
bio = bio_alloc(log->bdev_handle->bdev, 1, REQ_OP_WRITE | REQ_SYNC,
2117+
if (!log->no_integrity)
2118+
bdev = log->bdev_handle->bdev;
2119+
2120+
bio = bio_alloc(bdev, 1, REQ_OP_WRITE | REQ_SYNC,
21172121
GFP_NOFS);
21182122
bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9);
21192123
__bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset);

0 commit comments

Comments
 (0)