android_kernel_sony_sdm845/fs
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Pavel Shilovsky 0c47433c90 CIFS: Fix NULL-pointer dereference in smb2_push_mandatory_locks
commit 6f582b273ec23332074d970a7fb25bef835df71f upstream.

Currently when the client creates a cifsFileInfo structure for
a newly opened file, it allocates a list of byte-range locks
with a pointer to the new cfile and attaches this list to the
inode's lock list. The latter happens before initializing all
other fields, e.g. cfile->tlink. Thus a partially initialized
cifsFileInfo structure becomes available to other threads that
walk through the inode's lock list. One example of such a thread
may be an oplock break worker thread that tries to push all
cached byte-range locks. This causes NULL-pointer dereference
in smb2_push_mandatory_locks() when accessing cfile->tlink:

[598428.945633] BUG: kernel NULL pointer dereference, address: 0000000000000038
...
[598428.945749] Workqueue: cifsoplockd cifs_oplock_break [cifs]
[598428.945793] RIP: 0010:smb2_push_mandatory_locks+0xd6/0x5a0 [cifs]
...
[598428.945834] Call Trace:
[598428.945870]  ? cifs_revalidate_mapping+0x45/0x90 [cifs]
[598428.945901]  cifs_oplock_break+0x13d/0x450 [cifs]
[598428.945909]  process_one_work+0x1db/0x380
[598428.945914]  worker_thread+0x4d/0x400
[598428.945921]  kthread+0x104/0x140
[598428.945925]  ? process_one_work+0x380/0x380
[598428.945931]  ? kthread_park+0x80/0x80
[598428.945937]  ret_from_fork+0x35/0x40

Fix this by reordering initialization steps of the cifsFileInfo
structure: initialize all the fields first and then add the new
byte-range lock list to the inode's lock list.

Cc: Stable <stable@vger.kernel.org>
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-21 10:41:35 +01:00
..
9p 9p: avoid attaching writeback_fid on mmap with type PRIVATE 2019-10-17 13:42:10 -07:00
adfs fs/adfs: super: fix use-after-free bug 2019-08-06 18:29:35 +02:00
affs affs_lookup(): close a race with affs_remove_link() 2018-05-30 07:50:16 +02:00
afs afs: Fix abort on signal while waiting for call completion 2017-12-20 10:07:25 +01:00
autofs4 autofs: fix a leak in autofs_expire_indirect() 2019-12-21 10:40:46 +01:00
befs befs fixes for 4.9-rc1 2016-10-15 12:09:13 -07:00
bfs bfs: add sanity check at bfs_fill_super() 2018-12-01 09:44:19 +01:00
btrfs btrfs: only track ref_heads in delayed_ref_updates 2019-12-05 15:34:27 +01:00
cachefiles fscache, cachefiles: remove redundant variable 'cache' 2018-12-17 09:38:34 +01:00
ceph ceph: fix dentry leak in ceph_readdir_prepopulate 2019-11-28 18:28:34 +01:00
cifs CIFS: Fix NULL-pointer dereference in smb2_push_mandatory_locks 2019-12-21 10:41:35 +01:00
coda coda: add error handling for fget 2019-08-06 18:29:38 +02:00
configfs configfs: fix a deadlock in configfs_symlink() 2019-11-12 19:15:51 +01:00
cramfs Cramfs: fix abad comparison when wrap-arounds occur 2018-11-13 11:17:03 -08:00
crypto fscrypt: don't set policy for a dead directory 2019-07-21 09:05:59 +02:00
debugfs debugfs: fix use-after-free on symlink traversal 2019-05-08 07:19:10 +02:00
devpts fs/devpts: always delete dcache dentry-s in dput() 2019-03-23 13:19:47 +01:00
dlm dlm: fix invalid cluster name warning 2019-12-21 10:41:21 +01:00
ecryptfs ecryptfs_lookup_interpose(): lower_dentry->d_parent is not stable either 2019-11-25 09:51:57 +01:00
efivarfs Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-10-10 20:16:43 -07:00
efs
exofs fs/exofs: fix potential memory leak in mount option parsing 2018-11-27 16:09:38 +01:00
exportfs exportfs_decode_fh(): negative pinned may become positive without the parent locked 2019-12-21 10:40:47 +01:00
ext2 ext2: Fix underflow in ext2_max_size() 2019-03-23 13:19:48 +01:00
ext4 ext4: fix punch hole for inline_data file systems 2019-10-05 12:30:35 +02:00
f2fs f2fs: fix to spread clear_cold_data() 2019-11-28 18:28:35 +01:00
fat fat: work around race with userspace's read via blockdev while mounting 2019-10-07 18:53:18 +02:00
freevxfs
fscache fscache: fix race between enablement and dropping of object 2018-12-17 09:38:34 +01:00
fuse fuse: verify attributes 2019-12-21 10:41:30 +01:00
gfs2 gfs2: take jdata unstuff into account in do_grow 2019-12-05 15:34:36 +01:00
hfs fs/hfs/extent.c: fix array out of bounds read of array extent 2019-11-28 18:28:50 +01:00
hfsplus hfsplus: update timestamps on truncate() 2019-11-28 18:28:49 +01:00
hostfs Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-10-10 20:16:43 -07:00
hpfs Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-10-10 20:16:43 -07:00
hugetlbfs hugetlb: use same fault hash key for shared and private mappings 2019-05-31 06:48:12 -07:00
isofs isofs: fix timestamps beyond 2027 2017-11-30 08:39:04 +00:00
jbd2 jbd2: check superblock mapped prior to committing 2019-05-21 18:48:59 +02:00
jffs2 jffs2: fix use-after-free on symlink traversal 2019-05-08 07:19:09 +02:00
jfs jfs: Fix inconsistency between memory allocation and ea_buf->max_size 2018-08-09 12:18:00 +02:00
kernfs kernfs: Fix range checks in kernfs_get_target_path 2019-11-25 09:52:23 +01:00
lockd lockd: fix access beyond unterminated strings in prints 2018-11-13 11:17:02 -08:00
logfs Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-10-10 20:16:43 -07:00
minix Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-10-10 20:16:43 -07:00
ncpfs ncpfs: fix build warning of strncpy 2019-03-13 14:04:52 -07:00
nfs NFSv4.x: fix lock recovery during delegation recall 2019-11-25 09:53:35 +01:00
nfs_common lockd: fix "list_add double add" caused by legacy signal interface 2018-02-03 17:05:38 +01:00
nfsd nfsd: Return EPERM, not EACCES, in some SETATTR cases 2019-12-21 10:41:24 +01:00
nilfs2 do d_instantiate/unlock_new_inode combinations safely 2018-05-30 07:50:16 +02:00
nls
notify fanotify: fix handling of events on child sub-directory 2019-02-06 17:33:30 +01:00
ntfs fs: remove the never implemented aio_fsync file operation 2016-10-30 13:09:42 -04:00
ocfs2 ocfs2: clear journal dirty flag after shutdown journal 2019-12-05 15:35:01 +01:00
omfs Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-10-10 20:16:43 -07:00
openpromfs fs: Replace CURRENT_TIME with current_time() for inode timestamps 2016-09-27 21:06:21 -04:00
orangefs orangefs: rate limit the client not running info message 2019-11-25 09:53:50 +01:00
overlayfs ovl: filter of trusted xattr results in audit 2019-10-05 12:30:34 +02:00
proc proc/vmcore: Fix i386 build error of missing copy_oldmem_page_encrypted() 2019-11-25 09:53:44 +01:00
pstore pstore/ram: Do not treat empty buffers as valid 2019-01-26 09:38:33 +01:00
qnx4
qnx6
quota fs/quota: Fix spectre gadget in do_quotactl 2018-09-09 20:01:26 +02:00
ramfs Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-10-10 20:16:43 -07:00
reiserfs reiserfs: propagate errors from fill_with_dentries() properly 2018-11-27 16:09:38 +01:00
romfs romfs: use different way to generate fsid for BLOCK or MTD 2017-06-17 06:41:56 +02:00
squashfs Squashfs: Compute expected length from inode size rather than block length 2018-09-05 09:20:03 +02:00
sysfs scsi: sysfs: Introduce sysfs_{un,}break_active_protection() 2018-09-05 09:20:10 +02:00
sysv sysv: return 'err' instead of 0 in __sysv_write_inode 2018-12-17 09:38:32 +01:00
tracefs fs: Replace CURRENT_TIME with current_time() for inode timestamps 2016-09-27 21:06:21 -04:00
ubifs ubifs: Handle re-linking of inodes correctly while recovery 2018-12-29 13:40:16 +01:00
udf udf: Fix incorrect final NOT_ALLOCATED (hole) extent length 2019-07-21 09:05:57 +02:00
ufs ufs: fix braino in ufs_get_inode_gid() for solaris UFS flavour 2019-05-25 18:26:56 +02:00
xfs xfs: Fix bulkstat compat ioctls on x32 userspace. 2019-12-05 15:34:37 +01:00
aio.c aio: fix spectre gadget in lookup_ioctx 2018-12-21 14:11:31 +01:00
anon_inodes.c
attr.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-10-10 20:16:43 -07:00
bad_inode.c bad_inode: add missing i_op initializers 2017-01-09 08:32:24 +01:00
binfmt_aout.c
binfmt_elf.c binfmt_elf: Respect error return from `regset->active' 2018-09-26 08:36:37 +02:00
binfmt_elf_fdpic.c
binfmt_em86.c
binfmt_flat.c fs/binfmt_flat.c: make load_flat_shared_library() work 2019-07-10 09:55:38 +02:00
binfmt_misc.c fs/binfmt_misc.c: do not allow offset overflow 2018-06-26 08:08:09 +08:00
binfmt_script.c exec: load_script: Do not exec truncated interpreter path 2019-11-06 12:18:04 +01:00
block_dev.c blockdev: Fix livelocks on loop device 2019-01-23 08:10:56 +01:00
buffer.c fs: fix guard_bio_eod to check for real EOD errors 2019-04-05 22:29:08 +02:00
char_dev.c chardev: add additional check for minor range overlap 2019-05-31 06:48:29 -07:00
compat.c compat: remove compat_printk() 2016-09-27 21:20:53 -04:00
compat_binfmt_elf.c binfmt_elf: compat: avoid unused function warning 2018-02-25 11:05:55 +01:00
compat_ioctl.c media: dvb: fix compat ioctl translation 2019-11-25 09:52:17 +01:00
coredump.c coredump: Ensure proper size of sparse core files 2017-07-05 14:40:26 +02:00
dax.c fs/dax.c: fix inefficiency in dax_writeback_mapping_range() 2018-02-28 10:18:33 +01:00
dcache.c Hang/soft lockup in d_invalidate with simultaneous calls 2019-03-27 14:13:04 +09:00
dcookies.c
direct-io.c direct-io: allow direct writes to empty inodes 2019-03-05 17:57:05 +01:00
drop_caches.c fs/drop_caches.c: avoid softlockups in drop_pagecache_sb() 2019-03-13 14:04:58 -07:00
eventfd.c
eventpoll.c fs/epoll: drop ovflist branch prediction 2019-02-12 19:44:59 +01:00
exec.c sched/fair: Don't free p->numa_faults with concurrent readers 2019-08-04 09:33:45 +02:00
fcntl.c fs/fcntl: f_setown, avoid undefined behaviour 2018-01-31 12:55:52 +01:00
fhandle.c
file.c fs/file.c: initialize init_files.resize_wait 2019-04-05 22:29:07 +02:00
file_table.c
filesystems.c
fs-writeback.c cgroup,writeback: don't switch wbs immediately on dead wbs if the memcg is dead 2019-11-12 19:16:11 +01:00
fs_pin.c
fs_struct.c
inode.c Abort file_remove_privs() for non-reg. files 2019-06-22 08:17:24 +02:00
internal.h xfs: evict all inodes involved with log redo item 2017-09-20 08:20:01 +02:00
ioctl.c
iomap.c iomap: fix integer truncation issues in the zeroing and dirtying helpers 2017-09-20 08:19:59 +02:00
Kconfig mm/hugetlb: introduce ARCH_HAS_GIGANTIC_PAGE 2016-10-07 18:46:29 -07:00
Kconfig.binfmt
libfs.c Fix the locking in dcache_readdir() and friends 2019-10-17 13:42:45 -07:00
locks.c locking, fs/locks: Add missing file_sem locks 2016-10-18 12:21:28 +02:00
Makefile
mbcache.c mbcache: initialize entry->e_referenced in mb_cache_entry_create() 2018-02-22 15:43:48 +01:00
mount.h mnt: In propgate_umount handle visiting mounts in any order 2017-07-21 07:42:22 +02:00
mpage.c fs/mpage.c: fix mpage_writepage() for pages with buffers 2017-10-18 09:35:39 +02:00
namei.c namei: allow restricted O_CREAT of FIFOs and regular files 2018-12-01 09:44:25 +01:00
namespace.c mount: Prevent MNT_DETACH from disconnecting locked mounts 2018-11-21 09:26:02 +01:00
no-block.c
nsfs.c nsfs: mark dentry with DCACHE_RCUACCESS 2018-02-17 13:21:15 +01:00
open.c access: avoid the RCU grace period for the temporary subjective credentials 2019-08-04 09:33:43 +02:00
pipe.c fs: prevent page refcount overflow in pipe_buf_get 2019-06-11 12:22:45 +02:00
pnode.c mnt: Make propagate_umount less slow for overlapping mount propagation trees 2017-07-21 07:42:22 +02:00
pnode.h mnt: Tuck mounts under others instead of creating shadow/side mounts. 2017-03-15 10:02:43 +08:00
posix_acl.c tmpfs: clear S_ISGID when setting posix ACLs 2017-01-26 08:24:37 +01:00
proc_namespace.c
read_write.c fs: stream_open - opener for stream-like files so that read and write can run simultaneously without deadlock 2019-06-11 12:22:49 +02:00
readdir.c
select.c fs/select: add vmalloc fallback for select(2) 2016-10-11 15:06:30 -07:00
seq_file.c seq/proc: modify seq_put_decimal_[u]ll to take a const char *, not char 2016-10-07 18:46:30 -07:00
signalfd.c
splice.c fs: prevent page refcount overflow in pipe_buf_get 2019-06-11 12:22:45 +02:00
stack.c
stat.c ufs: restore maintaining ->i_blocks 2017-06-14 15:06:01 +02:00
statfs.c
super.c fs: don't scan the inode cache before SB_BORN is set 2019-02-06 17:33:29 +01:00
sync.c
timerfd.c timerfd: Protect the might cancel mechanism proper 2017-05-08 07:47:54 +02:00
userfaultfd.c userfaultfd_release: always remove uffd flags and clear vm_userfaultfd_ctx 2019-09-06 10:19:37 +02:00
utimes.c Merge remote-tracking branch 'jk/vfs' into work.misc 2016-10-08 11:06:08 -04:00
xattr.c sysfs: Do not return POSIX ACL xattrs via listxattr 2018-10-10 08:53:22 +02:00