* [PATCH (resend)] fs: Fix dentry leak at dentry_open().
@ 2011-01-19 0:42 Tetsuo Handa
2011-01-19 9:08 ` Al Viro
0 siblings, 1 reply; 3+ messages in thread
From: Tetsuo Handa @ 2011-01-19 0:42 UTC (permalink / raw)
To: linux-fsdevel
>From fa9c553a609cd2aa6703d733ced5e727896ac176 Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date: Thu, 16 Sep 2010 18:37:42 +0900
Subject: [PATCH] fs: Fix dentry leak at dentry_open().
dentry_open() says that it will have done dput(dentry) and mntput(mnt)
if it returns an error. But it was not calling dput(dentry) when mnt == NULL.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
fs/open.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/fs/open.c b/fs/open.c
index d74e198..501fda2 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -815,6 +815,7 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags,
if (!mnt) {
printk(KERN_WARNING "%s called with NULL vfsmount\n", __func__);
dump_stack();
+ dput(dentry);
return ERR_PTR(-EINVAL);
}
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH (resend)] fs: Fix dentry leak at dentry_open().
2011-01-19 0:42 [PATCH (resend)] fs: Fix dentry leak at dentry_open() Tetsuo Handa
@ 2011-01-19 9:08 ` Al Viro
2011-01-19 12:08 ` Tetsuo Handa
0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2011-01-19 9:08 UTC (permalink / raw)
To: Tetsuo Handa; +Cc: linux-fsdevel
On Wed, Jan 19, 2011 at 09:42:22AM +0900, Tetsuo Handa wrote:
> >From fa9c553a609cd2aa6703d733ced5e727896ac176 Mon Sep 17 00:00:00 2001
> From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Date: Thu, 16 Sep 2010 18:37:42 +0900
> Subject: [PATCH] fs: Fix dentry leak at dentry_open().
>
> dentry_open() says that it will have done dput(dentry) and mntput(mnt)
> if it returns an error. But it was not calling dput(dentry) when mnt == NULL.
NAK. Turn that into BUG_ON(!mnt) and be done with that.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH (resend)] fs: Fix dentry leak at dentry_open().
2011-01-19 9:08 ` Al Viro
@ 2011-01-19 12:08 ` Tetsuo Handa
0 siblings, 0 replies; 3+ messages in thread
From: Tetsuo Handa @ 2011-01-19 12:08 UTC (permalink / raw)
To: viro; +Cc: linux-fsdevel
Al Viro wrote:
> NAK. Turn that into BUG_ON(!mnt) and be done with that.
I see. Here is the updated patch.
----------------------------------------
>From b2618c1cf48cd817f5d0d10816e161282870ef46 Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date: Tue, 18 Jan 2011 23:05:39 +0900
Subject: [PATCH] fs: Use BUG_ON(!mnt) at dentry_open().
dentry_open() requires callers to pass a valid vfsmount.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
fs/open.c | 13 ++-----------
1 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/fs/open.c b/fs/open.c
index e52389e..137ab87 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -811,17 +811,8 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags,
validate_creds(cred);
- /*
- * We must always pass in a valid mount pointer. Historically
- * callers got away with not passing it, but we must enforce this at
- * the earliest possible point now to avoid strange problems deep in the
- * filesystem stack.
- */
- if (!mnt) {
- printk(KERN_WARNING "%s called with NULL vfsmount\n", __func__);
- dump_stack();
- return ERR_PTR(-EINVAL);
- }
+ /* We must always pass in a valid mount pointer. */
+ BUG_ON(!mnt);
error = -ENFILE;
f = get_empty_filp();
--
1.6.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-01-19 12:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-19 0:42 [PATCH (resend)] fs: Fix dentry leak at dentry_open() Tetsuo Handa
2011-01-19 9:08 ` Al Viro
2011-01-19 12:08 ` Tetsuo Handa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).