linux-stable/fs
Filipe Manana 5fdd05dc81 btrfs: fix extent buffer leak on failure to copy root
commit 72c9925f87 upstream.

At btrfs_copy_root(), if the call to btrfs_inc_ref() fails we end up
returning without unlocking and releasing our reference on the extent
buffer named "cow" we previously allocated with btrfs_alloc_tree_block().

So fix that by unlocking the extent buffer and dropping our reference on
it before returning.

Fixes: be20aa9dba ("Btrfs: Add mount option to turn off data cow")
CC: stable@vger.kernel.org # 4.4+
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-03 17:44:43 +01:00
..
9p 9P: Cast to loff_t before multiplying 2020-11-10 10:23:59 +01:00
adfs fs/adfs: super: fix use-after-free bug 2019-08-06 18:29:35 +02:00
affs affs: fix basic permission bits to actually work 2020-09-12 11:47:39 +02:00
afs afs: Fix large file support 2020-01-29 10:24:34 +01:00
autofs4 autofs: fix a leak in autofs_expire_indirect() 2019-12-21 10:40:46 +01:00
befs
bfs bfs: add sanity check at bfs_fill_super() 2018-12-01 09:44:19 +01:00
btrfs btrfs: fix extent buffer leak on failure to copy root 2021-03-03 17:44:43 +01:00
cachefiles cachefiles: Handle readpage error correctly 2020-11-10 10:24:00 +01:00
ceph ceph: fix race in concurrent __ceph_remove_cap invocations 2020-12-29 13:45:05 +01:00
cifs cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath. 2021-03-03 17:44:31 +01:00
coda coda: add error handling for fget 2019-08-06 18:29:38 +02:00
configfs configfs: fix config_item refcnt leak in configfs_rmdir() 2020-05-27 16:41:45 +02:00
cramfs Cramfs: fix abad comparison when wrap-arounds occur 2018-11-13 11:17:03 -08:00
crypto fscrypt: use EEXIST when file already uses different policy 2020-11-10 10:23:51 +01: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 fs: dlm: fix configfs memory leak 2020-10-29 09:05:43 +01:00
ecryptfs ecryptfs: Fix up bad backport of fe2e082f5d 2020-03-11 07:53:06 +01:00
efivarfs efivarfs: revert "fix memory leak in efivarfs_create()" 2020-12-02 08:31:28 +01:00
efs
exofs fs/exofs: fix potential memory leak in mount option parsing 2018-11-27 16:09:38 +01:00
exportfs exportfs: fix 'passing zero to ERR_PTR()' warning 2020-01-29 10:24:03 +01:00
ext2 ext2: fix missing percpu_counter_inc 2020-08-21 11:02:08 +02:00
ext4 ext4: fix superblock checksum failure when setting password salt 2021-01-23 15:38:17 +01:00
f2fs f2fs: fix to check segment boundary during SIT page readahead 2020-11-10 10:23:52 +01:00
fat fat: don't allow to mount if the FAT length == 0 2020-06-20 10:24:13 +02:00
freevxfs
fscache fscache: fix race between enablement and dropping of object 2018-12-17 09:38:34 +01:00
fuse fuse: fix page dereference after free 2020-11-10 10:23:51 +01:00
gfs2 gfs2: check for empty rgrp tree in gfs2_ri_update 2020-12-11 13:38:01 +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: fix crash and filesystem corruption when deleting files 2020-04-24 07:58:59 +02:00
hostfs
hpfs
hugetlbfs mm: hugetlbfs: fix cannot migrate the fallocated HugeTLB page 2021-02-10 09:09:26 +01:00
isofs isofs: release buffer head before return 2021-03-03 17:44:37 +01:00
jbd2 jbd2: abort journal if free a async write error metadata buffer 2020-09-03 11:21:19 +02:00
jffs2 jffs2: fix use after free in jffs2_sum_write_data() 2021-03-03 17:44:36 +01:00
jfs fs/jfs: fix potential integer overflow on shift of a int 2021-03-03 17:44:36 +01:00
kernfs kernfs: Fix range checks in kernfs_get_target_path 2019-11-25 09:52:23 +01:00
lockd lockd: don't use interval-based rebinding over TCP 2020-12-29 13:44:57 +01:00
logfs
minix fs/minix: reject too-large maximum file size 2020-08-21 11:02:06 +02:00
ncpfs ncpfs: fix build warning of strncpy 2019-03-13 14:04:52 -07:00
nfs NFS: nfs_igrab_and_active must first reference the superblock 2021-01-23 15:38:17 +01:00
nfs_common nfs_common: need lock during iterate through the list 2020-12-29 13:44:59 +01:00
nfsd nfsd4: readdirplus shouldn't return parent of export 2021-01-23 15:38:18 +01:00
nilfs2 nilfs2: fix null pointer dereference at nilfs_segctor_do_construct() 2020-06-20 10:24:09 +02:00
nls
notify fanotify: fix handling of events on child sub-directory 2019-02-06 17:33:30 +01:00
ntfs ntfs: check for valid standard information attribute 2021-03-03 17:44:31 +01:00
ocfs2 ocfs2: fix a use after free on error 2021-03-03 17:44:40 +01:00
omfs
openpromfs
orangefs help_next should increase position index 2020-02-28 15:42:43 +01:00
overlayfs ovl: skip getxattr of security labels 2021-02-23 13:59:15 +01:00
proc proc: don't allow async path resolution of /proc/self components 2020-12-02 08:31:26 +01:00
pstore pstore/ram: Write new dumps to start of recycled zones 2020-01-12 11:24:20 +01:00
qnx4
qnx6
quota quota: Don't overflow quota file offsets 2021-01-09 13:35:50 +01:00
ramfs
reiserfs reiserfs: add check for an invalid ih_entry_count 2021-01-09 13:35:49 +01:00
romfs romfs: fix uninitialized memory leak in romfs_dev_read() 2020-08-26 10:29:03 +02:00
squashfs squashfs: add more sanity checks in xattr id lookup 2021-02-23 13:59:15 +01: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
ubifs ubifs: wbuf: Don't leak kernel memory to flash 2021-01-17 13:57:54 +01:00
udf udf: Avoid accessing uninitialized data on failed inode read 2020-10-29 09:05:44 +01:00
ufs fs/ufs: avoid potential u32 multiplication overflow 2020-08-21 11:02:11 +02:00
xfs xfs: revert "xfs: fix rmap key and record comparison functions" 2020-11-24 13:03:04 +01:00
aio.c aio: fix spectre gadget in lookup_ioctx 2018-12-21 14:11:31 +01:00
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf.c fs/binfmt_elf.c: allocate initialized memory in fill_thread_core_info() 2020-06-03 08:16:42 +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 bdev: Reduce time holding bd_mutex in sync in blkdev_close() 2020-10-01 20:40:12 +02:00
buffer.c fs: Don't invalidate page buffers in block_write_full_page() 2020-11-10 10:23:56 +01:00
char_dev.c chardev: add helper function to register char devs with a struct device 2020-05-20 08:15:32 +02:00
compat.c
compat_binfmt_elf.c
compat_ioctl.c media: dvb_frontend: Add compat_ioctl callback 2020-06-30 15:38:35 -04:00
coredump.c
dax.c
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 ep_create_wakeup_source(): dentry name can change under you... 2020-10-14 09:48:13 +02:00
exec.c exit/exec: Seperate mm_release() 2021-02-03 23:19:49 +01:00
fcntl.c
fhandle.c
file.c fix multiplication overflow in copy_fdtable() 2020-05-27 16:41:40 +02:00
file_table.c
filesystems.c
fs-writeback.c memcg: fix a crash in wb_workfn when a device disappears 2021-02-23 13:59:15 +01:00
fs_pin.c
fs_struct.c
inode.c futex: Fix inode life-time issue 2020-04-02 17:20:27 +02:00
internal.h
ioctl.c
iomap.c
Kconfig
Kconfig.binfmt
libfs.c libfs: fix error cast of negative value in simple_attr_write() 2020-11-24 13:03:05 +01:00
locks.c locks: print unsigned ino in /proc/locks 2020-01-12 11:24:13 +01:00
Makefile
mbcache.c
mount.h
mpage.c
namei.c namei: only return -ECHILD from follow_dotdot_rcu() 2020-03-11 07:53:07 +01:00
namespace.c fs/namespace.c: fix mountpoint reference counter race 2020-05-02 17:23:10 +02:00
no-block.c
nsfs.c
open.c cifs_atomic_open(): fix double-put on late allocation failure 2020-03-20 09:07:44 +01:00
pipe.c fs: prevent page refcount overflow in pipe_buf_get 2019-06-11 12:22:45 +02:00
pnode.c propagate_one(): mnt_set_mountpoint() needs mount_lock 2020-05-02 17:23:20 +02:00
pnode.h
posix_acl.c
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 filldir[64]: remove WARN_ON_ONCE() for bad directory entries 2020-01-04 13:41:06 +01:00
select.c
seq_file.c
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
statfs.c
super.c vfs: remove lockdep bogosity in __sb_start_write 2020-11-24 13:03:00 +01:00
sync.c
timerfd.c
userfaultfd.c userfaultfd_release: always remove uffd flags and clear vm_userfaultfd_ctx 2019-09-06 10:19:37 +02:00
utimes.c
xattr.c xattr: break delegations in {set,remove}xattr 2020-08-21 11:01:55 +02:00