mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] xfs: fix unreachable BIGTIME check in dquot flush validation
@ 2026-06-03 20:41 Alexey Nepomnyashih
  2026-06-03 21:08 ` Darrick J. Wong
  2026-06-09  7:26 ` Carlos Maiolino
  0 siblings, 2 replies; 4+ messages in thread
From: Alexey Nepomnyashih @ 2026-06-03 20:41 UTC (permalink / raw)
  To: Carlos Maiolino
  Cc: Alexey Nepomnyashih, Darrick J. Wong, Allison Collins,
	Dave Chinner, linux-xfs, linux-kernel, lvc-project, stable

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: 4ea1ff3b4968 ("xfs: widen ondisk quota expiration timestamps to handle y2038+")
Cc: stable@vger.kernel.org # v5.10+
Signed-off-by: Alexey Nepomnyashih <sdl@nppct.ru>
---
 fs/xfs/xfs_dquot.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index 69e9bc588c8b..c311f61d9554 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -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;
 }
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: fix unreachable BIGTIME check in dquot flush validation
  2026-06-03 20:41 [PATCH] xfs: fix unreachable BIGTIME check in dquot flush validation Alexey Nepomnyashih
@ 2026-06-03 21:08 ` Darrick J. Wong
  2026-06-05  4:18   ` Allison Henderson
  2026-06-09  7:26 ` Carlos Maiolino
  1 sibling, 1 reply; 4+ messages in thread
From: Darrick J. Wong @ 2026-06-03 21:08 UTC (permalink / raw)
  To: Alexey Nepomnyashih
  Cc: Carlos Maiolino, Darrick J. Wong, Allison, Dave Chinner,
	linux-xfs, linux-kernel, lvc-project, stable

[fix some addresses]

On Wed, Jun 03, 2026 at 08:41:47PM +0000, Alexey Nepomnyashih wrote:
> 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: 4ea1ff3b4968 ("xfs: widen ondisk quota expiration timestamps to handle y2038+")
> Cc: stable@vger.kernel.org # v5.10+
> Signed-off-by: Alexey Nepomnyashih <sdl@nppct.ru>

Yeah, that looks like a screwup...
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_dquot.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
> index 69e9bc588c8b..c311f61d9554 100644
> --- a/fs/xfs/xfs_dquot.c
> +++ b/fs/xfs/xfs_dquot.c
> @@ -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;
>  }
>  
> -- 
> 2.43.0
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: fix unreachable BIGTIME check in dquot flush validation
  2026-06-03 21:08 ` Darrick J. Wong
@ 2026-06-05  4:18   ` Allison Henderson
  0 siblings, 0 replies; 4+ messages in thread
From: Allison Henderson @ 2026-06-05  4:18 UTC (permalink / raw)
  To: Darrick J. Wong, Alexey Nepomnyashih
  Cc: Carlos Maiolino, Dave Chinner, linux-xfs, linux-kernel,
	lvc-project, stable

On Wed, 2026-06-03 at 14:08 -0700, Darrick J. Wong wrote:
> [fix some addresses]
> 
> On Wed, Jun 03, 2026 at 08:41:47PM +0000, Alexey Nepomnyashih wrote:
> > 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: 4ea1ff3b4968 ("xfs: widen ondisk quota expiration timestamps to handle y2038+")
> > Cc: stable@vger.kernel.org # v5.10+
> > Signed-off-by: Alexey Nepomnyashih <sdl@nppct.ru>
Hi Alexey,

Looks good, thanks for catching this!
Reviewed-by: Allison Henderson <achender@kernel.org>

> 
> Yeah, that looks like a screwup...
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
> 
> --D
> 
> > ---
> >  fs/xfs/xfs_dquot.c | 16 ++++++++--------
> >  1 file changed, 8 insertions(+), 8 deletions(-)
> > 
> > diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
> > index 69e9bc588c8b..c311f61d9554 100644
> > --- a/fs/xfs/xfs_dquot.c
> > +++ b/fs/xfs/xfs_dquot.c
> > @@ -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;
> >  }
> >  
> > -- 
> > 2.43.0
> > 
> > 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: fix unreachable BIGTIME check in dquot flush validation
  2026-06-03 20:41 [PATCH] xfs: fix unreachable BIGTIME check in dquot flush validation Alexey Nepomnyashih
  2026-06-03 21:08 ` Darrick J. Wong
@ 2026-06-09  7:26 ` Carlos Maiolino
  1 sibling, 0 replies; 4+ messages in thread
From: Carlos Maiolino @ 2026-06-09  7:26 UTC (permalink / raw)
  To: Alexey Nepomnyashih
  Cc: Darrick J. Wong, Allison Collins, Dave Chinner, linux-xfs,
	linux-kernel, lvc-project, stable

On Wed, 03 Jun 2026 20:41:47 +0000, Alexey Nepomnyashih wrote:
> 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.
> 
> [...]

Applied to for-next, thanks!

[1/1] xfs: fix unreachable BIGTIME check in dquot flush validation
      commit: 03866d130ed33ab68cc7faaf4bf2c4abef96d42e

Best regards,
-- 
Carlos Maiolino <cem@kernel.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-06-09  7:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-03 20:41 [PATCH] xfs: fix unreachable BIGTIME check in dquot flush validation Alexey Nepomnyashih
2026-06-03 21:08 ` Darrick J. Wong
2026-06-05  4:18   ` Allison Henderson
2026-06-09  7:26 ` Carlos Maiolino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®