[PATCH] hppfs: fix symlink error path
While touching this code I noticed the error handling is bogus, so I fixed it up. I've removed the IS_ERR(proc_dentry) check, which will never trigger and is clearly a typo: we must check proc_file instead. Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
d7a60d50d7
commit
fd589e0b66
@ -38,7 +38,7 @@ struct hppfs_inode_info {
|
|||||||
|
|
||||||
static inline struct hppfs_inode_info *HPPFS_I(struct inode *inode)
|
static inline struct hppfs_inode_info *HPPFS_I(struct inode *inode)
|
||||||
{
|
{
|
||||||
return(list_entry(inode, struct hppfs_inode_info, vfs_inode));
|
return container_of(inode, struct hppfs_inode_info, vfs_inode);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define HPPFS_SUPER_MAGIC 0xb00000ee
|
#define HPPFS_SUPER_MAGIC 0xb00000ee
|
||||||
@ -662,38 +662,32 @@ static int hppfs_readlink(struct dentry *dentry, char *buffer, int buflen)
|
|||||||
{
|
{
|
||||||
struct file *proc_file;
|
struct file *proc_file;
|
||||||
struct dentry *proc_dentry;
|
struct dentry *proc_dentry;
|
||||||
int (*readlink)(struct dentry *, char *, int);
|
int ret;
|
||||||
int err, n;
|
|
||||||
|
|
||||||
proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
|
proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
|
||||||
proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY);
|
proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY);
|
||||||
err = PTR_ERR(proc_dentry);
|
if (IS_ERR(proc_file))
|
||||||
if(IS_ERR(proc_dentry))
|
return PTR_ERR(proc_file);
|
||||||
return(err);
|
|
||||||
|
|
||||||
readlink = proc_dentry->d_inode->i_op->readlink;
|
ret = proc_dentry->d_inode->i_op->readlink(proc_dentry, buffer, buflen);
|
||||||
n = (*readlink)(proc_dentry, buffer, buflen);
|
|
||||||
|
|
||||||
fput(proc_file);
|
fput(proc_file);
|
||||||
|
|
||||||
return(n);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void* hppfs_follow_link(struct dentry *dentry, struct nameidata *nd)
|
static void* hppfs_follow_link(struct dentry *dentry, struct nameidata *nd)
|
||||||
{
|
{
|
||||||
struct file *proc_file;
|
struct file *proc_file;
|
||||||
struct dentry *proc_dentry;
|
struct dentry *proc_dentry;
|
||||||
void * (*follow_link)(struct dentry *, struct nameidata *);
|
|
||||||
void *ret;
|
void *ret;
|
||||||
|
|
||||||
proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
|
proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
|
||||||
proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY);
|
proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY);
|
||||||
|
if (IS_ERR(proc_file))
|
||||||
|
return proc_file;
|
||||||
|
|
||||||
if (IS_ERR(proc_dentry))
|
ret = proc_dentry->d_inode->i_op->follow_link(proc_dentry, nd);
|
||||||
return proc_dentry;
|
|
||||||
|
|
||||||
follow_link = proc_dentry->d_inode->i_op->follow_link;
|
|
||||||
ret = (*follow_link)(proc_dentry, nd);
|
|
||||||
|
|
||||||
fput(proc_file);
|
fput(proc_file);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user