Commit 4076fa16 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag '9p-fixes-for-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs

Pull 9p fixes from Eric Van Hensbergen:
 "Two of these fix syzbot reported issues, and the other fixes a unused
  variable in some configurations"

* tag '9p-fixes-for-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
  fs/9p: fix uninitialized values during inode evict
  fs/9p: remove redundant pointer v9ses
  fs/9p: fix uaf in in v9fs_stat2inode_dotl
parents 400dd456 6630036b
...@@ -344,17 +344,21 @@ void v9fs_evict_inode(struct inode *inode) ...@@ -344,17 +344,21 @@ void v9fs_evict_inode(struct inode *inode)
struct v9fs_inode __maybe_unused *v9inode = V9FS_I(inode); struct v9fs_inode __maybe_unused *v9inode = V9FS_I(inode);
__le32 __maybe_unused version; __le32 __maybe_unused version;
truncate_inode_pages_final(&inode->i_data); if (!is_bad_inode(inode)) {
truncate_inode_pages_final(&inode->i_data);
version = cpu_to_le32(v9inode->qid.version); version = cpu_to_le32(v9inode->qid.version);
netfs_clear_inode_writeback(inode, &version); netfs_clear_inode_writeback(inode, &version);
clear_inode(inode); clear_inode(inode);
filemap_fdatawrite(&inode->i_data); filemap_fdatawrite(&inode->i_data);
#ifdef CONFIG_9P_FSCACHE #ifdef CONFIG_9P_FSCACHE
fscache_relinquish_cookie(v9fs_inode_cookie(v9inode), false); if (v9fs_inode_cookie(v9inode))
fscache_relinquish_cookie(v9fs_inode_cookie(v9inode), false);
#endif #endif
} else
clear_inode(inode);
} }
struct inode *v9fs_fid_iget(struct super_block *sb, struct p9_fid *fid) struct inode *v9fs_fid_iget(struct super_block *sb, struct p9_fid *fid)
......
...@@ -78,11 +78,11 @@ struct inode *v9fs_fid_iget_dotl(struct super_block *sb, struct p9_fid *fid) ...@@ -78,11 +78,11 @@ struct inode *v9fs_fid_iget_dotl(struct super_block *sb, struct p9_fid *fid)
retval = v9fs_init_inode(v9ses, inode, &fid->qid, retval = v9fs_init_inode(v9ses, inode, &fid->qid,
st->st_mode, new_decode_dev(st->st_rdev)); st->st_mode, new_decode_dev(st->st_rdev));
v9fs_stat2inode_dotl(st, inode, 0);
kfree(st); kfree(st);
if (retval) if (retval)
goto error; goto error;
v9fs_stat2inode_dotl(st, inode, 0);
v9fs_set_netfs_context(inode); v9fs_set_netfs_context(inode);
v9fs_cache_inode_get_cookie(inode); v9fs_cache_inode_get_cookie(inode);
retval = v9fs_get_acl(inode, fid); retval = v9fs_get_acl(inode, fid);
...@@ -297,7 +297,6 @@ static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap, ...@@ -297,7 +297,6 @@ static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap,
umode_t omode) umode_t omode)
{ {
int err; int err;
struct v9fs_session_info *v9ses;
struct p9_fid *fid = NULL, *dfid = NULL; struct p9_fid *fid = NULL, *dfid = NULL;
kgid_t gid; kgid_t gid;
const unsigned char *name; const unsigned char *name;
...@@ -307,7 +306,6 @@ static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap, ...@@ -307,7 +306,6 @@ static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap,
struct posix_acl *dacl = NULL, *pacl = NULL; struct posix_acl *dacl = NULL, *pacl = NULL;
p9_debug(P9_DEBUG_VFS, "name %pd\n", dentry); p9_debug(P9_DEBUG_VFS, "name %pd\n", dentry);
v9ses = v9fs_inode2v9ses(dir);
omode |= S_IFDIR; omode |= S_IFDIR;
if (dir->i_mode & S_ISGID) if (dir->i_mode & S_ISGID)
...@@ -739,7 +737,6 @@ v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir, ...@@ -739,7 +737,6 @@ v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir,
kgid_t gid; kgid_t gid;
const unsigned char *name; const unsigned char *name;
umode_t mode; umode_t mode;
struct v9fs_session_info *v9ses;
struct p9_fid *fid = NULL, *dfid = NULL; struct p9_fid *fid = NULL, *dfid = NULL;
struct inode *inode; struct inode *inode;
struct p9_qid qid; struct p9_qid qid;
...@@ -749,7 +746,6 @@ v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir, ...@@ -749,7 +746,6 @@ v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir,
dir->i_ino, dentry, omode, dir->i_ino, dentry, omode,
MAJOR(rdev), MINOR(rdev)); MAJOR(rdev), MINOR(rdev));
v9ses = v9fs_inode2v9ses(dir);
dfid = v9fs_parent_fid(dentry); dfid = v9fs_parent_fid(dentry);
if (IS_ERR(dfid)) { if (IS_ERR(dfid)) {
err = PTR_ERR(dfid); err = PTR_ERR(dfid);
......
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