[PATCH 10/12] HPPFS: don't open a file when it stays unused

From: Paolo 'Blaisorblade' Giarrusso
Date: Sun Sep 18 2005 - 09:25:10 EST


From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@xxxxxxxx>

hppfs_follow_link() and hppfs_readlink() open the file but then doesn't use it,
apart for fput().

I assume that dropping this dentry_open doesn't remove any needed permission
checking.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@xxxxxxxx>
---

fs/hppfs/hppfs_kern.c | 12 ------------
1 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/fs/hppfs/hppfs_kern.c b/fs/hppfs/hppfs_kern.c
--- a/fs/hppfs/hppfs_kern.c
+++ b/fs/hppfs/hppfs_kern.c
@@ -745,15 +745,11 @@ static struct super_operations hppfs_sbo

static int hppfs_readlink(struct dentry *dentry, char __user *buffer, int buflen)
{
- struct file *proc_file;
struct dentry *proc_dentry;
int (*readlink)(struct dentry *, char __user *, int);
int ret;

proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
- proc_file = dentry_open(dget(proc_dentry), mntget(proc_submnt), O_RDONLY);
- if (IS_ERR(proc_file))
- return PTR_ERR(proc_file);

readlink = proc_dentry->d_inode->i_op->readlink;
if (readlink == NULL)
@@ -761,22 +757,16 @@ static int hppfs_readlink(struct dentry
ret = (*readlink)(proc_dentry, buffer, buflen);
ret = proc_dentry->d_inode->i_op->readlink(proc_dentry, buffer, buflen);

- fput(proc_file);
-
return ret;
}

static void* hppfs_follow_link(struct dentry *dentry, struct nameidata *nd)
{
- struct file *proc_file;
struct dentry *proc_dentry;
void * (*follow_link)(struct dentry *, struct nameidata *);
void *ret;

proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
- proc_file = dentry_open(dget(proc_dentry), mntget(proc_submnt), O_RDONLY);
- if (IS_ERR(proc_file))
- return proc_file;

follow_link = proc_dentry->d_inode->i_op->follow_link;

@@ -788,8 +778,6 @@ static void* hppfs_follow_link(struct de

ret = follow_link(proc_dentry, nd);

- fput(proc_file);
-
return ret;
}


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/