[quota/f15/master] Fix ddquot buffer leak
Petr Pisar
ppisar at fedoraproject.org
Fri Mar 11 12:45:03 UTC 2011
commit d2366851f1a051a04d56fe6d8b530754fe8b8f9a
Author: Petr Písař <ppisar at redhat.com>
Date: Fri Mar 11 13:02:13 2011 +0100
Fix ddquot buffer leak
https://sourceforge.net/tracker/?func=detail&aid=3206267&group_id=18136&atid=118136
quota-4.00_pre1-Fix-ddquot-buffer-leak.patch | 41 ++++++++++++++++++++++++++
quota.spec | 9 +++++-
2 files changed, 49 insertions(+), 1 deletions(-)
---
diff --git a/quota-4.00_pre1-Fix-ddquot-buffer-leak.patch b/quota-4.00_pre1-Fix-ddquot-buffer-leak.patch
new file mode 100644
index 0000000..04d1350
--- /dev/null
+++ b/quota-4.00_pre1-Fix-ddquot-buffer-leak.patch
@@ -0,0 +1,41 @@
+From 797913a0c470da93d44201d074d343953a38589c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Fri, 11 Mar 2011 11:06:20 +0100
+Subject: [PATCH] Fix ddquot buffer leak
+
+The ddquot buffer is used to tranfer data from/to file. All its data are
+copied from/to it, so it's not needed after return from qtree_read_dquot()/
+qtree_write_dquot().
+---
+ quotaio_tree.c | 3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+diff --git a/quotaio_tree.c b/quotaio_tree.c
+index cdc0e8f..9f87889 100644
+--- a/quotaio_tree.c
++++ b/quotaio_tree.c
+@@ -272,6 +272,7 @@ void qtree_write_dquot(struct dquot *dquot)
+ lseek(dquot->dq_h->qh_fd, dquot->dq_dqb.u.v2_mdqb.dqb_off, SEEK_SET);
+ info->dqi_ops->mem2disk_dqblk(ddquot, dquot);
+ ret = write(dquot->dq_h->qh_fd, ddquot, info->dqi_entry_size);
++ free(ddquot);
+ if (ret != info->dqi_entry_size) {
+ if (ret > 0)
+ errno = ENOSPC;
+@@ -421,11 +422,13 @@ struct dquot *qtree_read_dquot(struct quota_handle *h, qid_t id)
+ if (ret != info->dqi_entry_size) {
+ if (ret > 0)
+ errno = EIO;
++ free(ddquot);
+ die(2, _("Cannot read quota structure for id %u: %s\n"), dquot->dq_id,
+ strerror(errno));
+ }
+ info->dqi_ops->disk2mem_dqblk(dquot, ddquot);
+ }
++ free(ddquot);
+ return dquot;
+ }
+
+--
+1.7.4
+
diff --git a/quota.spec b/quota.spec
index 627d90b..35198d1 100644
--- a/quota.spec
+++ b/quota.spec
@@ -5,7 +5,7 @@ Name: quota
Summary: System administration tools for monitoring users' disk usage
Epoch: 1
Version: 4.00
-Release: 0.8.pre1%{?dist}
+Release: 0.9.pre1%{?dist}
License: BSD and GPLv2+
URL: http://sourceforge.net/projects/linuxquota/
Group: System Environment/Base
@@ -60,6 +60,9 @@ Patch20: quota-4.00_pre1-Add-quotasync-tool.patch
Patch21: quota-4.00_pre1-Implement-quotacheck-for-GFS2.patch
# Bug 668688, submitted to upstream
Patch22: quota-4.00_pre1-Initialize-vfsold-block-and-inode-value-boundries-fo.patch
+# Bug #684189, submitted to upstream, SF#3206267
+Patch23: quota-4.00_pre1-Fix-ddquot-buffer-leak.patch
+
%description
The quota package contains system administration tools for monitoring
@@ -152,6 +155,7 @@ Linux/UNIX environment.
%patch20 -p1 -b .add_quotasync
%patch21 -p1 -b .gfs2_quotacheck
%patch22 -p1 -b .inizialize_vfsold_boundries
+%patch23 -p1 -b .fix_ddquot_leak
# quotactl(2) moved into `man-pages' package (bug #640590)
rm -f quotactl.2
# remove VCS files
@@ -274,6 +278,9 @@ rm -rf %{buildroot}
%changelog
+* Fri Mar 11 2011 Petr Pisar <ppisar at redhat.com> - 1:4.00-0.9.pre1
+- Fix ddquot buffer leak (bug #684189)
+
* Wed Feb 09 2011 Petr Pisar <ppisar at redhat.com> - 1:4.00-0.8.pre1
- Initialize vfsold block and inode value boundries for new quota file
(bug #668688)
More information about the scm-commits
mailing list