TencentOS-kernel/fs
Yicong Yang fcb5b42536 libfs: fix error cast of negative value in simple_attr_write()
[ Upstream commit 488dac0c9237647e9b8f788b6a342595bfa40bda ]

The attr->set() receive a value of u64, but simple_strtoll() is used for
doing the conversion.  It will lead to the error cast if user inputs a
negative value.

Use kstrtoull() instead of simple_strtoll() to convert a string got from
the user to an unsigned value.  The former will return '-EINVAL' if it
gets a negetive value, but the latter can't handle the situation
correctly.  Make 'val' unsigned long long as what kstrtoull() takes,
this will eliminate the compile warning on no 64-bit architectures.

Fixes: f7b88631a897 ("fs/libfs.c: fix simple_attr_write() on 32bit machines")
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Link: https://lkml.kernel.org/r/1605341356-11872-1-git-send-email-yangyicong@hisilicon.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-03-16 16:41:24 +08:00
..
9p 9P: Cast to loff_t before multiplying 2021-03-16 16:40:11 +08:00
adfs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
affs affs: fix basic permission bits to actually work 2021-03-16 16:35:42 +08:00
afs afs: Fix warning due to unadvanced marshalling pointer 2021-03-16 16:40:37 +08:00
autofs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
befs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
bfs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
btrfs btrfs: fix potential overflow in cluster_pages_for_defrag on 32bit arch 2021-03-16 16:40:55 +08:00
cachefiles cachefiles: Handle readpage error correctly 2021-03-16 16:40:14 +08:00
ceph ceph: promote to unsigned long long before shifting 2021-03-16 16:40:11 +08:00
cifs Convert trailing spaces and periods in path components 2021-03-16 16:41:00 +08:00
coda Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
configfs configfs: fix config_item refcnt leak in configfs_rmdir() 2021-03-16 16:28:09 +08:00
cramfs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
crypto Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
debugfs debugfs: Fix module state check condition 2021-03-16 16:36:08 +08:00
devpts Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
dlm fs: dlm: fix configfs memory leak 2021-03-16 16:39:15 +08:00
ecryptfs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
efivarfs efivarfs: Replace invalid slashes with exclamation marks in dentries. 2021-03-16 16:39:29 +08:00
efs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
erofs erofs: derive atime instead of leaving it empty 2021-03-16 16:40:51 +08:00
exportfs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ext2 ext2: don't update mtime on COW faults 2021-03-16 16:35:36 +08:00
ext4 ext4: unlock xattr_sem properly in ext4_inline_data_truncate() 2021-03-16 16:40:52 +08:00
f2fs f2fs: handle errors of f2fs_get_meta_page_nofail 2021-03-16 16:39:42 +08:00
fat fat: don't allow to mount if the FAT length == 0 2021-03-16 16:29:12 +08:00
freevxfs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
fscache Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
fuse fuse: fix page dereference after free 2021-03-16 16:39:33 +08:00
gfs2 gfs2: fix possible reference leak in gfs2_check_blk_type 2021-03-16 16:41:11 +08:00
hfs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
hfsplus hfsplus: fix crash and filesystem corruption when deleting files 2021-03-16 16:26:16 +08:00
hostfs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
hpfs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
hugetlbfs hugetlbfs: prevent filesystem stacking of hugetlbfs 2021-03-16 16:34:53 +08:00
iomap iomap: fix WARN_ON_ONCE() from unprivileged users 2021-03-16 16:39:20 +08:00
isofs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
jbd2 jbd2: fix up sparse warnings in checkpoint code 2021-03-16 16:40:54 +08:00
jffs2 jffs2: fix UAF problem 2021-03-16 16:34:33 +08:00
jfs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
kernfs kernfs: do not call fsnotify() with name without a parent 2021-03-16 16:33:35 +08:00
lockd Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
minix fs/minix: remove expected error message in block_to_path() 2021-03-16 16:34:21 +08:00
nfs NFSv4.2: support EXCHGID4_FLAG_SUPP_FENCE_OPS 4.2 EXCHANGE_ID flag 2021-03-16 16:40:07 +08:00
nfs_common Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
nfsd NFSD: Add missing NFSv2 .pc_func methods 2021-03-16 16:40:07 +08:00
nilfs2 nilfs2: fix null pointer dereference at nilfs_segctor_do_construct() 2021-03-16 16:29:04 +08:00
nls Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
notify fanotify: fix ignore mask logic for events on child and on dir 2021-03-16 16:28:58 +08:00
ntfs ntfs: add check for mft record size in superblock 2021-03-16 16:39:16 +08:00
ocfs2 ocfs2: initialize ip_next_orphan 2021-03-16 16:40:55 +08:00
omfs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
openpromfs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
orangefs orangefs: get rid of knob code... 2021-03-16 16:34:10 +08:00
overlayfs ovl: fix unneeded call to ovl_change_flags() 2021-03-16 16:32:10 +08:00
proc mm, oom_adj: don't loop through tasks in __set_oom_adj when not necessary 2021-03-16 16:38:47 +08:00
pstore pstore: Fix linking when crypto API disabled 2021-03-16 16:33:55 +08:00
qnx4 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
qnx6 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
quota quota: clear padding in v2r1_mem2diskdqb() 2021-03-16 16:38:41 +08:00
ramfs ramfs: fix nommu mmap with gaps in the page cache 2021-03-16 16:38:58 +08:00
reiserfs reiserfs: Fix memory leak in reiserfs_parse_options() 2021-03-16 16:39:23 +08:00
romfs romfs: fix uninitialized memory leak in romfs_dev_read() 2021-03-16 16:34:28 +08:00
squashfs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
sysfs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
sysv Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
tracefs Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ubifs ubifs: mount_ubifs: Release authentication resource in error handling path 2021-03-16 16:40:08 +08:00
udf udf: Fix memory leak when mounting 2021-03-16 16:40:04 +08:00
ufs fs/ufs: avoid potential u32 multiplication overflow 2021-03-16 16:34:21 +08:00
unicode Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
verity Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xfs xfs: revert "xfs: fix rmap key and record comparison functions" 2021-03-16 16:41:23 +08:00
Kconfig Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Kconfig.binfmt Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Makefile Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
aio.c aio: fix async fsync creds 2021-03-16 16:28:58 +08:00
anon_inodes.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
attr.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
bad_inode.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
binfmt_aout.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
binfmt_elf.c fs/binfmt_elf.c: allocate initialized memory in fill_thread_core_info() 2021-03-16 16:28:37 +08:00
binfmt_elf_fdpic.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
binfmt_em86.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
binfmt_flat.c binfmt_flat: revert "binfmt_flat: don't offset the data start" 2021-03-16 16:34:43 +08:00
binfmt_misc.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
binfmt_script.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
block_dev.c bdev: Reduce time holding bd_mutex in sync in blkdev_close() 2021-03-16 16:37:13 +08:00
buffer.c fs: Don't invalidate page buffers in block_write_full_page() 2021-03-16 16:39:56 +08:00
char_dev.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
compat.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
compat_binfmt_elf.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
compat_ioctl.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
coredump.c coredump: fix crash when umh is disabled 2021-03-16 16:27:40 +08:00
d_path.c fs: fix NULL dereference due to data race in prepend_path() 2021-03-16 16:38:47 +08:00
dax.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
dcache.c fix dget_parent() fastpath race 2021-03-16 16:36:39 +08:00
dcookies.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
direct-io.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
drop_caches.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
eventfd.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
eventpoll.c ep_create_wakeup_source(): dentry name can change under you... 2021-03-16 16:37:52 +08:00
exec.c mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race 2021-03-16 16:39:40 +08:00
fcntl.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
fhandle.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
file.c fix multiplication overflow in copy_fdtable() 2021-03-16 16:28:07 +08:00
file_table.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
filesystems.c fs/filesystems.c: downgrade user-reachable WARN_ONCE() to pr_warn_once() 2021-03-16 16:26:14 +08:00
fs-writeback.c writeback: Fix sync livelock due to b_dirty_time processing 2021-03-16 16:35:12 +08:00
fs_context.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
fs_parser.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
fs_pin.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
fs_struct.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
fs_types.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
fsopen.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
inode.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
internal.h Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
io_uring.c io_uring: Fix double list add in io_queue_async_work() 2021-03-16 16:37:53 +08:00
ioctl.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
libfs.c libfs: fix error cast of negative value in simple_attr_write() 2021-03-16 16:41:24 +08:00
locks.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
mbcache.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
mount.h Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
mpage.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
namei.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
namespace.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
no-block.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
nsfs.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
open.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
pipe.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
pnode.c propagate_one(): mnt_set_mountpoint() needs mount_lock 2021-03-16 16:27:06 +08:00
pnode.h Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
posix_acl.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
proc_namespace.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
read_write.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
readdir.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
select.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
seq_file.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
signalfd.c fs/signalfd.c: fix inconsistent return codes for signalfd4 2021-03-16 16:34:34 +08:00
splice.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
stack.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
stat.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
statfs.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
super.c vfs: remove lockdep bogosity in __sb_start_write 2021-03-16 16:41:11 +08:00
sync.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
timerfd.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
userfaultfd.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
utimes.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xattr.c xattr: break delegations in {set,remove}xattr 2021-03-16 16:33:08 +08:00