Commit 9b8aa37f authored by Guo Xuenan's avatar Guo Xuenan Committed by Long Li
Browse files

Revert "[Huawei] xfs: fix uaf when leaf dir bestcount not match with dir data blocks"

Offering: HULK
hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I76JSK



--------------------------------

This reverts commit 1768d0fc.

Signed-off-by: default avatarGuo Xuenan <guoxuenan@huawei.com>
Signed-off-by: default avatarLong Li <leo.lilong@huawei.com>
parent a3fd05c4
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -815,18 +815,6 @@ xfs_dir2_leaf_addname(
		 */
		else
			xfs_dir3_leaf_log_bests(args, lbp, use_block, use_block);
		/*
		 * An abnormal corner case, bestfree count less than data
		 * blocks, add a condition to avoid UAF or slab-out-of bound.
		 */
		if ((char *)(&bestsp[use_block]) >= (char *)ltp) {
			xfs_trans_brelse(tp, lbp);
			if (tp->t_flags & XFS_TRANS_DIRTY)
				xfs_force_shutdown(tp->t_mountp,
						SHUTDOWN_CORRUPT_INCORE);
			return -EFSCORRUPTED;
		}

		hdr = dbp->b_addr;
		bf = xfs_dir2_data_bestfree_p(dp->i_mount, hdr);
		bestsp[use_block] = bf[0].length;