public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: fix quotacheck dquot id overflow infinite loop
@ 2017-07-24 15:02 Brian Foster
  2017-07-24 15:33 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Foster @ 2017-07-24 15:02 UTC (permalink / raw)
  To: linux-xfs

If a dquot has an id of U32_MAX, the next lookup index increment
overflows the uint32_t back to 0. This starts the lookup sequence
over from the beginning, repeats indefinitely and results in a
livelock.

Update xfs_qm_dquot_walk() to explicitly check for the lookup
overflow and exit the loop.

Signed-off-by: Brian Foster <bfoster@redhat.com>
---
 fs/xfs/xfs_qm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 6ce948c..15751dc 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -111,6 +111,9 @@ xfs_qm_dquot_walk(
 			skipped = 0;
 			break;
 		}
+		/* we're done if id overflows back to zero */
+		if (!next_index)
+			break;
 	}
 
 	if (skipped) {
-- 
2.9.4


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

* Re: [PATCH] xfs: fix quotacheck dquot id overflow infinite loop
  2017-07-24 15:02 [PATCH] xfs: fix quotacheck dquot id overflow infinite loop Brian Foster
@ 2017-07-24 15:33 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2017-07-24 15:33 UTC (permalink / raw)
  To: Brian Foster; +Cc: linux-xfs

On Mon, Jul 24, 2017 at 11:02:29AM -0400, Brian Foster wrote:
> If a dquot has an id of U32_MAX, the next lookup index increment
> overflows the uint32_t back to 0. This starts the lookup sequence
> over from the beginning, repeats indefinitely and results in a
> livelock.
> 
> Update xfs_qm_dquot_walk() to explicitly check for the lookup
> overflow and exit the loop.
> 
> Signed-off-by: Brian Foster <bfoster@redhat.com>

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_qm.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index 6ce948c..15751dc 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -111,6 +111,9 @@ xfs_qm_dquot_walk(
>  			skipped = 0;
>  			break;
>  		}
> +		/* we're done if id overflows back to zero */
> +		if (!next_index)
> +			break;
>  	}
>  
>  	if (skipped) {
> -- 
> 2.9.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2017-07-24 15:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-24 15:02 [PATCH] xfs: fix quotacheck dquot id overflow infinite loop Brian Foster
2017-07-24 15:33 ` Darrick J. Wong

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