Merge tag 'vfs.misc.v6.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 12 Mar 2023 16:00:54 +0000 (09:00 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 12 Mar 2023 16:00:54 +0000 (09:00 -0700)
Pull vfs fixes from Christian Brauner:

 - When allocating pages for a watch queue failed, we didn't return an
   error causing userspace to proceed even though all subsequent
   notifcations would be lost. Make sure to return an error.

 - Fix a misformed tree entry for the idmapping maintainers entry.

 - When setting file leases from an idmapped mount via
   generic_setlease() we need to take the idmapping into account
   otherwise taking a lease would fail from an idmapped mount.

 - Remove two redundant assignments, one in splice code and the other in
   locks code, that static checkers complained about.

* tag 'vfs.misc.v6.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping:
  filelocks: use mount idmapping for setlease permission check
  fs/locks: Remove redundant assignment to cmd
  splice: Remove redundant assignment to ret
  MAINTAINERS: repair a malformed T: entry in IDMAPPED MOUNTS
  watch_queue: fix IOC_WATCH_QUEUE_SET_SIZE alloc error paths

MAINTAINERS
fs/locks.c
fs/splice.c
kernel/watch_queue.c

index 150ff03..02f57bc 100644 (file)
@@ -9871,10 +9871,10 @@ M:      Christian Brauner <brauner@kernel.org>
 M:     Seth Forshee <sforshee@kernel.org>
 L:     linux-fsdevel@vger.kernel.org
 S:     Maintained
-T:     git://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping.git
 F:     Documentation/filesystems/idmappings.rst
-F:     tools/testing/selftests/mount_setattr/
 F:     include/linux/mnt_idmapping.*
+F:     tools/testing/selftests/mount_setattr/
 
 IDT VersaClock 5 CLOCK DRIVER
 M:     Luca Ceresoli <luca@lucaceresoli.net>
index 66b4eef..df8b26a 100644 (file)
@@ -1863,9 +1863,10 @@ int generic_setlease(struct file *filp, long arg, struct file_lock **flp,
                        void **priv)
 {
        struct inode *inode = file_inode(filp);
+       vfsuid_t vfsuid = i_uid_into_vfsuid(file_mnt_idmap(filp), inode);
        int error;
 
-       if ((!uid_eq(current_fsuid(), inode->i_uid)) && !capable(CAP_LEASE))
+       if ((!vfsuid_eq_kuid(vfsuid, current_fsuid())) && !capable(CAP_LEASE))
                return -EACCES;
        if (!S_ISREG(inode->i_mode))
                return -EINVAL;
@@ -2425,7 +2426,6 @@ int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 *flock)
                if (flock->l_pid != 0)
                        goto out;
 
-               cmd = F_GETLK64;
                fl->fl_flags |= FL_OFDLCK;
                fl->fl_owner = filp;
        }
index 2e76dbb..2c3dec2 100644 (file)
@@ -937,7 +937,6 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
        /*
         * Do the splice.
         */
-       ret = 0;
        bytes = 0;
        len = sd->total_len;
        flags = sd->flags;
index a6f9bdd..f10f403 100644 (file)
@@ -273,6 +273,7 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes)
        if (ret < 0)
                goto error;
 
+       ret = -ENOMEM;
        pages = kcalloc(sizeof(struct page *), nr_pages, GFP_KERNEL);
        if (!pages)
                goto error;