--- /dev/null
+From 6b04114f6fae5e84d33404c2970b1949c032546e Mon Sep 17 00:00:00 2001
+From: Alexey Brodkin <abrodkin@synopsys.com>
+Date: Tue, 20 Nov 2018 13:30:19 +0300
+Subject: arc: [devboards] Add support of NFSv3 ACL
+
+From: Alexey Brodkin <abrodkin@synopsys.com>
+
+commit 6b04114f6fae5e84d33404c2970b1949c032546e upstream.
+
+By default NFSv3 doesn't support ACL (Access Control Lists)
+which might be quite convenient to have so that
+mounted NFS behaves exactly as any other local file-system.
+
+In particular missing support of ACL makes umask useless.
+This among other thigs fixes Glibc's "nptl/tst-umask1".
+
+Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
+Cc: Cupertino Miranda <cmiranda@synopsys.com>
+Cc: stable@vger.kernel.org #4.14+
+Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arc/configs/axs101_defconfig | 1 +
+ arch/arc/configs/axs103_defconfig | 1 +
+ arch/arc/configs/axs103_smp_defconfig | 1 +
+ arch/arc/configs/nps_defconfig | 1 +
+ arch/arc/configs/nsimosci_defconfig | 1 +
+ arch/arc/configs/nsimosci_hs_defconfig | 1 +
+ arch/arc/configs/nsimosci_hs_smp_defconfig | 1 +
+ arch/arc/configs/vdk_hs38_defconfig | 1 +
+ arch/arc/configs/vdk_hs38_smp_defconfig | 1 +
+ 9 files changed, 9 insertions(+)
+
+--- a/arch/arc/configs/axs101_defconfig
++++ b/arch/arc/configs/axs101_defconfig
+@@ -97,6 +97,7 @@ CONFIG_VFAT_FS=y
+ CONFIG_NTFS_FS=y
+ CONFIG_TMPFS=y
+ CONFIG_NFS_FS=y
++CONFIG_NFS_V3_ACL=y
+ CONFIG_NLS_CODEPAGE_437=y
+ CONFIG_NLS_ISO8859_1=y
+ # CONFIG_ENABLE_WARN_DEPRECATED is not set
+--- a/arch/arc/configs/axs103_defconfig
++++ b/arch/arc/configs/axs103_defconfig
+@@ -97,6 +97,7 @@ CONFIG_VFAT_FS=y
+ CONFIG_NTFS_FS=y
+ CONFIG_TMPFS=y
+ CONFIG_NFS_FS=y
++CONFIG_NFS_V3_ACL=y
+ CONFIG_NLS_CODEPAGE_437=y
+ CONFIG_NLS_ISO8859_1=y
+ # CONFIG_ENABLE_WARN_DEPRECATED is not set
+--- a/arch/arc/configs/axs103_smp_defconfig
++++ b/arch/arc/configs/axs103_smp_defconfig
+@@ -98,6 +98,7 @@ CONFIG_VFAT_FS=y
+ CONFIG_NTFS_FS=y
+ CONFIG_TMPFS=y
+ CONFIG_NFS_FS=y
++CONFIG_NFS_V3_ACL=y
+ CONFIG_NLS_CODEPAGE_437=y
+ CONFIG_NLS_ISO8859_1=y
+ # CONFIG_ENABLE_WARN_DEPRECATED is not set
+--- a/arch/arc/configs/nps_defconfig
++++ b/arch/arc/configs/nps_defconfig
+@@ -76,6 +76,7 @@ CONFIG_PROC_KCORE=y
+ CONFIG_TMPFS=y
+ # CONFIG_MISC_FILESYSTEMS is not set
+ CONFIG_NFS_FS=y
++CONFIG_NFS_V3_ACL=y
+ CONFIG_ROOT_NFS=y
+ CONFIG_DEBUG_INFO=y
+ # CONFIG_ENABLE_WARN_DEPRECATED is not set
+--- a/arch/arc/configs/nsimosci_defconfig
++++ b/arch/arc/configs/nsimosci_defconfig
+@@ -71,5 +71,6 @@ CONFIG_EXT2_FS_XATTR=y
+ CONFIG_TMPFS=y
+ # CONFIG_MISC_FILESYSTEMS is not set
+ CONFIG_NFS_FS=y
++CONFIG_NFS_V3_ACL=y
+ # CONFIG_ENABLE_WARN_DEPRECATED is not set
+ # CONFIG_ENABLE_MUST_CHECK is not set
+--- a/arch/arc/configs/nsimosci_hs_defconfig
++++ b/arch/arc/configs/nsimosci_hs_defconfig
+@@ -69,5 +69,6 @@ CONFIG_EXT2_FS_XATTR=y
+ CONFIG_TMPFS=y
+ # CONFIG_MISC_FILESYSTEMS is not set
+ CONFIG_NFS_FS=y
++CONFIG_NFS_V3_ACL=y
+ # CONFIG_ENABLE_WARN_DEPRECATED is not set
+ # CONFIG_ENABLE_MUST_CHECK is not set
+--- a/arch/arc/configs/nsimosci_hs_smp_defconfig
++++ b/arch/arc/configs/nsimosci_hs_smp_defconfig
+@@ -80,6 +80,7 @@ CONFIG_EXT2_FS_XATTR=y
+ CONFIG_TMPFS=y
+ # CONFIG_MISC_FILESYSTEMS is not set
+ CONFIG_NFS_FS=y
++CONFIG_NFS_V3_ACL=y
+ # CONFIG_ENABLE_WARN_DEPRECATED is not set
+ # CONFIG_ENABLE_MUST_CHECK is not set
+ CONFIG_FTRACE=y
+--- a/arch/arc/configs/vdk_hs38_defconfig
++++ b/arch/arc/configs/vdk_hs38_defconfig
+@@ -88,6 +88,7 @@ CONFIG_NTFS_FS=y
+ CONFIG_TMPFS=y
+ CONFIG_JFFS2_FS=y
+ CONFIG_NFS_FS=y
++CONFIG_NFS_V3_ACL=y
+ CONFIG_NLS_CODEPAGE_437=y
+ CONFIG_NLS_ISO8859_1=y
+ # CONFIG_ENABLE_WARN_DEPRECATED is not set
+--- a/arch/arc/configs/vdk_hs38_smp_defconfig
++++ b/arch/arc/configs/vdk_hs38_smp_defconfig
+@@ -87,6 +87,7 @@ CONFIG_NTFS_FS=y
+ CONFIG_TMPFS=y
+ CONFIG_JFFS2_FS=y
+ CONFIG_NFS_FS=y
++CONFIG_NFS_V3_ACL=y
+ CONFIG_NLS_CODEPAGE_437=y
+ CONFIG_NLS_ISO8859_1=y
+ # CONFIG_ENABLE_WARN_DEPRECATED is not set
--- /dev/null
+From b7cc40c32a8bfa6f2581a71747f6a7d491fe43ba Mon Sep 17 00:00:00 2001
+From: Kevin Hilman <khilman@baylibre.com>
+Date: Fri, 30 Nov 2018 15:51:56 +0300
+Subject: ARC: change defconfig defaults to ARCv2
+
+From: Kevin Hilman <khilman@baylibre.com>
+
+commit b7cc40c32a8bfa6f2581a71747f6a7d491fe43ba upstream.
+
+Change the default defconfig (used with 'make defconfig') to the ARCv2
+nsim_hs_defconfig, and also switch the default Kconfig ISA selection to
+ARCv2.
+
+This allows several default defconfigs (e.g. make defconfig, make
+allnoconfig, make tinyconfig) to all work with ARCv2 by default.
+
+Note since we change default architecture from ARCompact to ARCv2
+it's required to explicitly mention architecture type in ARCompact
+defconfigs otherwise ARCv2 will be implied and binaries will be
+generated for ARCv2.
+
+Cc: <stable@vger.kernel.org> # 4.4.x
+Signed-off-by: Kevin Hilman <khilman@baylibre.com>
+Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
+Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arc/Kconfig | 2 +-
+ arch/arc/Makefile | 2 +-
+ arch/arc/configs/axs101_defconfig | 1 +
+ arch/arc/configs/nps_defconfig | 1 +
+ arch/arc/configs/nsim_700_defconfig | 1 +
+ arch/arc/configs/nsimosci_defconfig | 1 +
+ arch/arc/configs/tb10x_defconfig | 1 +
+ 7 files changed, 7 insertions(+), 2 deletions(-)
+
+--- a/arch/arc/Kconfig
++++ b/arch/arc/Kconfig
+@@ -105,7 +105,7 @@ endmenu
+
+ choice
+ prompt "ARC Instruction Set"
+- default ISA_ARCOMPACT
++ default ISA_ARCV2
+
+ config ISA_ARCOMPACT
+ bool "ARCompact ISA"
+--- a/arch/arc/Makefile
++++ b/arch/arc/Makefile
+@@ -8,7 +8,7 @@
+
+ UTS_MACHINE := arc
+
+-KBUILD_DEFCONFIG := nsim_700_defconfig
++KBUILD_DEFCONFIG := nsim_hs_defconfig
+
+ cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
+ cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7
+--- a/arch/arc/configs/axs101_defconfig
++++ b/arch/arc/configs/axs101_defconfig
+@@ -15,6 +15,7 @@ CONFIG_PERF_EVENTS=y
+ # CONFIG_VM_EVENT_COUNTERS is not set
+ # CONFIG_SLUB_DEBUG is not set
+ # CONFIG_COMPAT_BRK is not set
++CONFIG_ISA_ARCOMPACT=y
+ CONFIG_MODULES=y
+ CONFIG_MODULE_FORCE_LOAD=y
+ CONFIG_MODULE_UNLOAD=y
+--- a/arch/arc/configs/nps_defconfig
++++ b/arch/arc/configs/nps_defconfig
+@@ -15,6 +15,7 @@ CONFIG_SYSCTL_SYSCALL=y
+ CONFIG_EMBEDDED=y
+ CONFIG_PERF_EVENTS=y
+ # CONFIG_COMPAT_BRK is not set
++CONFIG_ISA_ARCOMPACT=y
+ CONFIG_KPROBES=y
+ CONFIG_MODULES=y
+ CONFIG_MODULE_FORCE_LOAD=y
+--- a/arch/arc/configs/nsim_700_defconfig
++++ b/arch/arc/configs/nsim_700_defconfig
+@@ -16,6 +16,7 @@ CONFIG_EMBEDDED=y
+ CONFIG_PERF_EVENTS=y
+ # CONFIG_SLUB_DEBUG is not set
+ # CONFIG_COMPAT_BRK is not set
++CONFIG_ISA_ARCOMPACT=y
+ CONFIG_KPROBES=y
+ CONFIG_MODULES=y
+ # CONFIG_LBDAF is not set
+--- a/arch/arc/configs/nsimosci_defconfig
++++ b/arch/arc/configs/nsimosci_defconfig
+@@ -16,6 +16,7 @@ CONFIG_EMBEDDED=y
+ CONFIG_PERF_EVENTS=y
+ # CONFIG_SLUB_DEBUG is not set
+ # CONFIG_COMPAT_BRK is not set
++CONFIG_ISA_ARCOMPACT=y
+ CONFIG_KPROBES=y
+ CONFIG_MODULES=y
+ # CONFIG_LBDAF is not set
+--- a/arch/arc/configs/tb10x_defconfig
++++ b/arch/arc/configs/tb10x_defconfig
+@@ -19,6 +19,7 @@ CONFIG_KALLSYMS_ALL=y
+ # CONFIG_AIO is not set
+ CONFIG_EMBEDDED=y
+ # CONFIG_COMPAT_BRK is not set
++CONFIG_ISA_ARCOMPACT=y
+ CONFIG_SLAB=y
+ CONFIG_MODULES=y
+ CONFIG_MODULE_FORCE_LOAD=y
--- /dev/null
+From f8397d69daef06d358430d3054662fb597e37c00 Mon Sep 17 00:00:00 2001
+From: Nikolay Borisov <nborisov@suse.com>
+Date: Tue, 6 Nov 2018 16:40:20 +0200
+Subject: btrfs: Always try all copies when reading extent buffers
+
+From: Nikolay Borisov <nborisov@suse.com>
+
+commit f8397d69daef06d358430d3054662fb597e37c00 upstream.
+
+When a metadata read is served the endio routine btree_readpage_end_io_hook
+is called which eventually runs the tree-checker. If tree-checker fails
+to validate the read eb then it sets EXTENT_BUFFER_CORRUPT flag. This
+leads to btree_read_extent_buffer_pages wrongly assuming that all
+available copies of this extent buffer are wrong and failing prematurely.
+Fix this modify btree_read_extent_buffer_pages to read all copies of
+the data.
+
+This failure was exhibitted in xfstests btrfs/124 which would
+spuriously fail its balance operations. The reason was that when balance
+was run following re-introduction of the missing raid1 disk
+__btrfs_map_block would map the read request to stripe 0, which
+corresponded to devid 2 (the disk which is being removed in the test):
+
+ item 2 key (FIRST_CHUNK_TREE CHUNK_ITEM 3553624064) itemoff 15975 itemsize 112
+ length 1073741824 owner 2 stripe_len 65536 type DATA|RAID1
+ io_align 65536 io_width 65536 sector_size 4096
+ num_stripes 2 sub_stripes 1
+ stripe 0 devid 2 offset 2156920832
+ dev_uuid 8466c350-ed0c-4c3b-b17d-6379b445d5c8
+ stripe 1 devid 1 offset 3553624064
+ dev_uuid 1265d8db-5596-477e-af03-df08eb38d2ca
+
+This caused read requests for a checksum item that to be routed to the
+stale disk which triggered the aforementioned logic involving
+EXTENT_BUFFER_CORRUPT flag. This then triggered cascading failures of
+the balance operation.
+
+Fixes: a826d6dcb32d ("Btrfs: check items for correctness as we search")
+CC: stable@vger.kernel.org # 4.4+
+Suggested-by: Qu Wenruo <wqu@suse.com>
+Reviewed-by: Qu Wenruo <wqu@suse.com>
+Signed-off-by: Nikolay Borisov <nborisov@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/btrfs/disk-io.c | 10 +---------
+ 1 file changed, 1 insertion(+), 9 deletions(-)
+
+--- a/fs/btrfs/disk-io.c
++++ b/fs/btrfs/disk-io.c
+@@ -452,9 +452,9 @@ static int btree_read_extent_buffer_page
+ int mirror_num = 0;
+ int failed_mirror = 0;
+
+- clear_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags);
+ io_tree = &BTRFS_I(root->fs_info->btree_inode)->io_tree;
+ while (1) {
++ clear_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags);
+ ret = read_extent_buffer_pages(io_tree, eb, WAIT_COMPLETE,
+ btree_get_extent, mirror_num);
+ if (!ret) {
+@@ -465,14 +465,6 @@ static int btree_read_extent_buffer_page
+ ret = -EIO;
+ }
+
+- /*
+- * This buffer's crc is fine, but its contents are corrupted, so
+- * there is no reason to read the other copies, they won't be
+- * any less wrong.
+- */
+- if (test_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags))
+- break;
+-
+ num_copies = btrfs_num_copies(root->fs_info,
+ eb->start, eb->len);
+ if (num_copies == 1)
--- /dev/null
+From 9084cb6a24bf5838a665af92ded1af8363f9e563 Mon Sep 17 00:00:00 2001
+From: Filipe Manana <fdmanana@suse.com>
+Date: Mon, 22 Oct 2018 10:43:06 +0100
+Subject: Btrfs: fix use-after-free when dumping free space
+
+From: Filipe Manana <fdmanana@suse.com>
+
+commit 9084cb6a24bf5838a665af92ded1af8363f9e563 upstream.
+
+We were iterating a block group's free space cache rbtree without locking
+first the lock that protects it (the free_space_ctl->free_space_offset
+rbtree is protected by the free_space_ctl->tree_lock spinlock).
+
+KASAN reported an use-after-free problem when iterating such a rbtree due
+to a concurrent rbtree delete:
+
+[ 9520.359168] ==================================================================
+[ 9520.359656] BUG: KASAN: use-after-free in rb_next+0x13/0x90
+[ 9520.359949] Read of size 8 at addr ffff8800b7ada500 by task btrfs-transacti/1721
+[ 9520.360357]
+[ 9520.360530] CPU: 4 PID: 1721 Comm: btrfs-transacti Tainted: G L 4.19.0-rc8-nbor #555
+[ 9520.360990] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
+[ 9520.362682] Call Trace:
+[ 9520.362887] dump_stack+0xa4/0xf5
+[ 9520.363146] print_address_description+0x78/0x280
+[ 9520.363412] kasan_report+0x263/0x390
+[ 9520.363650] ? rb_next+0x13/0x90
+[ 9520.363873] __asan_load8+0x54/0x90
+[ 9520.364102] rb_next+0x13/0x90
+[ 9520.364380] btrfs_dump_free_space+0x146/0x160 [btrfs]
+[ 9520.364697] dump_space_info+0x2cd/0x310 [btrfs]
+[ 9520.364997] btrfs_reserve_extent+0x1ee/0x1f0 [btrfs]
+[ 9520.365310] __btrfs_prealloc_file_range+0x1cc/0x620 [btrfs]
+[ 9520.365646] ? btrfs_update_time+0x180/0x180 [btrfs]
+[ 9520.365923] ? _raw_spin_unlock+0x27/0x40
+[ 9520.366204] ? btrfs_alloc_data_chunk_ondemand+0x2c0/0x5c0 [btrfs]
+[ 9520.366549] btrfs_prealloc_file_range_trans+0x23/0x30 [btrfs]
+[ 9520.366880] cache_save_setup+0x42e/0x580 [btrfs]
+[ 9520.367220] ? btrfs_check_data_free_space+0xd0/0xd0 [btrfs]
+[ 9520.367518] ? lock_downgrade+0x2f0/0x2f0
+[ 9520.367799] ? btrfs_write_dirty_block_groups+0x11f/0x6e0 [btrfs]
+[ 9520.368104] ? kasan_check_read+0x11/0x20
+[ 9520.368349] ? do_raw_spin_unlock+0xa8/0x140
+[ 9520.368638] btrfs_write_dirty_block_groups+0x2af/0x6e0 [btrfs]
+[ 9520.368978] ? btrfs_start_dirty_block_groups+0x870/0x870 [btrfs]
+[ 9520.369282] ? do_raw_spin_unlock+0xa8/0x140
+[ 9520.369534] ? _raw_spin_unlock+0x27/0x40
+[ 9520.369811] ? btrfs_run_delayed_refs+0x1b8/0x230 [btrfs]
+[ 9520.370137] commit_cowonly_roots+0x4b9/0x610 [btrfs]
+[ 9520.370560] ? commit_fs_roots+0x350/0x350 [btrfs]
+[ 9520.370926] ? btrfs_run_delayed_refs+0x1b8/0x230 [btrfs]
+[ 9520.371285] btrfs_commit_transaction+0x5e5/0x10e0 [btrfs]
+[ 9520.371612] ? btrfs_apply_pending_changes+0x90/0x90 [btrfs]
+[ 9520.371943] ? start_transaction+0x168/0x6c0 [btrfs]
+[ 9520.372257] transaction_kthread+0x21c/0x240 [btrfs]
+[ 9520.372537] kthread+0x1d2/0x1f0
+[ 9520.372793] ? btrfs_cleanup_transaction+0xb50/0xb50 [btrfs]
+[ 9520.373090] ? kthread_park+0xb0/0xb0
+[ 9520.373329] ret_from_fork+0x3a/0x50
+[ 9520.373567]
+[ 9520.373738] Allocated by task 1804:
+[ 9520.373974] kasan_kmalloc+0xff/0x180
+[ 9520.374208] kasan_slab_alloc+0x11/0x20
+[ 9520.374447] kmem_cache_alloc+0xfc/0x2d0
+[ 9520.374731] __btrfs_add_free_space+0x40/0x580 [btrfs]
+[ 9520.375044] unpin_extent_range+0x4f7/0x7a0 [btrfs]
+[ 9520.375383] btrfs_finish_extent_commit+0x15f/0x4d0 [btrfs]
+[ 9520.375707] btrfs_commit_transaction+0xb06/0x10e0 [btrfs]
+[ 9520.376027] btrfs_alloc_data_chunk_ondemand+0x237/0x5c0 [btrfs]
+[ 9520.376365] btrfs_check_data_free_space+0x81/0xd0 [btrfs]
+[ 9520.376689] btrfs_delalloc_reserve_space+0x25/0x80 [btrfs]
+[ 9520.377018] btrfs_direct_IO+0x42e/0x6d0 [btrfs]
+[ 9520.377284] generic_file_direct_write+0x11e/0x220
+[ 9520.377587] btrfs_file_write_iter+0x472/0xac0 [btrfs]
+[ 9520.377875] aio_write+0x25c/0x360
+[ 9520.378106] io_submit_one+0xaa0/0xdc0
+[ 9520.378343] __se_sys_io_submit+0xfa/0x2f0
+[ 9520.378589] __x64_sys_io_submit+0x43/0x50
+[ 9520.378840] do_syscall_64+0x7d/0x240
+[ 9520.379081] entry_SYSCALL_64_after_hwframe+0x49/0xbe
+[ 9520.379387]
+[ 9520.379557] Freed by task 1802:
+[ 9520.379782] __kasan_slab_free+0x173/0x260
+[ 9520.380028] kasan_slab_free+0xe/0x10
+[ 9520.380262] kmem_cache_free+0xc1/0x2c0
+[ 9520.380544] btrfs_find_space_for_alloc+0x4cd/0x4e0 [btrfs]
+[ 9520.380866] find_free_extent+0xa99/0x17e0 [btrfs]
+[ 9520.381166] btrfs_reserve_extent+0xd5/0x1f0 [btrfs]
+[ 9520.381474] btrfs_get_blocks_direct+0x60b/0xbd0 [btrfs]
+[ 9520.381761] __blockdev_direct_IO+0x10ee/0x58a1
+[ 9520.382059] btrfs_direct_IO+0x25a/0x6d0 [btrfs]
+[ 9520.382321] generic_file_direct_write+0x11e/0x220
+[ 9520.382623] btrfs_file_write_iter+0x472/0xac0 [btrfs]
+[ 9520.382904] aio_write+0x25c/0x360
+[ 9520.383172] io_submit_one+0xaa0/0xdc0
+[ 9520.383416] __se_sys_io_submit+0xfa/0x2f0
+[ 9520.383678] __x64_sys_io_submit+0x43/0x50
+[ 9520.383927] do_syscall_64+0x7d/0x240
+[ 9520.384165] entry_SYSCALL_64_after_hwframe+0x49/0xbe
+[ 9520.384439]
+[ 9520.384610] The buggy address belongs to the object at ffff8800b7ada500
+ which belongs to the cache btrfs_free_space of size 72
+[ 9520.385175] The buggy address is located 0 bytes inside of
+ 72-byte region [ffff8800b7ada500, ffff8800b7ada548)
+[ 9520.385691] The buggy address belongs to the page:
+[ 9520.385957] page:ffffea0002deb680 count:1 mapcount:0 mapping:ffff880108a1d700 index:0x0 compound_mapcount: 0
+[ 9520.388030] flags: 0x8100(slab|head)
+[ 9520.388281] raw: 0000000000008100 ffffea0002deb608 ffffea0002728808 ffff880108a1d700
+[ 9520.388722] raw: 0000000000000000 0000000000130013 00000001ffffffff 0000000000000000
+[ 9520.389169] page dumped because: kasan: bad access detected
+[ 9520.389473]
+[ 9520.389658] Memory state around the buggy address:
+[ 9520.389943] ffff8800b7ada400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
+[ 9520.390368] ffff8800b7ada480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
+[ 9520.390796] >ffff8800b7ada500: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
+[ 9520.391223] ^
+[ 9520.391461] ffff8800b7ada580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
+[ 9520.391885] ffff8800b7ada600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
+[ 9520.392313] ==================================================================
+[ 9520.392772] BTRFS critical (device vdc): entry offset 2258497536, bytes 131072, bitmap no
+[ 9520.393247] BUG: unable to handle kernel NULL pointer dereference at 0000000000000011
+[ 9520.393705] PGD 800000010dbab067 P4D 800000010dbab067 PUD 107551067 PMD 0
+[ 9520.394059] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN PTI
+[ 9520.394378] CPU: 4 PID: 1721 Comm: btrfs-transacti Tainted: G B L 4.19.0-rc8-nbor #555
+[ 9520.394858] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
+[ 9520.395350] RIP: 0010:rb_next+0x3c/0x90
+[ 9520.396461] RSP: 0018:ffff8801074ff780 EFLAGS: 00010292
+[ 9520.396762] RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffffffff81b5ac4c
+[ 9520.397115] RDX: 0000000000000000 RSI: 0000000000000008 RDI: 0000000000000011
+[ 9520.397468] RBP: ffff8801074ff7a0 R08: ffffed0021d64ccc R09: ffffed0021d64ccc
+[ 9520.397821] R10: 0000000000000001 R11: ffffed0021d64ccb R12: ffff8800b91e0000
+[ 9520.398188] R13: ffff8800a3ceba48 R14: ffff8800b627bf80 R15: 0000000000020000
+[ 9520.398555] FS: 0000000000000000(0000) GS:ffff88010eb00000(0000) knlGS:0000000000000000
+[ 9520.399007] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+[ 9520.399335] CR2: 0000000000000011 CR3: 0000000106b52000 CR4: 00000000000006a0
+[ 9520.399679] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+[ 9520.400023] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
+[ 9520.400400] Call Trace:
+[ 9520.400648] btrfs_dump_free_space+0x146/0x160 [btrfs]
+[ 9520.400974] dump_space_info+0x2cd/0x310 [btrfs]
+[ 9520.401287] btrfs_reserve_extent+0x1ee/0x1f0 [btrfs]
+[ 9520.401609] __btrfs_prealloc_file_range+0x1cc/0x620 [btrfs]
+[ 9520.401952] ? btrfs_update_time+0x180/0x180 [btrfs]
+[ 9520.402232] ? _raw_spin_unlock+0x27/0x40
+[ 9520.402522] ? btrfs_alloc_data_chunk_ondemand+0x2c0/0x5c0 [btrfs]
+[ 9520.402882] btrfs_prealloc_file_range_trans+0x23/0x30 [btrfs]
+[ 9520.403261] cache_save_setup+0x42e/0x580 [btrfs]
+[ 9520.403570] ? btrfs_check_data_free_space+0xd0/0xd0 [btrfs]
+[ 9520.403871] ? lock_downgrade+0x2f0/0x2f0
+[ 9520.404161] ? btrfs_write_dirty_block_groups+0x11f/0x6e0 [btrfs]
+[ 9520.404481] ? kasan_check_read+0x11/0x20
+[ 9520.404732] ? do_raw_spin_unlock+0xa8/0x140
+[ 9520.405026] btrfs_write_dirty_block_groups+0x2af/0x6e0 [btrfs]
+[ 9520.405375] ? btrfs_start_dirty_block_groups+0x870/0x870 [btrfs]
+[ 9520.405694] ? do_raw_spin_unlock+0xa8/0x140
+[ 9520.405958] ? _raw_spin_unlock+0x27/0x40
+[ 9520.406243] ? btrfs_run_delayed_refs+0x1b8/0x230 [btrfs]
+[ 9520.406574] commit_cowonly_roots+0x4b9/0x610 [btrfs]
+[ 9520.406899] ? commit_fs_roots+0x350/0x350 [btrfs]
+[ 9520.407253] ? btrfs_run_delayed_refs+0x1b8/0x230 [btrfs]
+[ 9520.407589] btrfs_commit_transaction+0x5e5/0x10e0 [btrfs]
+[ 9520.407925] ? btrfs_apply_pending_changes+0x90/0x90 [btrfs]
+[ 9520.408262] ? start_transaction+0x168/0x6c0 [btrfs]
+[ 9520.408582] transaction_kthread+0x21c/0x240 [btrfs]
+[ 9520.408870] kthread+0x1d2/0x1f0
+[ 9520.409138] ? btrfs_cleanup_transaction+0xb50/0xb50 [btrfs]
+[ 9520.409440] ? kthread_park+0xb0/0xb0
+[ 9520.409682] ret_from_fork+0x3a/0x50
+[ 9520.410508] Dumping ftrace buffer:
+[ 9520.410764] (ftrace buffer empty)
+[ 9520.411007] CR2: 0000000000000011
+[ 9520.411297] ---[ end trace 01a0863445cf360a ]---
+[ 9520.411568] RIP: 0010:rb_next+0x3c/0x90
+[ 9520.412644] RSP: 0018:ffff8801074ff780 EFLAGS: 00010292
+[ 9520.412932] RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffffffff81b5ac4c
+[ 9520.413274] RDX: 0000000000000000 RSI: 0000000000000008 RDI: 0000000000000011
+[ 9520.413616] RBP: ffff8801074ff7a0 R08: ffffed0021d64ccc R09: ffffed0021d64ccc
+[ 9520.414007] R10: 0000000000000001 R11: ffffed0021d64ccb R12: ffff8800b91e0000
+[ 9520.414349] R13: ffff8800a3ceba48 R14: ffff8800b627bf80 R15: 0000000000020000
+[ 9520.416074] FS: 0000000000000000(0000) GS:ffff88010eb00000(0000) knlGS:0000000000000000
+[ 9520.416536] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+[ 9520.416848] CR2: 0000000000000011 CR3: 0000000106b52000 CR4: 00000000000006a0
+[ 9520.418477] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+[ 9520.418846] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
+[ 9520.419204] Kernel panic - not syncing: Fatal exception
+[ 9520.419666] Dumping ftrace buffer:
+[ 9520.419930] (ftrace buffer empty)
+[ 9520.420168] Kernel Offset: disabled
+[ 9520.420406] ---[ end Kernel panic - not syncing: Fatal exception ]---
+
+Fix this by acquiring the respective lock before iterating the rbtree.
+
+Reported-by: Nikolay Borisov <nborisov@suse.com>
+CC: stable@vger.kernel.org # 4.4+
+Reviewed-by: Josef Bacik <josef@toxicpanda.com>
+Signed-off-by: Filipe Manana <fdmanana@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Cc: Nikolay Borisov <nborisov@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/btrfs/free-space-cache.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/fs/btrfs/free-space-cache.c
++++ b/fs/btrfs/free-space-cache.c
+@@ -2464,6 +2464,7 @@ void btrfs_dump_free_space(struct btrfs_
+ struct rb_node *n;
+ int count = 0;
+
++ spin_lock(&ctl->tree_lock);
+ for (n = rb_first(&ctl->free_space_offset); n; n = rb_next(n)) {
+ info = rb_entry(n, struct btrfs_free_space, offset_index);
+ if (info->bytes >= bytes && !block_group->ro)
+@@ -2473,6 +2474,7 @@ void btrfs_dump_free_space(struct btrfs_
+ info->offset, info->bytes,
+ (info->bitmap) ? "yes" : "no");
+ }
++ spin_unlock(&ctl->tree_lock);
+ btrfs_info(block_group->fs_info, "block group has cluster?: %s",
+ list_empty(&block_group->cluster_list) ? "no" : "yes");
+ btrfs_info(block_group->fs_info,
--- /dev/null
+From ceff2f4dcd44abf35864d9a99f85ac619e89a01d Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Mon, 27 Aug 2018 10:21:46 +0200
+Subject: drm/mediatek: fix OF sibling-node lookup
+
+From: Johan Hovold <johan@kernel.org>
+
+commit ceff2f4dcd44abf35864d9a99f85ac619e89a01d upstream.
+
+Use the new of_get_compatible_child() helper to lookup the sibling
+instead of using of_find_compatible_node(), which searches the entire
+tree from a given start node and thus can return an unrelated (i.e.
+non-sibling) node.
+
+This also addresses a potential use-after-free (e.g. after probe
+deferral) as the tree-wide helper drops a reference to its first
+argument (i.e. the parent device node).
+
+While at it, also fix the related cec-node reference leak.
+
+Fixes: 8f83f26891e1 ("drm/mediatek: Add HDMI support")
+Cc: stable <stable@vger.kernel.org> # 4.8
+Cc: Junzhi Zhao <junzhi.zhao@mediatek.com>
+Cc: Philipp Zabel <p.zabel@pengutronix.de>
+Cc: CK Hu <ck.hu@mediatek.com>
+Cc: David Airlie <airlied@linux.ie>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Rob Herring <robh@kernel.org>
+[ johan: backport to 4.9 ]
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/mediatek/mtk_hdmi.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
++++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
+@@ -1446,8 +1446,7 @@ static int mtk_hdmi_dt_parse_pdata(struc
+ }
+
+ /* The CEC module handles HDMI hotplug detection */
+- cec_np = of_find_compatible_node(np->parent, NULL,
+- "mediatek,mt8173-cec");
++ cec_np = of_get_compatible_child(np->parent, "mediatek,mt8173-cec");
+ if (!cec_np) {
+ dev_err(dev, "Failed to find CEC node\n");
+ return -EINVAL;
+@@ -1457,8 +1456,10 @@ static int mtk_hdmi_dt_parse_pdata(struc
+ if (!cec_pdev) {
+ dev_err(hdmi->dev, "Waiting for CEC device %s\n",
+ cec_np->full_name);
++ of_node_put(cec_np);
+ return -EPROBE_DEFER;
+ }
++ of_node_put(cec_np);
+ hdmi->cec_dev = &cec_pdev->dev;
+
+ /*
--- /dev/null
+From ad33429cd02565c28404bb16ae7a4c2bdfda6626 Mon Sep 17 00:00:00 2001
+From: Noah Westervelt <nwestervelt@outlook.com>
+Date: Thu, 29 Nov 2018 10:10:35 -0800
+Subject: Input: elan_i2c - add ACPI ID for Lenovo IdeaPad 330-15ARR
+
+From: Noah Westervelt <nwestervelt@outlook.com>
+
+commit ad33429cd02565c28404bb16ae7a4c2bdfda6626 upstream.
+
+Add ELAN061E to the ACPI table to support Elan touchpad found in Lenovo
+IdeaPad 330-15ARR.
+
+Signed-off-by: Noah Westervelt <nwestervelt@outlook.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/input/mouse/elan_i2c_core.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/input/mouse/elan_i2c_core.c
++++ b/drivers/input/mouse/elan_i2c_core.c
+@@ -1253,6 +1253,7 @@ static const struct acpi_device_id elan_
+ { "ELAN0618", 0 },
+ { "ELAN061C", 0 },
+ { "ELAN061D", 0 },
++ { "ELAN061E", 0 },
+ { "ELAN0620", 0 },
+ { "ELAN0622", 0 },
+ { "ELAN1000", 0 },
--- /dev/null
+From 3ed64da3b790be7c63601e8ca6341b7dff74a660 Mon Sep 17 00:00:00 2001
+From: Patrick Gaskin <patrick@pgaskin.net>
+Date: Mon, 12 Nov 2018 11:12:24 -0800
+Subject: Input: elan_i2c - add ELAN0620 to the ACPI table
+
+From: Patrick Gaskin <patrick@pgaskin.net>
+
+commit 3ed64da3b790be7c63601e8ca6341b7dff74a660 upstream.
+
+Add ELAN0620 to the ACPI table to support the elan touchpad in
+the Lenovo IdeaPad 130-15IKB.
+
+Signed-off-by: Patrick Gaskin <patrick@pgaskin.net>
+Cc: stable@vger.kernel.org
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/input/mouse/elan_i2c_core.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/input/mouse/elan_i2c_core.c
++++ b/drivers/input/mouse/elan_i2c_core.c
+@@ -1253,6 +1253,7 @@ static const struct acpi_device_id elan_
+ { "ELAN0618", 0 },
+ { "ELAN061C", 0 },
+ { "ELAN061D", 0 },
++ { "ELAN0620", 0 },
+ { "ELAN0622", 0 },
+ { "ELAN1000", 0 },
+ { }
--- /dev/null
+From bf87ade0dd7f8cf19dac4d3161d5e86abe0c062b Mon Sep 17 00:00:00 2001
+From: Adam Wong <adam@adamwong.me>
+Date: Thu, 29 Nov 2018 10:04:35 -0800
+Subject: Input: elan_i2c - add support for ELAN0621 touchpad
+
+From: Adam Wong <adam@adamwong.me>
+
+commit bf87ade0dd7f8cf19dac4d3161d5e86abe0c062b upstream.
+
+Added the ability to detect the ELAN0621 touchpad found in some Lenovo
+laptops.
+
+Signed-off-by: Adam Wong <adam@adamwong.me>
+Cc: stable@vger.kernel.org
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/input/mouse/elan_i2c_core.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/input/mouse/elan_i2c_core.c
++++ b/drivers/input/mouse/elan_i2c_core.c
+@@ -1255,6 +1255,7 @@ static const struct acpi_device_id elan_
+ { "ELAN061D", 0 },
+ { "ELAN061E", 0 },
+ { "ELAN0620", 0 },
++ { "ELAN0621", 0 },
+ { "ELAN0622", 0 },
+ { "ELAN1000", 0 },
+ { }
--- /dev/null
+From d55bda1b3e7c5a87f10da54fdda866a9a9cef30b Mon Sep 17 00:00:00 2001
+From: Christian Hoff <christian_hoff@gmx.net>
+Date: Mon, 12 Nov 2018 11:11:29 -0800
+Subject: Input: matrix_keypad - check for errors from of_get_named_gpio()
+
+From: Christian Hoff <christian_hoff@gmx.net>
+
+commit d55bda1b3e7c5a87f10da54fdda866a9a9cef30b upstream.
+
+"of_get_named_gpio()" returns a negative error value if it fails
+and drivers should check for this. This missing check was now
+added to the matrix_keypad driver.
+
+In my case "of_get_named_gpio()" returned -EPROBE_DEFER because
+the referenced GPIOs belong to an I/O expander, which was not yet
+probed at the point in time when the matrix_keypad driver was
+loading. Because the driver did not check for errors from the
+"of_get_named_gpio()" routine, it was assuming that "-EPROBE_DEFER"
+is actually a GPIO number and continued as usual, which led to further
+errors like this later on:
+
+WARNING: CPU: 3 PID: 167 at drivers/gpio/gpiolib.c:114
+gpio_to_desc+0xc8/0xd0
+invalid GPIO -517
+
+Note that the "GPIO number" -517 in the error message above is
+actually "-EPROBE_DEFER".
+
+As part of the patch a misleading error message "no platform data defined"
+was also removed. This does not lead to information loss because the other
+error paths in matrix_keypad_parse_dt() already print an error.
+
+Signed-off-by: Christian Hoff <christian_hoff@gmx.net>
+Suggested-by: Sebastian Reichel <sre@kernel.org>
+Reviewed-by: Sebastian Reichel <sre@kernel.org>
+Cc: stable@vger.kernel.org
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/input/keyboard/matrix_keypad.c | 23 ++++++++++++++---------
+ 1 file changed, 14 insertions(+), 9 deletions(-)
+
+--- a/drivers/input/keyboard/matrix_keypad.c
++++ b/drivers/input/keyboard/matrix_keypad.c
+@@ -405,7 +405,7 @@ matrix_keypad_parse_dt(struct device *de
+ struct matrix_keypad_platform_data *pdata;
+ struct device_node *np = dev->of_node;
+ unsigned int *gpios;
+- int i, nrow, ncol;
++ int ret, i, nrow, ncol;
+
+ if (!np) {
+ dev_err(dev, "device lacks DT data\n");
+@@ -447,12 +447,19 @@ matrix_keypad_parse_dt(struct device *de
+ return ERR_PTR(-ENOMEM);
+ }
+
+- for (i = 0; i < pdata->num_row_gpios; i++)
+- gpios[i] = of_get_named_gpio(np, "row-gpios", i);
++ for (i = 0; i < nrow; i++) {
++ ret = of_get_named_gpio(np, "row-gpios", i);
++ if (ret < 0)
++ return ERR_PTR(ret);
++ gpios[i] = ret;
++ }
+
+- for (i = 0; i < pdata->num_col_gpios; i++)
+- gpios[pdata->num_row_gpios + i] =
+- of_get_named_gpio(np, "col-gpios", i);
++ for (i = 0; i < ncol; i++) {
++ ret = of_get_named_gpio(np, "col-gpios", i);
++ if (ret < 0)
++ return ERR_PTR(ret);
++ gpios[nrow + i] = ret;
++ }
+
+ pdata->row_gpios = gpios;
+ pdata->col_gpios = &gpios[pdata->num_row_gpios];
+@@ -479,10 +486,8 @@ static int matrix_keypad_probe(struct pl
+ pdata = dev_get_platdata(&pdev->dev);
+ if (!pdata) {
+ pdata = matrix_keypad_parse_dt(&pdev->dev);
+- if (IS_ERR(pdata)) {
+- dev_err(&pdev->dev, "no platform data defined\n");
++ if (IS_ERR(pdata))
+ return PTR_ERR(pdata);
+- }
+ } else if (!pdata->keymap_data) {
+ dev_err(&pdev->dev, "no keymap data defined\n");
+ return -EINVAL;
--- /dev/null
+From a6754fae1e66e9a40fed406290d7ca3f2b4d227c Mon Sep 17 00:00:00 2001
+From: Cameron Gutman <aicommander@gmail.com>
+Date: Thu, 29 Nov 2018 10:09:33 -0800
+Subject: Input: xpad - quirk all PDP Xbox One gamepads
+
+From: Cameron Gutman <aicommander@gmail.com>
+
+commit a6754fae1e66e9a40fed406290d7ca3f2b4d227c upstream.
+
+Since we continue to find tons of new variants [0,1,2,3,4,5,6] that
+need the PDP quirk, let's just quirk all devices from PDP.
+
+[0]: https://github.com/paroj/xpad/pull/104
+[1]: https://github.com/paroj/xpad/pull/105
+[2]: https://github.com/paroj/xpad/pull/108
+[3]: https://github.com/paroj/xpad/pull/109
+[4]: https://github.com/paroj/xpad/pull/112
+[5]: https://github.com/paroj/xpad/pull/115
+[6]: https://github.com/paroj/xpad/pull/116
+
+Fixes: e5c9c6a885fa ("Input: xpad - add support for PDP Xbox One controllers")
+Cc: stable@vger.kernel.org
+Signed-off-by: Cameron Gutman <aicommander@gmail.com>
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/input/joystick/xpad.c | 16 ++++++----------
+ 1 file changed, 6 insertions(+), 10 deletions(-)
+
+--- a/drivers/input/joystick/xpad.c
++++ b/drivers/input/joystick/xpad.c
+@@ -483,18 +483,18 @@ static const u8 xboxone_hori_init[] = {
+ };
+
+ /*
+- * This packet is required for some of the PDP pads to start
++ * This packet is required for most (all?) of the PDP pads to start
+ * sending input reports. These pads include: (0x0e6f:0x02ab),
+- * (0x0e6f:0x02a4).
++ * (0x0e6f:0x02a4), (0x0e6f:0x02a6).
+ */
+ static const u8 xboxone_pdp_init1[] = {
+ 0x0a, 0x20, 0x00, 0x03, 0x00, 0x01, 0x14
+ };
+
+ /*
+- * This packet is required for some of the PDP pads to start
++ * This packet is required for most (all?) of the PDP pads to start
+ * sending input reports. These pads include: (0x0e6f:0x02ab),
+- * (0x0e6f:0x02a4).
++ * (0x0e6f:0x02a4), (0x0e6f:0x02a6).
+ */
+ static const u8 xboxone_pdp_init2[] = {
+ 0x06, 0x20, 0x00, 0x02, 0x01, 0x00
+@@ -530,12 +530,8 @@ static const struct xboxone_init_packet
+ XBOXONE_INIT_PKT(0x0e6f, 0x0165, xboxone_hori_init),
+ XBOXONE_INIT_PKT(0x0f0d, 0x0067, xboxone_hori_init),
+ XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init),
+- XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init1),
+- XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init2),
+- XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init1),
+- XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init2),
+- XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init1),
+- XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init2),
++ XBOXONE_INIT_PKT(0x0e6f, 0x0000, xboxone_pdp_init1),
++ XBOXONE_INIT_PKT(0x0e6f, 0x0000, xboxone_pdp_init2),
+ XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init),
+ XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init),
+ XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init),
--- /dev/null
+From 1cd25cbb2fedbc777f3a8c3cb1ba69b645aeaa64 Mon Sep 17 00:00:00 2001
+From: Laura Abbott <labbott@redhat.com>
+Date: Wed, 19 Sep 2018 18:59:01 -0700
+Subject: kgdboc: Fix warning with module build
+
+From: Laura Abbott <labbott@redhat.com>
+
+commit 1cd25cbb2fedbc777f3a8c3cb1ba69b645aeaa64 upstream.
+
+After 2dd453168643 ("kgdboc: Fix restrict error"), kgdboc_option_setup is
+now only used when built in, resulting in a warning when compiled as a
+module:
+
+drivers/tty/serial/kgdboc.c:134:12: warning: 'kgdboc_option_setup' defined but not used [-Wunused-function]
+ static int kgdboc_option_setup(char *opt)
+ ^~~~~~~~~~~~~~~~~~~
+
+Move the function under the appropriate ifdef for builtin only.
+
+Fixes: 2dd453168643 ("kgdboc: Fix restrict error")
+Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
+Signed-off-by: Laura Abbott <labbott@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/serial/kgdboc.c | 37 +++++++++++++++++++------------------
+ 1 file changed, 19 insertions(+), 18 deletions(-)
+
+--- a/drivers/tty/serial/kgdboc.c
++++ b/drivers/tty/serial/kgdboc.c
+@@ -131,24 +131,6 @@ static void kgdboc_unregister_kbd(void)
+ #define kgdboc_restore_input()
+ #endif /* ! CONFIG_KDB_KEYBOARD */
+
+-static int kgdboc_option_setup(char *opt)
+-{
+- if (!opt) {
+- pr_err("kgdboc: config string not provided\n");
+- return -EINVAL;
+- }
+-
+- if (strlen(opt) >= MAX_CONFIG_LEN) {
+- printk(KERN_ERR "kgdboc: config string too long\n");
+- return -ENOSPC;
+- }
+- strcpy(config, opt);
+-
+- return 0;
+-}
+-
+-__setup("kgdboc=", kgdboc_option_setup);
+-
+ static void cleanup_kgdboc(void)
+ {
+ if (kgdb_unregister_nmi_console())
+@@ -316,6 +298,25 @@ static struct kgdb_io kgdboc_io_ops = {
+ };
+
+ #ifdef CONFIG_KGDB_SERIAL_CONSOLE
++static int kgdboc_option_setup(char *opt)
++{
++ if (!opt) {
++ pr_err("config string not provided\n");
++ return -EINVAL;
++ }
++
++ if (strlen(opt) >= MAX_CONFIG_LEN) {
++ pr_err("config string too long\n");
++ return -ENOSPC;
++ }
++ strcpy(config, opt);
++
++ return 0;
++}
++
++__setup("kgdboc=", kgdboc_option_setup);
++
++
+ /* This is only available if kgdboc is a built in for early debugging */
+ static int __init kgdboc_early_init(char *opt)
+ {
--- /dev/null
+From 6ff38bd40230af35e446239396e5fc8ebd6a5248 Mon Sep 17 00:00:00 2001
+From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
+Date: Fri, 30 Nov 2018 14:09:00 -0800
+Subject: mm: cleancache: fix corruption on missed inode invalidation
+
+From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
+
+commit 6ff38bd40230af35e446239396e5fc8ebd6a5248 upstream.
+
+If all pages are deleted from the mapping by memory reclaim and also
+moved to the cleancache:
+
+__delete_from_page_cache
+ (no shadow case)
+ unaccount_page_cache_page
+ cleancache_put_page
+ page_cache_delete
+ mapping->nrpages -= nr
+ (nrpages becomes 0)
+
+We don't clean the cleancache for an inode after final file truncation
+(removal).
+
+truncate_inode_pages_final
+ check (nrpages || nrexceptional) is false
+ no truncate_inode_pages
+ no cleancache_invalidate_inode(mapping)
+
+These way when reading the new file created with same inode we may get
+these trash leftover pages from cleancache and see wrong data instead of
+the contents of the new file.
+
+Fix it by always doing truncate_inode_pages which is already ready for
+nrpages == 0 && nrexceptional == 0 case and just invalidates inode.
+
+[akpm@linux-foundation.org: add comment, per Jan]
+Link: http://lkml.kernel.org/r/20181112095734.17979-1-ptikhomirov@virtuozzo.com
+Fixes: commit 91b0abe36a7b ("mm + fs: store shadow entries in page cache")
+Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
+Reviewed-by: Vasily Averin <vvs@virtuozzo.com>
+Reviewed-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
+Reviewed-by: Jan Kara <jack@suse.cz>
+Cc: Johannes Weiner <hannes@cmpxchg.org>
+Cc: Mel Gorman <mgorman@techsingularity.net>
+Cc: Matthew Wilcox <willy@infradead.org>
+Cc: Andi Kleen <ak@linux.intel.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/truncate.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+--- a/mm/truncate.c
++++ b/mm/truncate.c
+@@ -443,9 +443,13 @@ void truncate_inode_pages_final(struct a
+ */
+ spin_lock_irq(&mapping->tree_lock);
+ spin_unlock_irq(&mapping->tree_lock);
+-
+- truncate_inode_pages(mapping, 0);
+ }
++
++ /*
++ * Cleancache needs notification even if there are no pages or shadow
++ * entries.
++ */
++ truncate_inode_pages(mapping, 0);
+ }
+ EXPORT_SYMBOL(truncate_inode_pages_final);
+
--- /dev/null
+From 62e24c5775ecb387a3eb33701378ccfa6dbc98ee Mon Sep 17 00:00:00 2001
+From: Philipp Zabel <p.zabel@pengutronix.de>
+Date: Fri, 5 Feb 2016 13:41:39 +0100
+Subject: reset: add exported __reset_control_get, return NULL if optional
+
+From: Philipp Zabel <p.zabel@pengutronix.de>
+
+commit 62e24c5775ecb387a3eb33701378ccfa6dbc98ee upstream.
+
+Rename the internal __reset_control_get/put functions to
+__reset_control_get/put_internal and add an exported
+__reset_control_get equivalent to __of_reset_control_get
+that takes a struct device parameter.
+This avoids the confusing call to __of_reset_control_get in
+the non-DT case and fixes the devm_reset_control_get_optional
+function to return NULL if RESET_CONTROLLER is enabled but
+dev->of_node == NULL.
+
+Fixes: bb475230b8e5 ("reset: make optional functions really optional")
+Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Cc: Ramiro Oliveira <Ramiro.Oliveira@synopsys.com>
+Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
+Cc: Dinh Nguyen <dinguyen@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/reset/core.c | 22 ++++++++++++++++------
+ include/linux/reset.h | 22 ++++++++++++++--------
+ 2 files changed, 30 insertions(+), 14 deletions(-)
+
+--- a/drivers/reset/core.c
++++ b/drivers/reset/core.c
+@@ -241,7 +241,7 @@ int reset_control_status(struct reset_co
+ }
+ EXPORT_SYMBOL_GPL(reset_control_status);
+
+-static struct reset_control *__reset_control_get(
++static struct reset_control *__reset_control_get_internal(
+ struct reset_controller_dev *rcdev,
+ unsigned int index, int shared)
+ {
+@@ -274,7 +274,7 @@ static struct reset_control *__reset_con
+ return rstc;
+ }
+
+-static void __reset_control_put(struct reset_control *rstc)
++static void __reset_control_put_internal(struct reset_control *rstc)
+ {
+ lockdep_assert_held(&reset_list_mutex);
+
+@@ -343,7 +343,7 @@ struct reset_control *__of_reset_control
+ }
+
+ /* reset_list_mutex also protects the rcdev's reset_control list */
+- rstc = __reset_control_get(rcdev, rstc_id, shared);
++ rstc = __reset_control_get_internal(rcdev, rstc_id, shared);
+
+ mutex_unlock(&reset_list_mutex);
+
+@@ -351,6 +351,17 @@ struct reset_control *__of_reset_control
+ }
+ EXPORT_SYMBOL_GPL(__of_reset_control_get);
+
++struct reset_control *__reset_control_get(struct device *dev, const char *id,
++ int index, bool shared, bool optional)
++{
++ if (dev->of_node)
++ return __of_reset_control_get(dev->of_node, id, index, shared,
++ optional);
++
++ return optional ? NULL : ERR_PTR(-EINVAL);
++}
++EXPORT_SYMBOL_GPL(__reset_control_get);
++
+ /**
+ * reset_control_put - free the reset controller
+ * @rstc: reset controller
+@@ -362,7 +373,7 @@ void reset_control_put(struct reset_cont
+ return;
+
+ mutex_lock(&reset_list_mutex);
+- __reset_control_put(rstc);
++ __reset_control_put_internal(rstc);
+ mutex_unlock(&reset_list_mutex);
+ }
+ EXPORT_SYMBOL_GPL(reset_control_put);
+@@ -383,8 +394,7 @@ struct reset_control *__devm_reset_contr
+ if (!ptr)
+ return ERR_PTR(-ENOMEM);
+
+- rstc = __of_reset_control_get(dev ? dev->of_node : NULL,
+- id, index, shared, optional);
++ rstc = __reset_control_get(dev, id, index, shared, optional);
+ if (!IS_ERR(rstc)) {
+ *ptr = rstc;
+ devres_add(dev, ptr);
+--- a/include/linux/reset.h
++++ b/include/linux/reset.h
+@@ -15,6 +15,9 @@ int reset_control_status(struct reset_co
+ struct reset_control *__of_reset_control_get(struct device_node *node,
+ const char *id, int index, bool shared,
+ bool optional);
++struct reset_control *__reset_control_get(struct device *dev, const char *id,
++ int index, bool shared,
++ bool optional);
+ void reset_control_put(struct reset_control *rstc);
+ struct reset_control *__devm_reset_control_get(struct device *dev,
+ const char *id, int index, bool shared,
+@@ -72,6 +75,13 @@ static inline struct reset_control *__of
+ return optional ? NULL : ERR_PTR(-ENOTSUPP);
+ }
+
++static inline struct reset_control *__reset_control_get(
++ struct device *dev, const char *id,
++ int index, bool shared, bool optional)
++{
++ return optional ? NULL : ERR_PTR(-ENOTSUPP);
++}
++
+ static inline struct reset_control *__devm_reset_control_get(
+ struct device *dev, const char *id,
+ int index, bool shared, bool optional)
+@@ -102,8 +112,7 @@ __must_check reset_control_get_exclusive
+ #ifndef CONFIG_RESET_CONTROLLER
+ WARN_ON(1);
+ #endif
+- return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, false,
+- false);
++ return __reset_control_get(dev, id, 0, false, false);
+ }
+
+ /**
+@@ -131,22 +140,19 @@ __must_check reset_control_get_exclusive
+ static inline struct reset_control *reset_control_get_shared(
+ struct device *dev, const char *id)
+ {
+- return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, true,
+- false);
++ return __reset_control_get(dev, id, 0, true, false);
+ }
+
+ static inline struct reset_control *reset_control_get_optional_exclusive(
+ struct device *dev, const char *id)
+ {
+- return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, false,
+- true);
++ return __reset_control_get(dev, id, 0, false, true);
+ }
+
+ static inline struct reset_control *reset_control_get_optional_shared(
+ struct device *dev, const char *id)
+ {
+- return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, true,
+- true);
++ return __reset_control_get(dev, id, 0, true, true);
+ }
+
+ /**
--- /dev/null
+From 4891486fb2c80eaf3bb0f9eb065d15ecd357702f Mon Sep 17 00:00:00 2001
+From: Heiner Kallweit <hkallweit1@gmail.com>
+Date: Wed, 1 Feb 2017 08:05:22 +0100
+Subject: reset: core: fix reset_control_put
+
+From: Heiner Kallweit <hkallweit1@gmail.com>
+
+commit 4891486fb2c80eaf3bb0f9eb065d15ecd357702f upstream.
+
+Commit "reset: make optional functions really optional" missed to
+adjust one check in reset_control_put, causing a NULL pointer
+access for optional resets.
+
+Fixes: bb475230b8e5 "reset: make optional functions really optional"
+Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
+Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
+Cc: Dinh Nguyen <dinguyen@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/reset/core.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/reset/core.c
++++ b/drivers/reset/core.c
+@@ -358,7 +358,7 @@ EXPORT_SYMBOL_GPL(__of_reset_control_get
+
+ void reset_control_put(struct reset_control *rstc)
+ {
+- if (IS_ERR(rstc))
++ if (IS_ERR_OR_NULL(rstc))
+ return;
+
+ mutex_lock(&reset_list_mutex);
--- /dev/null
+From 0ca10b60ceeb5372da01798ca68c116ae45a6eb6 Mon Sep 17 00:00:00 2001
+From: Philipp Zabel <p.zabel@pengutronix.de>
+Date: Mon, 20 Mar 2017 11:25:16 +0100
+Subject: reset: fix optional reset_control_get stubs to return NULL
+
+From: Philipp Zabel <p.zabel@pengutronix.de>
+
+commit 0ca10b60ceeb5372da01798ca68c116ae45a6eb6 upstream.
+
+When RESET_CONTROLLER is not enabled, the optional reset_control_get
+stubs should now also return NULL.
+
+Since it is now valid for reset_control_assert/deassert/reset/status/put
+to be called unconditionally, with NULL as an argument for optional
+resets, the stubs are not allowed to warn anymore.
+
+Fixes: bb475230b8e5 ("reset: make optional functions really optional")
+Reported-by: Andrzej Hajda <a.hajda@samsung.com>
+Tested-by: Andrzej Hajda <a.hajda@samsung.com>
+Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
+Cc: Ramiro Oliveira <Ramiro.Oliveira@synopsys.com>
+Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
+Cc: Dinh Nguyen <dinguyen@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/reset.h | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+--- a/include/linux/reset.h
++++ b/include/linux/reset.h
+@@ -31,31 +31,26 @@ static inline int device_reset_optional(
+
+ static inline int reset_control_reset(struct reset_control *rstc)
+ {
+- WARN_ON(1);
+ return 0;
+ }
+
+ static inline int reset_control_assert(struct reset_control *rstc)
+ {
+- WARN_ON(1);
+ return 0;
+ }
+
+ static inline int reset_control_deassert(struct reset_control *rstc)
+ {
+- WARN_ON(1);
+ return 0;
+ }
+
+ static inline int reset_control_status(struct reset_control *rstc)
+ {
+- WARN_ON(1);
+ return 0;
+ }
+
+ static inline void reset_control_put(struct reset_control *rstc)
+ {
+- WARN_ON(1);
+ }
+
+ static inline int __must_check device_reset(struct device *dev)
+@@ -74,14 +69,14 @@ static inline struct reset_control *__of
+ const char *id, int index, bool shared,
+ bool optional)
+ {
+- return ERR_PTR(-ENOTSUPP);
++ return optional ? NULL : ERR_PTR(-ENOTSUPP);
+ }
+
+ static inline struct reset_control *__devm_reset_control_get(
+ struct device *dev, const char *id,
+ int index, bool shared, bool optional)
+ {
+- return ERR_PTR(-ENOTSUPP);
++ return optional ? NULL : ERR_PTR(-ENOTSUPP);
+ }
+
+ #endif /* CONFIG_RESET_CONTROLLER */
--- /dev/null
+From 1554bbd4ad401b7f0f916c0891874111c10befe5 Mon Sep 17 00:00:00 2001
+From: Masahiro Yamada <yamada.masahiro@socionext.com>
+Date: Sun, 29 Oct 2017 01:50:06 +0900
+Subject: reset: make device_reset_optional() really optional
+
+From: Masahiro Yamada <yamada.masahiro@socionext.com>
+
+commit 1554bbd4ad401b7f0f916c0891874111c10befe5 upstream.
+
+Commit bb475230b8e5 ("reset: make optional functions really optional")
+converted *_get_optional* functions, but device_reset_optional() was
+left behind. Convert it in the same way.
+
+Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
+Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
+Cc: Dinh Nguyen <dinguyen@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+
+---
+ drivers/reset/core.c | 9 +++++----
+ include/linux/reset.h | 28 +++++++++++++---------------
+ 2 files changed, 18 insertions(+), 19 deletions(-)
+
+--- a/drivers/reset/core.c
++++ b/drivers/reset/core.c
+@@ -410,17 +410,18 @@ EXPORT_SYMBOL_GPL(__devm_reset_control_g
+ * device_reset - find reset controller associated with the device
+ * and perform reset
+ * @dev: device to be reset by the controller
++ * @optional: whether it is optional to reset the device
+ *
+- * Convenience wrapper for reset_control_get() and reset_control_reset().
++ * Convenience wrapper for __reset_control_get() and reset_control_reset().
+ * This is useful for the common case of devices with single, dedicated reset
+ * lines.
+ */
+-int device_reset(struct device *dev)
++int __device_reset(struct device *dev, bool optional)
+ {
+ struct reset_control *rstc;
+ int ret;
+
+- rstc = reset_control_get(dev, NULL);
++ rstc = __reset_control_get(dev, NULL, 0, 0, optional);
+ if (IS_ERR(rstc))
+ return PTR_ERR(rstc);
+
+@@ -430,4 +431,4 @@ int device_reset(struct device *dev)
+
+ return ret;
+ }
+-EXPORT_SYMBOL_GPL(device_reset);
++EXPORT_SYMBOL_GPL(__device_reset);
+--- a/include/linux/reset.h
++++ b/include/linux/reset.h
+@@ -19,17 +19,11 @@ struct reset_control *__reset_control_ge
+ int index, bool shared,
+ bool optional);
+ void reset_control_put(struct reset_control *rstc);
++int __device_reset(struct device *dev, bool optional);
+ struct reset_control *__devm_reset_control_get(struct device *dev,
+ const char *id, int index, bool shared,
+ bool optional);
+
+-int __must_check device_reset(struct device *dev);
+-
+-static inline int device_reset_optional(struct device *dev)
+-{
+- return device_reset(dev);
+-}
+-
+ #else
+
+ static inline int reset_control_reset(struct reset_control *rstc)
+@@ -56,15 +50,9 @@ static inline void reset_control_put(str
+ {
+ }
+
+-static inline int __must_check device_reset(struct device *dev)
+-{
+- WARN_ON(1);
+- return -ENOTSUPP;
+-}
+-
+-static inline int device_reset_optional(struct device *dev)
++static inline int __device_reset(struct device *dev, bool optional)
+ {
+- return -ENOTSUPP;
++ return optional ? 0 : -ENOTSUPP;
+ }
+
+ static inline struct reset_control *__of_reset_control_get(
+@@ -91,6 +79,16 @@ static inline struct reset_control *__de
+
+ #endif /* CONFIG_RESET_CONTROLLER */
+
++static inline int __must_check device_reset(struct device *dev)
++{
++ return __device_reset(dev, false);
++}
++
++static inline int device_reset_optional(struct device *dev)
++{
++ return __device_reset(dev, true);
++}
++
+ /**
+ * reset_control_get_exclusive - Lookup and obtain an exclusive reference
+ * to a reset controller.
--- /dev/null
+From bb475230b8e59a547ab66ac3b02572df21a580e9 Mon Sep 17 00:00:00 2001
+From: Ramiro Oliveira <Ramiro.Oliveira@synopsys.com>
+Date: Fri, 13 Jan 2017 17:57:41 +0000
+Subject: reset: make optional functions really optional
+
+From: Ramiro Oliveira <Ramiro.Oliveira@synopsys.com>
+
+commit bb475230b8e59a547ab66ac3b02572df21a580e9 upstream.
+
+The *_get_optional_* functions weren't really optional so this patch
+makes them really optional.
+
+These *_get_optional_* functions will now return NULL instead of an error
+if no matching reset phandle is found in the DT, and all the
+reset_control_* functions now accept NULL rstc pointers.
+
+Signed-off-by: Ramiro Oliveira <Ramiro.Oliveira@synopsys.com>
+Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
+Cc: Dinh Nguyen <dinguyen@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+
+---
+ drivers/reset/core.c | 48 +++++++++++++++++++++++++++++++++++++-----------
+ include/linux/reset.h | 45 ++++++++++++++++++++++++++-------------------
+ 2 files changed, 63 insertions(+), 30 deletions(-)
+
+--- a/drivers/reset/core.c
++++ b/drivers/reset/core.c
+@@ -135,11 +135,16 @@ EXPORT_SYMBOL_GPL(devm_reset_controller_
+ * @rstc: reset controller
+ *
+ * Calling this on a shared reset controller is an error.
++ *
++ * If rstc is NULL it is an optional reset and the function will just
++ * return 0.
+ */
+ int reset_control_reset(struct reset_control *rstc)
+ {
+- if (WARN_ON(IS_ERR_OR_NULL(rstc)) ||
+- WARN_ON(rstc->shared))
++ if (!rstc)
++ return 0;
++
++ if (WARN_ON(IS_ERR(rstc)))
+ return -EINVAL;
+
+ if (rstc->rcdev->ops->reset)
+@@ -159,10 +164,16 @@ EXPORT_SYMBOL_GPL(reset_control_reset);
+ *
+ * For shared reset controls a driver cannot expect the hw's registers and
+ * internal state to be reset, but must be prepared for this to happen.
++ *
++ * If rstc is NULL it is an optional reset and the function will just
++ * return 0.
+ */
+ int reset_control_assert(struct reset_control *rstc)
+ {
+- if (WARN_ON(IS_ERR_OR_NULL(rstc)))
++ if (!rstc)
++ return 0;
++
++ if (WARN_ON(IS_ERR(rstc)))
+ return -EINVAL;
+
+ if (!rstc->rcdev->ops->assert)
+@@ -185,10 +196,16 @@ EXPORT_SYMBOL_GPL(reset_control_assert);
+ * @rstc: reset controller
+ *
+ * After calling this function, the reset is guaranteed to be deasserted.
++ *
++ * If rstc is NULL it is an optional reset and the function will just
++ * return 0.
+ */
+ int reset_control_deassert(struct reset_control *rstc)
+ {
+- if (WARN_ON(IS_ERR_OR_NULL(rstc)))
++ if (!rstc)
++ return 0;
++
++ if (WARN_ON(IS_ERR(rstc)))
+ return -EINVAL;
+
+ if (!rstc->rcdev->ops->deassert)
+@@ -206,12 +223,15 @@ EXPORT_SYMBOL_GPL(reset_control_deassert
+ /**
+ * reset_control_status - returns a negative errno if not supported, a
+ * positive value if the reset line is asserted, or zero if the reset
+- * line is not asserted.
++ * line is not asserted or if the desc is NULL (optional reset).
+ * @rstc: reset controller
+ */
+ int reset_control_status(struct reset_control *rstc)
+ {
+- if (WARN_ON(IS_ERR_OR_NULL(rstc)))
++ if (!rstc)
++ return 0;
++
++ if (WARN_ON(IS_ERR(rstc)))
+ return -EINVAL;
+
+ if (rstc->rcdev->ops->status)
+@@ -268,7 +288,8 @@ static void __reset_control_put(struct r
+ }
+
+ struct reset_control *__of_reset_control_get(struct device_node *node,
+- const char *id, int index, int shared)
++ const char *id, int index, bool shared,
++ bool optional)
+ {
+ struct reset_control *rstc;
+ struct reset_controller_dev *r, *rcdev;
+@@ -282,14 +303,18 @@ struct reset_control *__of_reset_control
+ if (id) {
+ index = of_property_match_string(node,
+ "reset-names", id);
++ if (index == -EILSEQ)
++ return ERR_PTR(index);
+ if (index < 0)
+- return ERR_PTR(-ENOENT);
++ return optional ? NULL : ERR_PTR(-ENOENT);
+ }
+
+ ret = of_parse_phandle_with_args(node, "resets", "#reset-cells",
+ index, &args);
+- if (ret)
++ if (ret == -EINVAL)
+ return ERR_PTR(ret);
++ if (ret)
++ return optional ? NULL : ERR_PTR(ret);
+
+ mutex_lock(&reset_list_mutex);
+ rcdev = NULL;
+@@ -348,7 +373,8 @@ static void devm_reset_control_release(s
+ }
+
+ struct reset_control *__devm_reset_control_get(struct device *dev,
+- const char *id, int index, int shared)
++ const char *id, int index, bool shared,
++ bool optional)
+ {
+ struct reset_control **ptr, *rstc;
+
+@@ -358,7 +384,7 @@ struct reset_control *__devm_reset_contr
+ return ERR_PTR(-ENOMEM);
+
+ rstc = __of_reset_control_get(dev ? dev->of_node : NULL,
+- id, index, shared);
++ id, index, shared, optional);
+ if (!IS_ERR(rstc)) {
+ *ptr = rstc;
+ devres_add(dev, ptr);
+--- a/include/linux/reset.h
++++ b/include/linux/reset.h
+@@ -13,10 +13,12 @@ int reset_control_deassert(struct reset_
+ int reset_control_status(struct reset_control *rstc);
+
+ struct reset_control *__of_reset_control_get(struct device_node *node,
+- const char *id, int index, int shared);
++ const char *id, int index, bool shared,
++ bool optional);
+ void reset_control_put(struct reset_control *rstc);
+ struct reset_control *__devm_reset_control_get(struct device *dev,
+- const char *id, int index, int shared);
++ const char *id, int index, bool shared,
++ bool optional);
+
+ int __must_check device_reset(struct device *dev);
+
+@@ -69,14 +71,15 @@ static inline int device_reset_optional(
+
+ static inline struct reset_control *__of_reset_control_get(
+ struct device_node *node,
+- const char *id, int index, int shared)
++ const char *id, int index, bool shared,
++ bool optional)
+ {
+ return ERR_PTR(-ENOTSUPP);
+ }
+
+ static inline struct reset_control *__devm_reset_control_get(
+- struct device *dev,
+- const char *id, int index, int shared)
++ struct device *dev, const char *id,
++ int index, bool shared, bool optional)
+ {
+ return ERR_PTR(-ENOTSUPP);
+ }
+@@ -104,7 +107,8 @@ __must_check reset_control_get_exclusive
+ #ifndef CONFIG_RESET_CONTROLLER
+ WARN_ON(1);
+ #endif
+- return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 0);
++ return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, false,
++ false);
+ }
+
+ /**
+@@ -132,19 +136,22 @@ __must_check reset_control_get_exclusive
+ static inline struct reset_control *reset_control_get_shared(
+ struct device *dev, const char *id)
+ {
+- return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 1);
++ return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, true,
++ false);
+ }
+
+ static inline struct reset_control *reset_control_get_optional_exclusive(
+ struct device *dev, const char *id)
+ {
+- return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 0);
++ return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, false,
++ true);
+ }
+
+ static inline struct reset_control *reset_control_get_optional_shared(
+ struct device *dev, const char *id)
+ {
+- return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 1);
++ return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, true,
++ true);
+ }
+
+ /**
+@@ -160,7 +167,7 @@ static inline struct reset_control *rese
+ static inline struct reset_control *of_reset_control_get_exclusive(
+ struct device_node *node, const char *id)
+ {
+- return __of_reset_control_get(node, id, 0, 0);
++ return __of_reset_control_get(node, id, 0, false, false);
+ }
+
+ /**
+@@ -185,7 +192,7 @@ static inline struct reset_control *of_r
+ static inline struct reset_control *of_reset_control_get_shared(
+ struct device_node *node, const char *id)
+ {
+- return __of_reset_control_get(node, id, 0, 1);
++ return __of_reset_control_get(node, id, 0, true, false);
+ }
+
+ /**
+@@ -202,7 +209,7 @@ static inline struct reset_control *of_r
+ static inline struct reset_control *of_reset_control_get_exclusive_by_index(
+ struct device_node *node, int index)
+ {
+- return __of_reset_control_get(node, NULL, index, 0);
++ return __of_reset_control_get(node, NULL, index, false, false);
+ }
+
+ /**
+@@ -230,7 +237,7 @@ static inline struct reset_control *of_r
+ static inline struct reset_control *of_reset_control_get_shared_by_index(
+ struct device_node *node, int index)
+ {
+- return __of_reset_control_get(node, NULL, index, 1);
++ return __of_reset_control_get(node, NULL, index, true, false);
+ }
+
+ /**
+@@ -252,7 +259,7 @@ __must_check devm_reset_control_get_excl
+ #ifndef CONFIG_RESET_CONTROLLER
+ WARN_ON(1);
+ #endif
+- return __devm_reset_control_get(dev, id, 0, 0);
++ return __devm_reset_control_get(dev, id, 0, false, false);
+ }
+
+ /**
+@@ -267,19 +274,19 @@ __must_check devm_reset_control_get_excl
+ static inline struct reset_control *devm_reset_control_get_shared(
+ struct device *dev, const char *id)
+ {
+- return __devm_reset_control_get(dev, id, 0, 1);
++ return __devm_reset_control_get(dev, id, 0, true, false);
+ }
+
+ static inline struct reset_control *devm_reset_control_get_optional_exclusive(
+ struct device *dev, const char *id)
+ {
+- return __devm_reset_control_get(dev, id, 0, 0);
++ return __devm_reset_control_get(dev, id, 0, false, true);
+ }
+
+ static inline struct reset_control *devm_reset_control_get_optional_shared(
+ struct device *dev, const char *id)
+ {
+- return __devm_reset_control_get(dev, id, 0, 1);
++ return __devm_reset_control_get(dev, id, 0, true, true);
+ }
+
+ /**
+@@ -297,7 +304,7 @@ static inline struct reset_control *devm
+ static inline struct reset_control *
+ devm_reset_control_get_exclusive_by_index(struct device *dev, int index)
+ {
+- return __devm_reset_control_get(dev, NULL, index, 0);
++ return __devm_reset_control_get(dev, NULL, index, false, false);
+ }
+
+ /**
+@@ -313,7 +320,7 @@ devm_reset_control_get_exclusive_by_inde
+ static inline struct reset_control *
+ devm_reset_control_get_shared_by_index(struct device *dev, int index)
+ {
+- return __devm_reset_control_get(dev, NULL, index, 1);
++ return __devm_reset_control_get(dev, NULL, index, true, false);
+ }
+
+ /*
--- /dev/null
+From bb6c7768385b200063a14d6615cc1246c3d00760 Mon Sep 17 00:00:00 2001
+From: Masahiro Yamada <yamada.masahiro@socionext.com>
+Date: Sun, 29 Oct 2017 01:50:07 +0900
+Subject: reset: remove remaining WARN_ON() in <linux/reset.h>
+
+From: Masahiro Yamada <yamada.masahiro@socionext.com>
+
+commit bb6c7768385b200063a14d6615cc1246c3d00760 upstream.
+
+Commit bb475230b8e5 ("reset: make optional functions really optional")
+gave a new meaning to _get_optional variants.
+
+The differentiation by WARN_ON() is not needed any more. We already
+have inconsistency about this; (devm_)reset_control_get_exclusive()
+has WARN_ON() check, but of_reset_control_get_exclusive() does not.
+
+Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
+Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
+Cc: Dinh Nguyen <dinguyen@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/reset.h | 6 ------
+ 1 file changed, 6 deletions(-)
+
+--- a/include/linux/reset.h
++++ b/include/linux/reset.h
+@@ -107,9 +107,6 @@ static inline int device_reset_optional(
+ static inline struct reset_control *
+ __must_check reset_control_get_exclusive(struct device *dev, const char *id)
+ {
+-#ifndef CONFIG_RESET_CONTROLLER
+- WARN_ON(1);
+-#endif
+ return __reset_control_get(dev, id, 0, false, false);
+ }
+
+@@ -255,9 +252,6 @@ static inline struct reset_control *
+ __must_check devm_reset_control_get_exclusive(struct device *dev,
+ const char *id)
+ {
+-#ifndef CONFIG_RESET_CONTROLLER
+- WARN_ON(1);
+-#endif
+ return __devm_reset_control_get(dev, id, 0, false, false);
+ }
+
alsa-trident-suppress-gcc-string-warning.patch
scsi-csiostor-avoid-content-leaks-and-casts.patch
kgdboc-fix-restrict-error.patch
+kgdboc-fix-warning-with-module-build.patch
binder-fix-proc-files-use-after-free.patch
+svm-add-mutex_lock-to-protect-apic_access_page_done-on-amd-systems.patch
+drm-mediatek-fix-of-sibling-node-lookup.patch
+input-xpad-quirk-all-pdp-xbox-one-gamepads.patch
+input-matrix_keypad-check-for-errors-from-of_get_named_gpio.patch
+input-elan_i2c-add-elan0620-to-the-acpi-table.patch
+input-elan_i2c-add-acpi-id-for-lenovo-ideapad-330-15arr.patch
+input-elan_i2c-add-support-for-elan0621-touchpad.patch
+btrfs-always-try-all-copies-when-reading-extent-buffers.patch
+btrfs-fix-use-after-free-when-dumping-free-space.patch
+arc-change-defconfig-defaults-to-arcv2.patch
+arc-add-support-of-nfsv3-acl.patch
+udf-allow-mounting-volumes-with-incorrect-identification-strings.patch
+reset-make-optional-functions-really-optional.patch
+reset-core-fix-reset_control_put.patch
+reset-fix-optional-reset_control_get-stubs-to-return-null.patch
+reset-add-exported-__reset_control_get-return-null-if-optional.patch
+reset-make-device_reset_optional-really-optional.patch
+reset-remove-remaining-warn_on-in-linux-reset.h.patch
+mm-cleancache-fix-corruption-on-missed-inode-invalidation.patch
--- /dev/null
+From 30510387a5e45bfcf8190e03ec7aa15b295828e2 Mon Sep 17 00:00:00 2001
+From: Wei Wang <wawei@amazon.de>
+Date: Mon, 12 Nov 2018 12:23:14 +0000
+Subject: svm: Add mutex_lock to protect apic_access_page_done on AMD systems
+
+From: Wei Wang <wawei@amazon.de>
+
+commit 30510387a5e45bfcf8190e03ec7aa15b295828e2 upstream.
+
+There is a race condition when accessing kvm->arch.apic_access_page_done.
+Due to it, x86_set_memory_region will fail when creating the second vcpu
+for a svm guest.
+
+Add a mutex_lock to serialize the accesses to apic_access_page_done.
+This lock is also used by vmx for the same purpose.
+
+Signed-off-by: Wei Wang <wawei@amazon.de>
+Signed-off-by: Amadeusz Juskowiak <ajusk@amazon.de>
+Signed-off-by: Julian Stecklina <jsteckli@amazon.de>
+Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
+Reviewed-by: Joerg Roedel <jroedel@suse.de>
+Cc: stable@vger.kernel.org
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kvm/svm.c | 19 +++++++++++--------
+ 1 file changed, 11 insertions(+), 8 deletions(-)
+
+--- a/arch/x86/kvm/svm.c
++++ b/arch/x86/kvm/svm.c
+@@ -1333,20 +1333,23 @@ static u64 *avic_get_physical_id_entry(s
+ static int avic_init_access_page(struct kvm_vcpu *vcpu)
+ {
+ struct kvm *kvm = vcpu->kvm;
+- int ret;
++ int ret = 0;
+
++ mutex_lock(&kvm->slots_lock);
+ if (kvm->arch.apic_access_page_done)
+- return 0;
++ goto out;
+
+- ret = x86_set_memory_region(kvm,
+- APIC_ACCESS_PAGE_PRIVATE_MEMSLOT,
+- APIC_DEFAULT_PHYS_BASE,
+- PAGE_SIZE);
++ ret = __x86_set_memory_region(kvm,
++ APIC_ACCESS_PAGE_PRIVATE_MEMSLOT,
++ APIC_DEFAULT_PHYS_BASE,
++ PAGE_SIZE);
+ if (ret)
+- return ret;
++ goto out;
+
+ kvm->arch.apic_access_page_done = true;
+- return 0;
++out:
++ mutex_unlock(&kvm->slots_lock);
++ return ret;
+ }
+
+ static int avic_init_backing_page(struct kvm_vcpu *vcpu)
--- /dev/null
+From b54e41f5efcb4316b2f30b30c2535cc194270373 Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Fri, 16 Nov 2018 13:43:17 +0100
+Subject: udf: Allow mounting volumes with incorrect identification strings
+
+From: Jan Kara <jack@suse.cz>
+
+commit b54e41f5efcb4316b2f30b30c2535cc194270373 upstream.
+
+Commit c26f6c615788 ("udf: Fix conversion of 'dstring' fields to UTF8")
+started to be more strict when checking whether converted strings are
+properly formatted. Sudip reports that there are DVDs where the volume
+identification string is actually too long - UDF reports:
+
+[ 632.309320] UDF-fs: incorrect dstring lengths (32/32)
+
+during mount and fails the mount. This is mostly harmless failure as we
+don't need volume identification (and even less volume set
+identification) for anything. So just truncate the volume identification
+string if it is too long and replace it with 'Invalid' if we just cannot
+convert it for other reasons. This keeps slightly incorrect media still
+mountable.
+
+CC: stable@vger.kernel.org
+Fixes: c26f6c615788 ("udf: Fix conversion of 'dstring' fields to UTF8")
+Reported-and-tested-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/udf/super.c | 16 ++++++++++------
+ fs/udf/unicode.c | 14 +++++++++++---
+ 2 files changed, 21 insertions(+), 9 deletions(-)
+
+--- a/fs/udf/super.c
++++ b/fs/udf/super.c
+@@ -929,16 +929,20 @@ static int udf_load_pvoldesc(struct supe
+ }
+
+ ret = udf_dstrCS0toUTF8(outstr, 31, pvoldesc->volIdent, 32);
+- if (ret < 0)
+- goto out_bh;
+-
+- strncpy(UDF_SB(sb)->s_volume_ident, outstr, ret);
++ if (ret < 0) {
++ strcpy(UDF_SB(sb)->s_volume_ident, "InvalidName");
++ pr_warn("incorrect volume identification, setting to "
++ "'InvalidName'\n");
++ } else {
++ strncpy(UDF_SB(sb)->s_volume_ident, outstr, ret);
++ }
+ udf_debug("volIdent[] = '%s'\n", UDF_SB(sb)->s_volume_ident);
+
+ ret = udf_dstrCS0toUTF8(outstr, 127, pvoldesc->volSetIdent, 128);
+- if (ret < 0)
++ if (ret < 0) {
++ ret = 0;
+ goto out_bh;
+-
++ }
+ outstr[ret] = 0;
+ udf_debug("volSetIdent[] = '%s'\n", outstr);
+
+--- a/fs/udf/unicode.c
++++ b/fs/udf/unicode.c
+@@ -341,6 +341,11 @@ try_again:
+ return u_len;
+ }
+
++/*
++ * Convert CS0 dstring to output charset. Warning: This function may truncate
++ * input string if it is too long as it is used for informational strings only
++ * and it is better to truncate the string than to refuse mounting a media.
++ */
+ int udf_dstrCS0toUTF8(uint8_t *utf_o, int o_len,
+ const uint8_t *ocu_i, int i_len)
+ {
+@@ -349,9 +354,12 @@ int udf_dstrCS0toUTF8(uint8_t *utf_o, in
+ if (i_len > 0) {
+ s_len = ocu_i[i_len - 1];
+ if (s_len >= i_len) {
+- pr_err("incorrect dstring lengths (%d/%d)\n",
+- s_len, i_len);
+- return -EINVAL;
++ pr_warn("incorrect dstring lengths (%d/%d),"
++ " truncating\n", s_len, i_len);
++ s_len = i_len - 1;
++ /* 2-byte encoding? Need to round properly... */
++ if (ocu_i[0] == 16)
++ s_len -= (s_len - 1) & 2;
+ }
+ }
+