* [PATCH] memory leak in dentry_open()
@ 2005-11-03 21:09 Peter Staubach
0 siblings, 0 replies; only message in thread
From: Peter Staubach @ 2005-11-03 21:09 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: Andrew Morton
[-- Attachment #1: Type: text/plain, Size: 310 bytes --]
Hi.
There is a memory leak possible in dentry_open(). If get_empty_filp()
fails, then the references to dentry and mnt need to be released.
The attached patch adds the calls to dput() and mntput() to release
these two references.
Thanx...
ps
Signed-off-by: Peter Staubach <staubach@redhat.com>
[-- Attachment #2: open-enfile.devel --]
[-- Type: text/plain, Size: 322 bytes --]
--- linux-2.6.14/fs/open.c.org
+++ linux-2.6.14/fs/open.c
@@ -894,8 +894,11 @@ struct file *dentry_open(struct dentry *
error = -ENFILE;
f = get_empty_filp();
- if (f == NULL)
+ if (f == NULL) {
+ dput(dentry);
+ mntput(mnt);
return ERR_PTR(error);
+ }
return __dentry_open(dentry, mnt, flags, f, NULL);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-11-03 21:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-03 21:09 [PATCH] memory leak in dentry_open() Peter Staubach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox