[PATCH 2/4] fuse: Propagate dentry down to inode_change_ok()
Tim Gardner
tim.gardner at canonical.com
Wed Mar 17 17:16:25 UTC 2021
From: Jan Kara <jack at suse.cz>
CVE-2015-1350
To avoid clearing of capabilities or security related extended
attributes too early, inode_change_ok() will need to take dentry instead
of inode. Propagate it down to fuse_do_setattr().
Acked-by: Miklos Szeredi <mszeredi at redhat.com>
Reviewed-by: Christoph Hellwig <hch at lst.de>
Signed-off-by: Jan Kara <jack at suse.cz>
(backported from commit 62490330769c1ce5dcba3f1f3e8f4005e9b797e6)
Signed-off-by: Tim Gardner <tim.gardner at canonical.com>
---
fs/fuse/dir.c | 3 ++-
fs/fuse/file.c | 2 +-
fs/fuse/fuse_i.h | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 0c2470281999..082ec2696ad0 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1599,9 +1599,10 @@ int fuse_flush_times(struct inode *inode, struct fuse_file *ff)
* vmtruncate() doesn't allow for this case, so do the rlimit checking
* and the actual truncation by hand.
*/
-int fuse_do_setattr(struct inode *inode, struct iattr *attr,
+int fuse_do_setattr(struct dentry *dentry, struct iattr *attr,
struct file *file)
{
+ struct inode *inode = d_inode(dentry);
struct fuse_conn *fc = get_fuse_conn(inode);
struct fuse_inode *fi = get_fuse_inode(inode);
FUSE_ARGS(args);
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 89622d2a1ac0..663b7ffd5a92 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2834,7 +2834,7 @@ static void fuse_do_truncate(struct file *file)
attr.ia_file = file;
attr.ia_valid |= ATTR_FILE;
- fuse_do_setattr(inode, &attr, file);
+ fuse_do_setattr(file_dentry(file), &attr, file);
}
static inline loff_t fuse_round_up(loff_t off)
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index b927de668272..e02ef4d29be8 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -960,7 +960,7 @@ bool fuse_write_update_size(struct inode *inode, loff_t pos);
int fuse_flush_times(struct inode *inode, struct fuse_file *ff);
int fuse_write_inode(struct inode *inode, struct writeback_control *wbc);
-int fuse_do_setattr(struct inode *inode, struct iattr *attr,
+int fuse_do_setattr(struct dentry *dentry, struct iattr *attr,
struct file *file);
void fuse_set_initialized(struct fuse_conn *fc);
--
2.17.1
More information about the kernel-team
mailing list