diff --git a/quota-4.04-convertquota-Fix-a-file-descriptor-leak-in-convert_e.patch b/quota-4.04-convertquota-Fix-a-file-descriptor-leak-in-convert_e.patch new file mode 100644 index 0000000..e8f7ba0 --- /dev/null +++ b/quota-4.04-convertquota-Fix-a-file-descriptor-leak-in-convert_e.patch @@ -0,0 +1,29 @@ +From 78403029375dbfe809b5b1034301dc687a94397f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Thu, 23 Aug 2018 11:09:10 +0200 +Subject: [PATCH 1/3] convertquota: Fix a file descriptor leak in + convert_endian() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Písař +--- + convertquota.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/convertquota.c b/convertquota.c +index d913e05..6c8a553 100644 +--- a/convertquota.c ++++ b/convertquota.c +@@ -363,6 +363,7 @@ static int convert_endian(int type, struct mount_entry *mnt) + } + ret = endian_scan_structures(ofd, type); + end_io(qn); ++ close(ofd); + if (ret < 0) + return ret; + +-- +2.14.4 + diff --git a/quota-4.04-quotackeck-Fix-a-directory-descriptor-leak-in-scan_d.patch b/quota-4.04-quotackeck-Fix-a-directory-descriptor-leak-in-scan_d.patch new file mode 100644 index 0000000..341ce6c --- /dev/null +++ b/quota-4.04-quotackeck-Fix-a-directory-descriptor-leak-in-scan_d.patch @@ -0,0 +1,28 @@ +From 0f255ef2570478a855361937445a57a168c8629d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Thu, 23 Aug 2018 11:23:43 +0200 +Subject: [PATCH 2/3] quotackeck: Fix a directory descriptor leak in scan_dir() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Písař +--- + quotacheck.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/quotacheck.c b/quotacheck.c +index fd01dfc..2cdf475 100644 +--- a/quotacheck.c ++++ b/quotacheck.c +@@ -538,6 +538,7 @@ static int scan_dir(const char *pathname) + if ((lstat(de->d_name, &st)) == -1) { + errstr(_("lstat: Cannot stat `%s/%s': %s\nGuess you'd better run fsck first !\nexiting...\n"), + pathname, de->d_name, strerror(errno)); ++ closedir(dp); + goto out; + } + +-- +2.14.4 + diff --git a/quota-4.04-xqmstats-Fix-a-file-descriptor-leak-in-main.patch b/quota-4.04-xqmstats-Fix-a-file-descriptor-leak-in-main.patch new file mode 100644 index 0000000..797fc3f --- /dev/null +++ b/quota-4.04-xqmstats-Fix-a-file-descriptor-leak-in-main.patch @@ -0,0 +1,28 @@ +From 869f514310b72169a294baa37f5a90a291f719f3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Thu, 23 Aug 2018 11:51:47 +0200 +Subject: [PATCH 3/3] xqmstats: Fix a file descriptor leak in main() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Písař +--- + xqmstats.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/xqmstats.c b/xqmstats.c +index cdac4a6..59b1d66 100644 +--- a/xqmstats.c ++++ b/xqmstats.c +@@ -35,6 +35,7 @@ int main(int argc, char **argv) + if ((stats = fopen(XQMSTATS, "r")) == NULL) { + if ((stats = fopen(STATFILE, "r")) == NULL) { + errstr(_("The running kernel does not support XFS\n")); ++ fclose(xqm); + return 1; + } + } +-- +2.14.4 + diff --git a/quota.spec b/quota.spec index cdc241d..e3f42cc 100644 --- a/quota.spec +++ b/quota.spec @@ -10,7 +10,7 @@ Name: quota Epoch: 1 Version: 4.04 -Release: 9%{?dist} +Release: 10%{?dist} Summary: System administration tools for monitoring users' disk usage # quota_nld.c, quotaio_xfs.h: GPLv2 # bylabel.c copied from util-linux: GPLv2+ @@ -83,6 +83,15 @@ Patch11: quota-4.04-rpc-Fix-wrong-limit-for-space-usage.patch # tool output, proposed to upstream, # Patch12: quota-4.04-quota-1-Distinguish-between-none-quota-limits-and-no.patch +# Fix a descriptor leak, proposed to upstream, +# +Patch13: quota-4.04-convertquota-Fix-a-file-descriptor-leak-in-convert_e.patch +# Fix a descriptor leak, proposed to upstream, +# +Patch14: quota-4.04-quotackeck-Fix-a-directory-descriptor-leak-in-scan_d.patch +# Fix a descriptor leak, proposed to upstream, +# +Patch15: quota-4.04-xqmstats-Fix-a-file-descriptor-leak-in-main.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: bash @@ -209,6 +218,9 @@ Linux/UNIX environment. %patch10 -p1 %patch11 -p1 %patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 # Regenerate build scripts autoreconf -f -i @@ -353,6 +365,9 @@ make check %changelog +* Thu Aug 23 2018 Petr Pisar - 1:4.04-10 +- Fix file descriptor leaks in error code paths + * Tue Jul 24 2018 Petr Pisar - 1:4.04-9 - Distinguish between none quota limits and no allocated resources in quota(1) tool output