|
|
ecf77e |
From 1806ee01060d363beac01fda28c613ab27dbc4df Mon Sep 17 00:00:00 2001
|
|
|
ecf77e |
From: Jan Kara <jack@suse.cz>
|
|
|
ecf77e |
Date: Wed, 10 Jan 2018 10:18:43 +0100
|
|
|
ecf77e |
Subject: [PATCH] repquota: Fix output when user -2 exists
|
|
|
ecf77e |
MIME-Version: 1.0
|
|
|
ecf77e |
Content-Type: text/plain; charset=UTF-8
|
|
|
ecf77e |
Content-Transfer-Encoding: 8bit
|
|
|
ecf77e |
|
|
|
ecf77e |
Vladimit Meshkov reported that when user -2 exists and user namespaces
|
|
|
ecf77e |
are enabled in the kernel, repquota(8) fails to output anything. He also
|
|
|
ecf77e |
analyzed this is because in such case repquota(8) tries to query info
|
|
|
ecf77e |
for user -1 which is invalid ID, gets error from the kernel, and bails
|
|
|
ecf77e |
out.
|
|
|
ecf77e |
|
|
|
ecf77e |
Fix the problem by stopping iteration over IDs when we reach ID -1.
|
|
|
ecf77e |
|
|
|
ecf77e |
Reported-by: Vladimir Meshkov <ubob74@gmail.com>
|
|
|
ecf77e |
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
ecf77e |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
ecf77e |
---
|
|
|
ecf77e |
quotaio_generic.c | 5 +++++
|
|
|
ecf77e |
quotaio_xfs.c | 5 +++++
|
|
|
ecf77e |
2 files changed, 10 insertions(+)
|
|
|
ecf77e |
|
|
|
ecf77e |
diff --git a/quotaio_generic.c b/quotaio_generic.c
|
|
|
ecf77e |
index 025d712..5b23955 100644
|
|
|
ecf77e |
--- a/quotaio_generic.c
|
|
|
ecf77e |
+++ b/quotaio_generic.c
|
|
|
ecf77e |
@@ -204,6 +204,11 @@ int vfs_scan_dquots(struct quota_handle *h,
|
|
|
ecf77e |
if (ret < 0)
|
|
|
ecf77e |
break;
|
|
|
ecf77e |
id = kdqblk.dqb_id + 1;
|
|
|
ecf77e |
+ /* id -1 is invalid and the last one... */
|
|
|
ecf77e |
+ if (id == -1) {
|
|
|
ecf77e |
+ errno = ENOENT;
|
|
|
ecf77e |
+ break;
|
|
|
ecf77e |
+ }
|
|
|
ecf77e |
}
|
|
|
ecf77e |
free(dquot);
|
|
|
ecf77e |
|
|
|
ecf77e |
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
|
|
|
ecf77e |
index 1374cf4..56daf89 100644
|
|
|
ecf77e |
--- a/quotaio_xfs.c
|
|
|
ecf77e |
+++ b/quotaio_xfs.c
|
|
|
ecf77e |
@@ -219,6 +219,11 @@ static int xfs_kernel_scan_dquots(struct quota_handle *h,
|
|
|
ecf77e |
if (ret < 0)
|
|
|
ecf77e |
break;
|
|
|
ecf77e |
id = xdqblk.d_id + 1;
|
|
|
ecf77e |
+ /* id -1 is invalid and the last one... */
|
|
|
ecf77e |
+ if (id == -1) {
|
|
|
ecf77e |
+ errno = ENOENT;
|
|
|
ecf77e |
+ break;
|
|
|
ecf77e |
+ }
|
|
|
ecf77e |
}
|
|
|
ecf77e |
free(dquot);
|
|
|
ecf77e |
|
|
|
ecf77e |
--
|
|
|
ecf77e |
2.13.6
|
|
|
ecf77e |
|