diff --git a/quota-4.04-repquota-Fix-output-when-user-2-exists.patch b/quota-4.04-repquota-Fix-output-when-user-2-exists.patch new file mode 100644 index 0000000..285c5d1 --- /dev/null +++ b/quota-4.04-repquota-Fix-output-when-user-2-exists.patch @@ -0,0 +1,59 @@ +From 1806ee01060d363beac01fda28c613ab27dbc4df Mon Sep 17 00:00:00 2001 +From: Jan Kara +Date: Wed, 10 Jan 2018 10:18:43 +0100 +Subject: [PATCH] repquota: Fix output when user -2 exists +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Vladimit Meshkov reported that when user -2 exists and user namespaces +are enabled in the kernel, repquota(8) fails to output anything. He also +analyzed this is because in such case repquota(8) tries to query info +for user -1 which is invalid ID, gets error from the kernel, and bails +out. + +Fix the problem by stopping iteration over IDs when we reach ID -1. + +Reported-by: Vladimir Meshkov +Signed-off-by: Jan Kara +Signed-off-by: Petr Písař +--- + quotaio_generic.c | 5 +++++ + quotaio_xfs.c | 5 +++++ + 2 files changed, 10 insertions(+) + +diff --git a/quotaio_generic.c b/quotaio_generic.c +index 025d712..5b23955 100644 +--- a/quotaio_generic.c ++++ b/quotaio_generic.c +@@ -204,6 +204,11 @@ int vfs_scan_dquots(struct quota_handle *h, + if (ret < 0) + break; + id = kdqblk.dqb_id + 1; ++ /* id -1 is invalid and the last one... */ ++ if (id == -1) { ++ errno = ENOENT; ++ break; ++ } + } + free(dquot); + +diff --git a/quotaio_xfs.c b/quotaio_xfs.c +index 1374cf4..56daf89 100644 +--- a/quotaio_xfs.c ++++ b/quotaio_xfs.c +@@ -219,6 +219,11 @@ static int xfs_kernel_scan_dquots(struct quota_handle *h, + if (ret < 0) + break; + id = xdqblk.d_id + 1; ++ /* id -1 is invalid and the last one... */ ++ if (id == -1) { ++ errno = ENOENT; ++ break; ++ } + } + free(dquot); + +-- +2.13.6 + diff --git a/quota.spec b/quota.spec index 433643e..91e2b9e 100644 --- a/quota.spec +++ b/quota.spec @@ -57,6 +57,9 @@ Patch2: quota-4.04-Install-rquota-3-only-if-RPC-is-enabled.patch # Pass TIRPC header files location to all RPC compilation units, # Patch3: quota-4.04-Add-TIRPC_CFLAGS-globally-to-CFLAGS-for-RPC-support-.patch +# Do not iterate over negative UIDs in repquota, +# , in upstream after 4.04 +Patch4: quota-4.04-repquota-Fix-output-when-user-2-exists.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: bash @@ -174,6 +177,7 @@ Linux/UNIX environment. %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 # Regenerate build scripts autoreconf -f -i @@ -321,6 +325,7 @@ make check * Mon Feb 05 2018 Petr Pisar - 1:4.04-3 - rpcgen tool split from glibc-common package - Pass TIRPC header files location to all RPC compilation units +- Do not iterate over negative UIDs in repquota * Thu Nov 30 2017 Petr Pisar - 1:4.04-2 - Disable TCP wrappers (bug #1518778)