xfs: fix unreachable BIGTIME check in dquot flush validation
Subsystems (2)
PATCH 1/1 xfs: fix unreachable BIGTIME check in dquot flush validation
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.
--- fs/xfs/xfs_dquot.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/xfs/xfs_dquot.c +8 -8
@@ -1216,6 +1216,14 @@ xfs_qm_dqflush_check( type != XFS_DQTYPE_PROJ)return __this_address; +/* bigtime flag should never be set on root dquots */ +if (dqp->q_type &XFS_DQTYPE_BIGTIME ) { +if (!xfs_has_bigtime (dqp->q_mount)) +return __this_address; +if (dqp->q_id ==0 ) +return __this_address; + } +if (dqp->q_id ==0 )return NULL ;
@@ -1231,14 +1239,6 @@ xfs_qm_dqflush_check( !dqp->q_rtb.timer)return __this_address; -/* bigtime flag should never be set on root dquots */ -if (dqp->q_type &XFS_DQTYPE_BIGTIME ) { -if (!xfs_has_bigtime (dqp->q_mount)) -return __this_address; -if (dqp->q_id ==0 ) -return __this_address; - } -return NULL ; }
Signature · 1 line
2.43.0
[fix some addresses]
Quoted 10 lines · Alexey Nepomnyashih
The
dqp->q_id== 0 check inside theXFS_DQTYPE_BIGTIMEblock is unreachable because root dquots return successfully earlier. Reject root dquots withXFS_DQTYPE_BIGTIMEbefore that early return, preserving the intended validation and removing the unreachable condition.Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes 4ea1ff3b4968 ("xfs: widen ondisk quota expiration timestamps to handle y2038+")Cc [email protected] # v5.10+Signed-off-by Alexey Nepomnyashih <[email protected]>
Yeah, that looks like a screwup...
--D
Quoted 42 lines
--- fs/xfs/xfs_dquot.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)fs/xfs/xfs_dquot.c +8
-8@@ -1216,6 +1216,14 @@ xfs_qm_dqflush_check( type != XFS_DQTYPE_PROJ)return __this_address; +/* bigtime flag should never be set on root dquots */ +if (dqp->q_type &XFS_DQTYPE_BIGTIME ) { +if (!xfs_has_bigtime (dqp->q_mount)) +return __this_address; +if (dqp->q_id ==0 ) +return __this_address; + } +if (dqp->q_id ==0 )return NULL ;@@ -1231,14 +1239,6 @@ xfs_qm_dqflush_check( !dqp->q_rtb.timer)return __this_address; -/* bigtime flag should never be set on root dquots */ -if (dqp->q_type &XFS_DQTYPE_BIGTIME ) { -if (!xfs_has_bigtime (dqp->q_mount)) -return __this_address; -if (dqp->q_id ==0 ) -return __this_address; - } -return NULL ; }Signature · 1 line
2.43.0
Allison Henderson
Reviewed-byQuoted 13 lines · Darrick J. Wong
[fix some addresses]
Quoted 10 lines · Alexey Nepomnyashih
The
dqp->q_id== 0 check inside theXFS_DQTYPE_BIGTIMEblock is unreachable because root dquots return successfully earlier. Reject root dquots withXFS_DQTYPE_BIGTIMEbefore that early return, preserving the intended validation and removing the unreachable condition.Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes 4ea1ff3b4968 ("xfs: widen ondisk quota expiration timestamps to handle y2038+")Cc [email protected] # v5.10+Signed-off-by Alexey Nepomnyashih <[email protected]>
Hi Alexey,
Looks good, thanks for catching this!
Quoted 48 lines
Yeah, that looks like a screwup...
Reviewed-by "Darrick J. Wong" <[email protected]>--D
Quoted 42 lines
--- fs/xfs/xfs_dquot.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)fs/xfs/xfs_dquot.c +8
-8@@ -1216,6 +1216,14 @@ xfs_qm_dqflush_check( type != XFS_DQTYPE_PROJ)return __this_address; +/* bigtime flag should never be set on root dquots */ +if (dqp->q_type &XFS_DQTYPE_BIGTIME ) { +if (!xfs_has_bigtime (dqp->q_mount)) +return __this_address; +if (dqp->q_id ==0 ) +return __this_address; + } +if (dqp->q_id ==0 )return NULL ;@@ -1231,14 +1239,6 @@ xfs_qm_dqflush_check( !dqp->q_rtb.timer)return __this_address; -/* bigtime flag should never be set on root dquots */ -if (dqp->q_type &XFS_DQTYPE_BIGTIME ) { -if (!xfs_has_bigtime (dqp->q_mount)) -return __this_address; -if (dqp->q_id ==0 ) -return __this_address; - } -return NULL ; }Signature · 1 line
2.43.0
Quoted 8 lines · Alexey Nepomnyashih
The
dqp->q_id== 0 check inside theXFS_DQTYPE_BIGTIMEblock is unreachable because root dquots return successfully earlier. Reject root dquots withXFS_DQTYPE_BIGTIMEbefore that early return, preserving the intended validation and removing the unreachable condition.Found by Linux Verification Center (linuxtesting.org) with SVACE.
[...]
Applied to for-next, thanks!
[1/1] xfs: fix unreachable BIGTIME check in dquot flush validation
commit: 03866d130ed33ab68cc7faaf4bf2c4abef96d42e
Best regards,
Signature · 1 line
Carlos Maiolino <[email protected]>