Commit 731805b4 authored by Latchesar Ionkov's avatar Latchesar Ionkov Committed by Linus Torvalds

[PATCH] v9fs: fix for access to unitialized variables or freed memory

Miscellaneous fixes related to accessing uninitialized variables or memory
that was already freed.
Signed-off-by: default avatarLatchesar Ionkov <lucho@ionkov.net>
Cc: Eric Van Hensbergen <ericvh@ericvh.myip.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ed2da193
...@@ -111,7 +111,6 @@ static void v9fs_t_clunk_cb(void *a, struct v9fs_fcall *tc, ...@@ -111,7 +111,6 @@ static void v9fs_t_clunk_cb(void *a, struct v9fs_fcall *tc,
if (!rc) if (!rc)
return; return;
dprintk(DEBUG_9P, "tcall id %d rcall id %d\n", tc->id, rc->id);
v9ses = a; v9ses = a;
if (rc->id == RCLUNK) if (rc->id == RCLUNK)
v9fs_put_idpool(fid, &v9ses->fidpool); v9fs_put_idpool(fid, &v9ses->fidpool);
......
...@@ -80,6 +80,7 @@ static int v9fs_fd_send(struct v9fs_transport *trans, void *v, int len) ...@@ -80,6 +80,7 @@ static int v9fs_fd_send(struct v9fs_transport *trans, void *v, int len)
if (!trans || trans->status != Connected || !ts) if (!trans || trans->status != Connected || !ts)
return -EIO; return -EIO;
oldfs = get_fs();
set_fs(get_ds()); set_fs(get_ds());
/* The cast to a user pointer is valid due to the set_fs() */ /* The cast to a user pointer is valid due to the set_fs() */
ret = vfs_write(ts->out_file, (void __user *)v, len, &ts->out_file->f_pos); ret = vfs_write(ts->out_file, (void __user *)v, len, &ts->out_file->f_pos);
......
...@@ -265,8 +265,7 @@ v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name, ...@@ -265,8 +265,7 @@ v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name,
fid = v9fs_get_idpool(&v9ses->fidpool); fid = v9fs_get_idpool(&v9ses->fidpool);
if (fid < 0) { if (fid < 0) {
eprintk(KERN_WARNING, "no free fids available\n"); eprintk(KERN_WARNING, "no free fids available\n");
err = -ENOSPC; return -ENOSPC;
goto error;
} }
err = v9fs_t_walk(v9ses, pfid, fid, NULL, &fcall); err = v9fs_t_walk(v9ses, pfid, fid, NULL, &fcall);
...@@ -313,8 +312,7 @@ v9fs_clone_walk(struct v9fs_session_info *v9ses, u32 fid, struct dentry *dentry) ...@@ -313,8 +312,7 @@ v9fs_clone_walk(struct v9fs_session_info *v9ses, u32 fid, struct dentry *dentry)
nfid = v9fs_get_idpool(&v9ses->fidpool); nfid = v9fs_get_idpool(&v9ses->fidpool);
if (nfid < 0) { if (nfid < 0) {
eprintk(KERN_WARNING, "no free fids available\n"); eprintk(KERN_WARNING, "no free fids available\n");
err = -ENOSPC; return ERR_PTR(-ENOSPC);
goto error;
} }
err = v9fs_t_walk(v9ses, fid, nfid, (char *) dentry->d_name.name, err = v9fs_t_walk(v9ses, fid, nfid, (char *) dentry->d_name.name,
...@@ -612,7 +610,7 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, ...@@ -612,7 +610,7 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
int result = 0; int result = 0;
dprintk(DEBUG_VFS, "dir: %p dentry: (%s) %p nameidata: %p\n", dprintk(DEBUG_VFS, "dir: %p dentry: (%s) %p nameidata: %p\n",
dir, dentry->d_iname, dentry, nameidata); dir, dentry->d_name.name, dentry, nameidata);
sb = dir->i_sb; sb = dir->i_sb;
v9ses = v9fs_inode2v9ses(dir); v9ses = v9fs_inode2v9ses(dir);
......
...@@ -156,7 +156,6 @@ static struct super_block *v9fs_get_sb(struct file_system_type ...@@ -156,7 +156,6 @@ static struct super_block *v9fs_get_sb(struct file_system_type
stat_result = v9fs_t_stat(v9ses, newfid, &fcall); stat_result = v9fs_t_stat(v9ses, newfid, &fcall);
if (stat_result < 0) { if (stat_result < 0) {
dprintk(DEBUG_ERROR, "stat error\n"); dprintk(DEBUG_ERROR, "stat error\n");
kfree(fcall);
v9fs_t_clunk(v9ses, newfid); v9fs_t_clunk(v9ses, newfid);
} else { } else {
/* Setup the Root Inode */ /* Setup the Root Inode */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment