]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: Fix possible null-pointer dereferences in xchk_da_btree_block_check_sibling()
authorJia-Ju Bai <baijiaju1990@gmail.com>
Tue, 30 Jul 2019 18:28:20 +0000 (11:28 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Tue, 30 Jul 2019 18:28:20 +0000 (11:28 -0700)
commitfa0c3a3974adb35d64b4f1be01c1eeb3ec5dfb6c
treedd6f7213cff728deae942e9fc7a46d9bfd0d35b5
parent6a0cb86be66ec1aa3c184d66d6585e982dadef4e
xfs: Fix possible null-pointer dereferences in xchk_da_btree_block_check_sibling()

In xchk_da_btree_block_check_sibling(), there is an if statement on
line 274 to check whether ds->state->altpath.blk[level].bp is NULL:
    if (ds->state->altpath.blk[level].bp)

When ds->state->altpath.blk[level].bp is NULL, it is used on line 281:
    xfs_trans_brelse(..., ds->state->altpath.blk[level].bp);
        struct xfs_buf_log_item *bip = bp->b_log_item;
        ASSERT(bp->b_transp == tp);

Thus, possible null-pointer dereferences may occur.

To fix these bugs, ds->state->altpath.blk[level].bp is checked before
being used.

These bugs are found by a static analysis tool STCheck written by us.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/scrub/dabtree.c