]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
fix up fuse 4.9 patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Jan 2022 14:37:35 +0000 (15:37 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Jan 2022 14:37:35 +0000 (15:37 +0100)
queue-4.9/fuse-fix-bad-inode.patch
queue-4.9/fuse-fix-live-lock-in-fuse_iget.patch

index 12deb1a24577d579d80bafbcf5baf89959c92e93..008a81e3faa69567c252de4cfa23bce7fdc881c1 100644 (file)
@@ -29,17 +29,21 @@ Reported-by: syzbot+f427adf9324b92652ccc@syzkaller.appspotmail.com
 Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
 Tested-by: Jan Kara <jack@suse.cz>
 Cc: <stable@vger.kernel.org>
-[adjusted for missing fs/fuse/readdir.c and changes in fuse_evict_inode() in 4.14]
-Signed-off-by: Samuel Mendoza-Jonas <samjonas@amazon.com>
+[bwh: Backported to 4.9:
+ - Drop changes in fuse_dir_fsync(), fuse_readahead(), fuse_evict_inode()
+ - In fuse_get_link(), return ERR_PTR(-EIO) for bad inodes
+ - Convert some additional calls to is_bad_inode()
+ - Adjust filename, context]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 ---
  fs/fuse/acl.c    |    6 ++++++
- fs/fuse/dir.c    |   37 ++++++++++++++++++++++++++++++++-----
- fs/fuse/file.c   |   21 +++++++++++++++------
+ fs/fuse/dir.c    |   40 +++++++++++++++++++++++++++++++++++-----
+ fs/fuse/file.c   |   27 ++++++++++++++++++---------
  fs/fuse/fuse_i.h |   12 ++++++++++++
  fs/fuse/inode.c  |    2 +-
  fs/fuse/xattr.c  |    9 +++++++++
- 6 files changed, 75 insertions(+), 12 deletions(-)
+ 6 files changed, 81 insertions(+), 15 deletions(-)
 
 --- a/fs/fuse/acl.c
 +++ b/fs/fuse/acl.c
@@ -171,7 +175,17 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
                return -EIO;
  
        req = fuse_get_req(fc, 1);
-@@ -1707,7 +1728,7 @@ int fuse_do_setattr(struct dentry *dentr
+@@ -1409,6 +1430,9 @@ static const char *fuse_get_link(struct
+       if (!dentry)
+               return ERR_PTR(-ECHILD);
++      if (fuse_is_bad(inode))
++              return ERR_PTR(-EIO);
++
+       link = kmalloc(PAGE_SIZE, GFP_KERNEL);
+       if (!link)
+               return ERR_PTR(-ENOMEM);
+@@ -1707,7 +1731,7 @@ int fuse_do_setattr(struct dentry *dentr
  
        if (fuse_invalid_attr(&outarg.attr) ||
            (inode->i_mode ^ outarg.attr.mode) & S_IFMT) {
@@ -180,7 +194,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
                err = -EIO;
                goto error;
        }
-@@ -1763,6 +1784,9 @@ static int fuse_setattr(struct dentry *e
+@@ -1763,6 +1787,9 @@ static int fuse_setattr(struct dentry *e
        struct file *file = (attr->ia_valid & ATTR_FILE) ? attr->ia_file : NULL;
        int ret;
  
@@ -190,7 +204,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
        if (!fuse_allow_current_process(get_fuse_conn(inode)))
                return -EACCES;
  
-@@ -1821,6 +1845,9 @@ static int fuse_getattr(struct vfsmount
+@@ -1821,6 +1848,9 @@ static int fuse_getattr(struct vfsmount
        struct inode *inode = d_inode(entry);
        struct fuse_conn *fc = get_fuse_conn(inode);
  
@@ -258,6 +272,15 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
        /*
         * In auto invalidate mode, always update attributes on read.
         * Otherwise, only update if we attempt to read past EOF (to ensure
+@@ -1123,7 +1129,7 @@ static ssize_t fuse_perform_write(struct
+       int err = 0;
+       ssize_t res = 0;
+-      if (is_bad_inode(inode))
++      if (fuse_is_bad(inode))
+               return -EIO;
+       if (inode->i_size < pos + iov_iter_count(ii))
 @@ -1180,6 +1186,9 @@ static ssize_t fuse_file_write_iter(stru
        ssize_t err;
        loff_t endbyte = 0;
@@ -268,6 +291,24 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
        if (get_fuse_conn(inode)->writeback_cache) {
                /* Update size (EOF optimization) and mode (SUID clearing) */
                err = fuse_update_attributes(mapping->host, NULL, file, NULL);
+@@ -1415,7 +1424,7 @@ static ssize_t __fuse_direct_read(struct
+       struct file *file = io->file;
+       struct inode *inode = file_inode(file);
+-      if (is_bad_inode(inode))
++      if (fuse_is_bad(inode))
+               return -EIO;
+       res = fuse_direct_io(io, iter, ppos, 0);
+@@ -1438,7 +1447,7 @@ static ssize_t fuse_direct_write_iter(st
+       struct fuse_io_priv io = FUSE_IO_PRIV_SYNC(file);
+       ssize_t res;
+-      if (is_bad_inode(inode))
++      if (fuse_is_bad(inode))
+               return -EIO;
+       /* Don't allow parallel writes to the same file */
 @@ -1911,7 +1920,7 @@ static int fuse_writepages(struct addres
        int err;
  
index bfffc83271403780f6ff9b0c840c145351efb93d..a90ff341169207359ac7ae69e230ac6f3904b839 100644 (file)
@@ -35,7 +35,7 @@ Fixes: 5d069dbe8aaf ("fuse: fix bad inode")
 Cc: stable@vger.kernel.org # 5.10+
 Signed-off-by: Amir Goldstein <amir73il@gmail.com>
 Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
-Signed-off-by: Samuel Mendoza-Jonas <samjonas@amazon.com>
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 ---
  fs/fuse/fuse_i.h |    1 +