Skip to content

Commit dd8d066

Browse files
Alexey Nepomnyashihgregkh
authored andcommitted
xfs: fix unreachable BIGTIME check in dquot flush validation
commit 03866d1 upstream. The dqp->q_id == 0 check inside the XFS_DQTYPE_BIGTIME block is unreachable because root dquots return successfully earlier. Reject root dquots with XFS_DQTYPE_BIGTIME before that early return, preserving the intended validation and removing the unreachable condition. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 4ea1ff3 ("xfs: widen ondisk quota expiration timestamps to handle y2038+") Cc: stable@vger.kernel.org # v5.10+ Signed-off-by: Alexey Nepomnyashih <sdl@nppct.ru> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Allison Henderson <achender@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9366186 commit dd8d066

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

fs/xfs/xfs_dquot.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,14 @@ xfs_qm_dqflush_check(
12411241
type != XFS_DQTYPE_PROJ)
12421242
return __this_address;
12431243

1244+
/* bigtime flag should never be set on root dquots */
1245+
if (dqp->q_type & XFS_DQTYPE_BIGTIME) {
1246+
if (!xfs_has_bigtime(dqp->q_mount))
1247+
return __this_address;
1248+
if (dqp->q_id == 0)
1249+
return __this_address;
1250+
}
1251+
12441252
if (dqp->q_id == 0)
12451253
return NULL;
12461254

@@ -1256,14 +1264,6 @@ xfs_qm_dqflush_check(
12561264
!dqp->q_rtb.timer)
12571265
return __this_address;
12581266

1259-
/* bigtime flag should never be set on root dquots */
1260-
if (dqp->q_type & XFS_DQTYPE_BIGTIME) {
1261-
if (!xfs_has_bigtime(dqp->q_mount))
1262-
return __this_address;
1263-
if (dqp->q_id == 0)
1264-
return __this_address;
1265-
}
1266-
12671267
return NULL;
12681268
}
12691269

0 commit comments

Comments
 (0)