From: Kirill Korotaev <dev@openvz.org>
To: Andrew Morton <akpm@osdl.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
devel@openvz.org, Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Subject: [PATCH] fdset's leakage
Date: Mon, 10 Jul 2006 17:40:51 +0400 [thread overview]
Message-ID: <44B258E3.7070708@openvz.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 453 bytes --]
Andrew,
Another patch from Alexey Kuznetsov fixing memory leak in alloc_fdtable().
[PATCH] fdset's leakage
When found, it is obvious. nfds calculated when allocating fdsets
is rewritten by calculation of size of fdtable, and when we are
unlucky, we try to free fdsets of wrong size.
Found due to OpenVZ resource management (User Beancounters).
Signed-Off-By: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Signed-Off-By: Kirill Korotaev <dev@openvz.org>
[-- Attachment #2: diff-fdset-leakage --]
[-- Type: text/plain, Size: 523 bytes --]
diff -urp linux-2.6-orig/fs/file.c linux-2.6/fs/file.c
--- linux-2.6-orig/fs/file.c 2006-07-10 12:10:51.000000000 +0400
+++ linux-2.6/fs/file.c 2006-07-10 14:47:01.000000000 +0400
@@ -277,11 +277,13 @@ static struct fdtable *alloc_fdtable(int
} while (nfds <= nr);
new_fds = alloc_fd_array(nfds);
if (!new_fds)
- goto out;
+ goto out2;
fdt->fd = new_fds;
fdt->max_fds = nfds;
fdt->free_files = NULL;
return fdt;
+out2:
+ nfds = fdt->max_fdset;
out:
if (new_openset)
free_fdset(new_openset, nfds);
next reply other threads:[~2006-07-10 13:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-10 13:40 Kirill Korotaev [this message]
2006-07-11 8:01 ` [PATCH] fdset's leakage Andrew Morton
2006-07-11 9:02 ` Rene Scharfe
2006-07-11 9:05 ` Kirill Korotaev
2006-07-11 9:28 ` Andrew Morton
2006-07-11 16:13 ` Vadim Lobanov
2006-07-11 17:26 ` Eric Dumazet
2006-07-12 10:49 ` Kirill Korotaev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44B258E3.7070708@openvz.org \
--to=dev@openvz.org \
--cc=akpm@osdl.org \
--cc=devel@openvz.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox