Skip to content

Commit

Permalink
9p: Fix possible memleak in v9fs_inode_from fid.
Browse files Browse the repository at this point in the history
Add missing p9stat_free in v9fs_inode_from_fid to avoid
any possible leaks.

Signed-off-by: Abhishek Kulkarni <adkulkar@umail.iu.edu>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
  • Loading branch information
Abhishek Kulkarni authored and Eric Van Hensbergen committed Aug 17, 2009
1 parent 0e15597 commit 02bc356
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions fs/9p/vfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,30 +344,25 @@ v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid,

ret = NULL;
st = p9_client_stat(fid);
if (IS_ERR(st)) {
err = PTR_ERR(st);
st = NULL;
goto error;
}
if (IS_ERR(st))
return ERR_CAST(st);

umode = p9mode2unixmode(v9ses, st->mode);
ret = v9fs_get_inode(sb, umode);
if (IS_ERR(ret)) {
err = PTR_ERR(ret);
ret = NULL;
goto error;
}

v9fs_stat2inode(st, ret, sb);
ret->i_ino = v9fs_qid2ino(&st->qid);
p9stat_free(st);
kfree(st);
return ret;

error:
p9stat_free(st);
kfree(st);
if (ret)
iput(ret);

return ERR_PTR(err);
}

Expand Down

0 comments on commit 02bc356

Please sign in to comment.