Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull misc vfs updates from Al Viro:
"No common topic, really - a handful of assorted stuff; the least
trivial bits are Mark's dedupe patches"

* 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
fs/exofs: only use true/false for asignment of bool type variable
fs/exofs: fix potential memory leak in mount option parsing
Delete invalid assignment statements in do_sendfile
iomap: remove duplicated include from iomap.c
vfs: dedupe should return EPERM if permission is not granted
vfs: allow dedupe of user owned read-only files
ntfs: don't open-code ERR_CAST
ext4: don't open-code ERR_CAST

+25 -10
+5 -2
fs/exofs/super.c
··· 101 101 token = match_token(p, tokens, args); 102 102 switch (token) { 103 103 case Opt_name: 104 + kfree(opts->dev_name); 104 105 opts->dev_name = match_strdup(&args[0]); 105 106 if (unlikely(!opts->dev_name)) { 106 107 EXOFS_ERR("Error allocating dev_name"); ··· 118 117 EXOFS_MIN_PID); 119 118 return -EINVAL; 120 119 } 121 - s_pid = 1; 120 + s_pid = true; 122 121 break; 123 122 case Opt_to: 124 123 if (match_int(&args[0], &option)) ··· 867 866 int ret; 868 867 869 868 ret = parse_options(data, &opts); 870 - if (ret) 869 + if (ret) { 870 + kfree(opts.dev_name); 871 871 return ERR_PTR(ret); 872 + } 872 873 873 874 if (!opts.dev_name) 874 875 opts.dev_name = dev_name;
+1 -1
fs/ext4/ialloc.c
··· 1216 1216 bit = (ino - 1) % EXT4_INODES_PER_GROUP(sb); 1217 1217 bitmap_bh = ext4_read_inode_bitmap(sb, block_group); 1218 1218 if (IS_ERR(bitmap_bh)) 1219 - return (struct inode *) bitmap_bh; 1219 + return ERR_CAST(bitmap_bh); 1220 1220 1221 1221 /* Having the inode bit set should be a 100% indicator that this 1222 1222 * is a valid orphan (no e2fsck run on fs). Orphans also include
+2 -2
fs/ext4/namei.c
··· 1556 1556 1557 1557 bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); 1558 1558 if (IS_ERR(bh)) 1559 - return (struct dentry *) bh; 1559 + return ERR_CAST(bh); 1560 1560 inode = NULL; 1561 1561 if (bh) { 1562 1562 __u32 ino = le32_to_cpu(de->inode); ··· 1600 1600 1601 1601 bh = ext4_find_entry(d_inode(child), &dotdot, &de, NULL); 1602 1602 if (IS_ERR(bh)) 1603 - return (struct dentry *) bh; 1603 + return ERR_CAST(bh); 1604 1604 if (!bh) 1605 1605 return ERR_PTR(-ENOENT); 1606 1606 ino = le32_to_cpu(de->inode);
-1
fs/iomap.c
··· 30 30 #include <linux/task_io_accounting_ops.h> 31 31 #include <linux/dax.h> 32 32 #include <linux/sched/signal.h> 33 - #include <linux/swap.h> 34 33 35 34 #include "internal.h" 36 35
+1 -1
fs/ntfs/namei.c
··· 312 312 /* Get the mft record of the inode belonging to the child dentry. */ 313 313 mrec = map_mft_record(ni); 314 314 if (IS_ERR(mrec)) 315 - return (struct dentry *)mrec; 315 + return ERR_CAST(mrec); 316 316 /* Find the first file name attribute in the mft record. */ 317 317 ctx = ntfs_attr_get_search_ctx(ni, mrec); 318 318 if (unlikely(!ctx)) {
+16 -3
fs/read_write.c
··· 1407 1407 goto fput_in; 1408 1408 if (!(out.file->f_mode & FMODE_WRITE)) 1409 1409 goto fput_out; 1410 - retval = -EINVAL; 1411 1410 in_inode = file_inode(in.file); 1412 1411 out_inode = file_inode(out.file); 1413 1412 out_pos = out.file->f_pos; ··· 1976 1977 } 1977 1978 EXPORT_SYMBOL(vfs_dedupe_file_range_compare); 1978 1979 1980 + /* Check whether we are allowed to dedupe the destination file */ 1981 + static bool allow_file_dedupe(struct file *file) 1982 + { 1983 + if (capable(CAP_SYS_ADMIN)) 1984 + return true; 1985 + if (file->f_mode & FMODE_WRITE) 1986 + return true; 1987 + if (uid_eq(current_fsuid(), file_inode(file)->i_uid)) 1988 + return true; 1989 + if (!inode_permission(file_inode(file), MAY_WRITE)) 1990 + return true; 1991 + return false; 1992 + } 1993 + 1979 1994 int vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos, 1980 1995 struct file *dst_file, loff_t dst_pos, u64 len) 1981 1996 { ··· 2003 1990 if (ret < 0) 2004 1991 goto out_drop_write; 2005 1992 2006 - ret = -EINVAL; 2007 - if (!(capable(CAP_SYS_ADMIN) || (dst_file->f_mode & FMODE_WRITE))) 1993 + ret = -EPERM; 1994 + if (!allow_file_dedupe(dst_file)) 2008 1995 goto out_drop_write; 2009 1996 2010 1997 ret = -EXDEV;