Unverified Commit a707c289 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!3363 xfs: fix some misc issue

Merge Pull Request from: @ci-robot 
 
PR sync from: Long Li <leo.lilong@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/YMWZ4RV54VRKXBJCKLWBSLPNS2VATNI2/ 
his patch set fix some mics xfs issue:

Long Li (4):
  xfs: fix a UAF when inode item push
  xfs: fix a UAF in xfs_iflush_abort_clean
  xfs: don't verify agf length when log recovery
  xfs: xfs_trans_cancel() path must check for log shutdown


-- 
2.31.1
 
https://gitee.com/openeuler/kernel/issues/I8LHTR 
 
Link:https://gitee.com/openeuler/kernel/pulls/3363

 

Reviewed-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parents e4a4ee5f 013a3caa
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2980,7 +2980,8 @@ xfs_validate_ag_length(
	 * Only the last AG in the filesystem is allowed to be shorter
	 * than the AG size recorded in the superblock.
	 */
	if (length != mp->m_sb.sb_agblocks) {
	if (length != mp->m_sb.sb_agblocks &&
		!(bp->b_flags & _XBF_LOGRECOVERY)) {
		/*
		 * During growfs, the new last AG can get here before we
		 * have updated the superblock. Give it a pass on the seqno
+5 −0
Original line number Diff line number Diff line
@@ -554,6 +554,11 @@ xfs_buf_find_lock(
		XFS_STATS_INC(bp->b_mount, xb_get_locked_waited);
	}

	if (xlog_is_shutdown(bp->b_mount->m_log)) {
		xfs_buf_unlock(bp);
		return -EIO;
	}

	/*
	 * if the buffer is stale, clear all the external state associated with
	 * it. We need to keep flags such as how we allocated the buffer memory
+7 −1
Original line number Diff line number Diff line
@@ -712,9 +712,14 @@ xfs_inode_item_push(
	if (xfs_iflags_test(ip, XFS_IFLUSHING))
		return XFS_ITEM_FLUSHING;

	if (!xfs_buf_trylock(bp))
	if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED))
		return XFS_ITEM_LOCKED;

	if (!xfs_buf_trylock(bp)) {
		xfs_iunlock(ip, XFS_ILOCK_SHARED);
		return XFS_ITEM_LOCKED;
	}

	spin_unlock(&lip->li_ailp->ail_lock);

	/*
@@ -740,6 +745,7 @@ xfs_inode_item_push(
	}

	spin_lock(&lip->li_ailp->ail_lock);
	xfs_iunlock(ip, XFS_ILOCK_SHARED);
	return rval;
}

+1 −1
Original line number Diff line number Diff line
@@ -1100,7 +1100,7 @@ xfs_trans_cancel(
	 * progress, so we only need to check against the mount shutdown state
	 * here.
	 */
	if (dirty && !xfs_is_shutdown(mp)) {
	if (dirty && !(xfs_is_shutdown(mp) && xlog_is_shutdown(log))) {
		XFS_ERROR_REPORT("xfs_trans_cancel", XFS_ERRLEVEL_LOW, mp);
		xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
	}