]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: don't wrap ID in xfs_dq_get_next_id
authorEric Sandeen <sandeen@redhat.com>
Tue, 17 Jan 2017 19:43:38 +0000 (11:43 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Tue, 17 Jan 2017 19:43:38 +0000 (11:43 -0800)
commit2cdfa52381a2a8afbcdcd4c1548ae40a380d41de
tree29ed1abcffe747d94c6e26959eed1aaf320c5755
parent9626cb1b249dc2b8cd9b9016b242b0eb633fa78c
xfs: don't wrap ID in xfs_dq_get_next_id

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@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_dquot.c