Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 4076fa1

Browse files
committed
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
2 parents 400dd45 + 6630036 commit 4076fa1

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

fs/9p/vfs_inode.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -344,17 +344,21 @@ void v9fs_evict_inode(struct inode *inode)
344344
struct v9fs_inode __maybe_unused *v9inode = V9FS_I(inode);
345345
__le32 __maybe_unused version;
346346

347-
truncate_inode_pages_final(&inode->i_data);
347+
if (!is_bad_inode(inode)) {
348+
truncate_inode_pages_final(&inode->i_data);
348349

349-
version = cpu_to_le32(v9inode->qid.version);
350-
netfs_clear_inode_writeback(inode, &version);
350+
version = cpu_to_le32(v9inode->qid.version);
351+
netfs_clear_inode_writeback(inode, &version);
351352

352-
clear_inode(inode);
353-
filemap_fdatawrite(&inode->i_data);
353+
clear_inode(inode);
354+
filemap_fdatawrite(&inode->i_data);
354355

355356
#ifdef CONFIG_9P_FSCACHE
356-
fscache_relinquish_cookie(v9fs_inode_cookie(v9inode), false);
357+
if (v9fs_inode_cookie(v9inode))
358+
fscache_relinquish_cookie(v9fs_inode_cookie(v9inode), false);
357359
#endif
360+
} else
361+
clear_inode(inode);
358362
}
359363

360364
struct inode *v9fs_fid_iget(struct super_block *sb, struct p9_fid *fid)

fs/9p/vfs_inode_dotl.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ struct inode *v9fs_fid_iget_dotl(struct super_block *sb, struct p9_fid *fid)
7878

7979
retval = v9fs_init_inode(v9ses, inode, &fid->qid,
8080
st->st_mode, new_decode_dev(st->st_rdev));
81+
v9fs_stat2inode_dotl(st, inode, 0);
8182
kfree(st);
8283
if (retval)
8384
goto error;
8485

85-
v9fs_stat2inode_dotl(st, inode, 0);
8686
v9fs_set_netfs_context(inode);
8787
v9fs_cache_inode_get_cookie(inode);
8888
retval = v9fs_get_acl(inode, fid);
@@ -297,7 +297,6 @@ static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap,
297297
umode_t omode)
298298
{
299299
int err;
300-
struct v9fs_session_info *v9ses;
301300
struct p9_fid *fid = NULL, *dfid = NULL;
302301
kgid_t gid;
303302
const unsigned char *name;
@@ -307,7 +306,6 @@ static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap,
307306
struct posix_acl *dacl = NULL, *pacl = NULL;
308307

309308
p9_debug(P9_DEBUG_VFS, "name %pd\n", dentry);
310-
v9ses = v9fs_inode2v9ses(dir);
311309

312310
omode |= S_IFDIR;
313311
if (dir->i_mode & S_ISGID)
@@ -739,7 +737,6 @@ v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir,
739737
kgid_t gid;
740738
const unsigned char *name;
741739
umode_t mode;
742-
struct v9fs_session_info *v9ses;
743740
struct p9_fid *fid = NULL, *dfid = NULL;
744741
struct inode *inode;
745742
struct p9_qid qid;
@@ -749,7 +746,6 @@ v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir,
749746
dir->i_ino, dentry, omode,
750747
MAJOR(rdev), MINOR(rdev));
751748

752-
v9ses = v9fs_inode2v9ses(dir);
753749
dfid = v9fs_parent_fid(dentry);
754750
if (IS_ERR(dfid)) {
755751
err = PTR_ERR(dfid);

0 commit comments

Comments
 (0)