Re: [PATCH] xfs: don't wrap ID in xfs_dq_get_next_id

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/16/16 6:05 PM, Eric Sandeen wrote:
> The GETNEXTQOTA ioctl takes whatever ID is sent in,
> and looks for the next active quota for an user
> equal or higher to that ID.
> 
> But if we are at the maximum ID and then ask for the "next"
> one, we may wrap back to zero.  In this case, userspace
> may loop forever, because it will start querying again
> at zero.
> 
> We'll fix this in userspace as well, but for the kernel,
> return -ENOENT if we ask for the next quota ID
> past UINT_MAX so the caller knows to stop.
> 
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>

Ping on this?  sorry for not noticing its absence sooner.
Has rvb:hch on the thread.

-Eric

> ---
> 
> diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
> index 7a30b8f..dbeddd9 100644
> --- a/fs/xfs/xfs_dquot.c
> +++ b/fs/xfs/xfs_dquot.c
> @@ -710,6 +710,10 @@
>  	/* Simple advance */
>  	next_id = *id + 1;
>  
> +	/* If we'd wrap past the max ID, stop */
> +	if (next_id < *id)
> +		return -ENOENT;
> +
>  	/* If new ID is within the current chunk, advancing it sufficed */
>  	if (next_id % mp->m_quotainfo->qi_dqperchunk) {
>  		*id = next_id;
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux