Pull xfs fixes from Darrick Wong: - Avoid leaking kernel stack contents to userspace - Fix a potential null pointer dereference in the dabtree scrub code * tag 'xfs-5.3-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: xfs: Fix possible null-pointer dereferences in xchk_da_btree_block_check_sibling() xfs: fix stack contents leakage in the v1 inumber ioctls
Unified · Split
| @@ -278,7 +278,11 @@ xchk_da_btree_block_check_sibling( · 277 unmodified lines | ||
| 278 | 278 | /* Compare upper level pointer to sibling pointer. */ |
| 279 | 279 | if (ds->state->altpath.blk[level].blkno != sibling) |
| 280 | 280 | xchk_da_set_corrupt(ds, level); |
| 281 | − xfs_trans_brelse(ds->dargs.trans, ds->state->altpath.blk[level].bp); | |
| 281 | + if (ds->state->altpath.blk[level].bp) { | |
| 282 | + xfs_trans_brelse(ds->dargs.trans, | |
| 283 | + ds->state->altpath.blk[level].bp); | |
| 284 | + ds->state->altpath.blk[level].bp = NULL; | |
| 285 | + } | |
| 282 | 286 | out: |
| 283 | 287 | return error; |
| 284 | 288 | } |
| @@ -272,6 +272,7 @@ xfs_bulkstat_to_bstat( · 271 unmodified lines | ||
| 272 | 272 | struct xfs_bstat *bs1, |
| 273 | 273 | const struct xfs_bulkstat *bstat) |
| 274 | 274 | { |
| 275 | + /* memset is needed here because of padding holes in the structure. */ | |
| 275 | 276 | memset(bs1, 0, sizeof(struct xfs_bstat)); |
| 276 | 277 | bs1->bs_ino = bstat->bs_ino; |
| 277 | 278 | bs1->bs_mode = bstat->bs_mode; |
| @@ -388,6 +389,8 @@ xfs_inumbers_to_inogrp( · 110 unmodified lines | ||
| 388 | 389 | struct xfs_inogrp *ig1, |
| 389 | 390 | const struct xfs_inumbers *ig) |
| 390 | 391 | { |
| 392 | + /* memset is needed here because of padding holes in the structure. */ | |
| 393 | + memset(ig1, 0, sizeof(struct xfs_inogrp)); | |
| 391 | 394 | ig1->xi_startino = ig->xi_startino; |
| 392 | 395 | ig1->xi_alloccount = ig->xi_alloccount; |
| 393 | 396 | ig1->xi_allocmask = ig->xi_allocmask; |