linux-stable/fs/9p
Christian Brauner 7760404e84 9p: only copy valid iattrs in 9P2000.L setattr implementation
commit 3cb6ee9914 upstream.

The 9P2000.L setattr method v9fs_vfs_setattr_dotl() copies struct iattr
values without checking whether they are valid causing unitialized
values to be copied. The 9P2000 setattr method v9fs_vfs_setattr() method
gets this right. Check whether struct iattr fields are valid first
before copying in v9fs_vfs_setattr_dotl() too and make sure that all
other fields are set to 0 apart from {g,u}id which should be set to
INVALID_{G,U}ID. This ensure that they can be safely sent over the wire
or printed for debugging later on.

Link: https://lkml.kernel.org/r/20211129114434.3637938-1-brauner@kernel.org
Link: https://lkml.kernel.org/r/000000000000a0d53f05d1c72a4c%40google.com
Cc: Eric Van Hensbergen <ericvh@gmail.com>
Cc: Latchesar Ionkov <lucho@ionkov.net>
Cc: Dominique Martinet <asmadeus@codewreck.org>
Cc: stable@kernel.org
Cc: v9fs-developer@lists.sourceforge.net
Reported-by: syzbot+dfac92a50024b54acaa4@syzkaller.appspotmail.com
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
[Dominique: do not set a/mtime with just ATTR_A/MTIME as discussed]
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-20 09:13:14 +01:00
..
acl.c vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
acl.h vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
cache.c 9p: Fix a bunch of kerneldoc warnings shown up by W=1 2021-10-04 22:07:46 +01:00
cache.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 188 2019-05-30 11:29:21 -07:00
fid.c 9p: Fix a bunch of kerneldoc warnings shown up by W=1 2021-10-04 22:07:46 +01:00
fid.h 9p: apply review requests for fid refcounting 2020-11-19 17:21:34 +01:00
Kconfig 9p: Fix Kconfig indentation 2020-03-27 09:29:56 +00:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
v9fs.c 9p: Fix a bunch of kerneldoc warnings shown up by W=1 2021-10-04 22:07:46 +01:00
v9fs.h fs: make helpers idmap mount aware 2021-01-24 14:27:20 +01:00
v9fs_vfs.h fs: make helpers idmap mount aware 2021-01-24 14:27:20 +01:00
vfs_addr.c 9p: Fix a bunch of kerneldoc warnings shown up by W=1 2021-10-04 22:07:46 +01:00
vfs_dentry.c 9p: add refcount to p9_fid struct 2020-11-19 17:20:39 +01:00
vfs_dir.c 9p: add refcount to p9_fid struct 2020-11-19 17:20:39 +01:00
vfs_file.c 9p: Fix a bunch of kerneldoc warnings shown up by W=1 2021-10-04 22:07:46 +01:00
vfs_inode.c 9p: Fix a bunch of kerneldoc warnings shown up by W=1 2021-10-04 22:07:46 +01:00
vfs_inode_dotl.c 9p: only copy valid iattrs in 9P2000.L setattr implementation 2022-01-20 09:13:14 +01:00
vfs_super.c 9p: add refcount to p9_fid struct 2020-11-19 17:20:39 +01:00
xattr.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00
xattr.h 9p: xattr simplifications 2015-11-13 20:34:33 -05:00