From: Greg Kroah-Hartman Date: Thu, 6 Dec 2018 11:21:55 +0000 (+0100) Subject: 4.19-stable patches X-Git-Tag: v4.19.8~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c2181eeab6fd4147954ecfd6e0c7e9bef755e7c5;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: arc-add-support-of-nfsv3-acl.patch arc-change-defconfig-defaults-to-arcv2.patch btrfs-tree-checker-don-t-check-max-block-group-size-as-current-max-chunk-size-limit-is-unreliable.patch i40e-fix-deletion-of-mac-filters.patch input-cros_ec_keyb-fix-button-switch-capability-reports.patch input-elan_i2c-add-acpi-id-for-lenovo-ideapad-330-15arr.patch input-elan_i2c-add-elan0620-to-the-acpi-table.patch input-elan_i2c-add-support-for-elan0621-touchpad.patch input-matrix_keypad-check-for-errors-from-of_get_named_gpio.patch input-synaptics-add-pnp-id-for-thinkpad-p50-to-smbus.patch input-xpad-quirk-all-pdp-xbox-one-gamepads.patch kgdboc-fix-warning-with-module-build.patch scsi-lpfc-fix-block-guard-enablement-on-sli3-adapters.patch selinux-add-support-for-rtm_newchain-rtm_delchain-and-rtm_getchain.patch svm-add-mutex_lock-to-protect-apic_access_page_done-on-amd-systems.patch --- diff --git a/queue-4.19/arc-add-support-of-nfsv3-acl.patch b/queue-4.19/arc-add-support-of-nfsv3-acl.patch new file mode 100644 index 00000000000..681db0cc56d --- /dev/null +++ b/queue-4.19/arc-add-support-of-nfsv3-acl.patch @@ -0,0 +1,133 @@ +From 6b04114f6fae5e84d33404c2970b1949c032546e Mon Sep 17 00:00:00 2001 +From: Alexey Brodkin +Date: Tue, 20 Nov 2018 13:30:19 +0300 +Subject: arc: [devboards] Add support of NFSv3 ACL + +From: Alexey Brodkin + +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 +Cc: Cupertino Miranda +Cc: stable@vger.kernel.org #4.14+ +Signed-off-by: Vineet Gupta +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arc/configs/axs101_defconfig | 1 + + arch/arc/configs/axs103_defconfig | 1 + + arch/arc/configs/axs103_smp_defconfig | 1 + + arch/arc/configs/hsdk_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 + + 10 files changed, 10 insertions(+) + +--- a/arch/arc/configs/axs101_defconfig ++++ b/arch/arc/configs/axs101_defconfig +@@ -96,6 +96,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 +@@ -94,6 +94,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 +@@ -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/hsdk_defconfig ++++ b/arch/arc/configs/hsdk_defconfig +@@ -65,6 +65,7 @@ CONFIG_EXT3_FS=y + CONFIG_VFAT_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 +@@ -74,6 +74,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 +@@ -67,5 +67,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 +@@ -65,5 +65,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 +@@ -76,6 +76,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 +@@ -85,6 +85,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 +@@ -90,6 +90,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 diff --git a/queue-4.19/arc-change-defconfig-defaults-to-arcv2.patch b/queue-4.19/arc-change-defconfig-defaults-to-arcv2.patch new file mode 100644 index 00000000000..e994ec2c01a --- /dev/null +++ b/queue-4.19/arc-change-defconfig-defaults-to-arcv2.patch @@ -0,0 +1,109 @@ +From b7cc40c32a8bfa6f2581a71747f6a7d491fe43ba Mon Sep 17 00:00:00 2001 +From: Kevin Hilman +Date: Fri, 30 Nov 2018 15:51:56 +0300 +Subject: ARC: change defconfig defaults to ARCv2 + +From: Kevin Hilman + +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: # 4.4.x +Signed-off-by: Kevin Hilman +Signed-off-by: Alexey Brodkin +Signed-off-by: Vineet Gupta +Signed-off-by: Greg Kroah-Hartman + +--- + 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 +@@ -111,7 +111,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 +@@ -6,7 +6,7 @@ + # published by the Free Software Foundation. + # + +-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 +@@ -14,6 +14,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 +@@ -15,6 +15,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 +@@ -15,6 +15,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 diff --git a/queue-4.19/btrfs-tree-checker-don-t-check-max-block-group-size-as-current-max-chunk-size-limit-is-unreliable.patch b/queue-4.19/btrfs-tree-checker-don-t-check-max-block-group-size-as-current-max-chunk-size-limit-is-unreliable.patch new file mode 100644 index 00000000000..4688902585d --- /dev/null +++ b/queue-4.19/btrfs-tree-checker-don-t-check-max-block-group-size-as-current-max-chunk-size-limit-is-unreliable.patch @@ -0,0 +1,74 @@ +From 10950929e994c5ecee149ff0873388d3c98f12b5 Mon Sep 17 00:00:00 2001 +From: Qu Wenruo +Date: Fri, 23 Nov 2018 09:06:36 +0800 +Subject: btrfs: tree-checker: Don't check max block group size as current max chunk size limit is unreliable + +From: Qu Wenruo + +commit 10950929e994c5ecee149ff0873388d3c98f12b5 upstream. + +[BUG] +A completely valid btrfs will refuse to mount, with error message like: + BTRFS critical (device sdb2): corrupt leaf: root=2 block=239681536 slot=172 \ + bg_start=12018974720 bg_len=10888413184, invalid block group size, \ + have 10888413184 expect (0, 10737418240] + +This has been reported several times as the 4.19 kernel is now being +used. The filesystem refuses to mount, but is otherwise ok and booting +4.18 is a workaround. + +Btrfs check returns no error, and all kernels used on this fs is later +than 2011, which should all have the 10G size limit commit. + +[CAUSE] +For a 12 devices btrfs, we could allocate a chunk larger than 10G due to +stripe stripe bump up. + +__btrfs_alloc_chunk() +|- max_stripe_size = 1G +|- max_chunk_size = 10G +|- data_stripe = 11 +|- if (1G * 11 > 10G) { + stripe_size = 976128930; + stripe_size = round_up(976128930, SZ_16M) = 989855744 + +However the final stripe_size (989855744) * 11 = 10888413184, which is +still larger than 10G. + +[FIX] +For the comprehensive check, we need to do the full check at chunk read +time, and rely on bg <-> chunk mapping to do the check. + +We could just skip the length check for now. + +Fixes: fce466eab7ac ("btrfs: tree-checker: Verify block_group_item") +Cc: stable@vger.kernel.org # v4.19+ +Reported-by: Wang Yugui +Signed-off-by: Qu Wenruo +Reviewed-by: David Sterba +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman + +--- + fs/btrfs/tree-checker.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +--- a/fs/btrfs/tree-checker.c ++++ b/fs/btrfs/tree-checker.c +@@ -389,13 +389,11 @@ static int check_block_group_item(struct + + /* + * Here we don't really care about alignment since extent allocator can +- * handle it. We care more about the size, as if one block group is +- * larger than maximum size, it's must be some obvious corruption. ++ * handle it. We care more about the size. + */ +- if (key->offset > BTRFS_MAX_DATA_CHUNK_SIZE || key->offset == 0) { ++ if (key->offset == 0) { + block_group_err(fs_info, leaf, slot, +- "invalid block group size, have %llu expect (0, %llu]", +- key->offset, BTRFS_MAX_DATA_CHUNK_SIZE); ++ "invalid block group size 0"); + return -EUCLEAN; + } + diff --git a/queue-4.19/i40e-fix-deletion-of-mac-filters.patch b/queue-4.19/i40e-fix-deletion-of-mac-filters.patch new file mode 100644 index 00000000000..1ec569dc4a4 --- /dev/null +++ b/queue-4.19/i40e-fix-deletion-of-mac-filters.patch @@ -0,0 +1,35 @@ +From eab077aa84331afbda071a213925d4cdbca58941 Mon Sep 17 00:00:00 2001 +From: Lihong Yang +Date: Wed, 21 Nov 2018 09:15:37 -0800 +Subject: i40e: Fix deletion of MAC filters + +From: Lihong Yang + +commit eab077aa84331afbda071a213925d4cdbca58941 upstream. + +In __i40e_del_filter function, the flag __I40E_MACVLAN_SYNC_PENDING for +the PF state is wrongly set for the VSI. Deleting any of the MAC filters +has caused the incorrect syncing for the PF. Fix it by setting this state +flag to the intended PF. + +CC: stable +Signed-off-by: Lihong Yang +Tested-by: Andrew Bowers +Signed-off-by: Jeff Kirsher +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/intel/i40e/i40e_main.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c +@@ -1409,7 +1409,7 @@ void __i40e_del_filter(struct i40e_vsi * + } + + vsi->flags |= I40E_VSI_FLAG_FILTER_CHANGED; +- set_bit(__I40E_MACVLAN_SYNC_PENDING, vsi->state); ++ set_bit(__I40E_MACVLAN_SYNC_PENDING, vsi->back->state); + } + + /** diff --git a/queue-4.19/input-cros_ec_keyb-fix-button-switch-capability-reports.patch b/queue-4.19/input-cros_ec_keyb-fix-button-switch-capability-reports.patch new file mode 100644 index 00000000000..177920d9816 --- /dev/null +++ b/queue-4.19/input-cros_ec_keyb-fix-button-switch-capability-reports.patch @@ -0,0 +1,53 @@ +From ac5722c1643a2fb75224c79b578214956d34f989 Mon Sep 17 00:00:00 2001 +From: Brian Norris +Date: Mon, 12 Nov 2018 11:23:39 -0800 +Subject: Input: cros_ec_keyb - fix button/switch capability reports + +From: Brian Norris + +commit ac5722c1643a2fb75224c79b578214956d34f989 upstream. + +The cros_ec_keyb_bs array lists buttons and switches together, expecting +that its users will match the appropriate type and bit fields. But +cros_ec_keyb_register_bs() only checks the 'bit' field, which causes +misreported input capabilities in some cases. For example, tablets +(e.g., Scarlet -- a.k.a. Acer Chromebook Tab 10) were reporting a SW_LID +capability, because EC_MKBP_POWER_BUTTON and EC_MKBP_LID_OPEN happen to +share the same bit. + +(This has comedic effect on a tablet, in which a power-management daemon +then thinks this "lid" is closed, and so puts the system to sleep as +soon as it boots!) + +To fix this, check both the 'ev_type' and 'bit' fields before reporting +the capability. + +Tested with a lid (Kevin / Samsung Chromebook Plus) and without a lid +(Scarlet / Acer Chromebook Tab 10). + +This error got introduced when porting the feature from the downstream +Chromium OS kernel to be upstreamed. + +Fixes: cdd7950e7aa4 ("input: cros_ec_keyb: Add non-matrix buttons and switches") +Cc: +Signed-off-by: Brian Norris +Reviewed-by: Heiko Stuebner +Signed-off-by: Dmitry Torokhov +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/input/keyboard/cros_ec_keyb.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/input/keyboard/cros_ec_keyb.c ++++ b/drivers/input/keyboard/cros_ec_keyb.c +@@ -493,7 +493,8 @@ static int cros_ec_keyb_register_bs(stru + for (i = 0; i < ARRAY_SIZE(cros_ec_keyb_bs); i++) { + const struct cros_ec_bs_map *map = &cros_ec_keyb_bs[i]; + +- if (buttons & BIT(map->bit)) ++ if ((map->ev_type == EV_KEY && (buttons & BIT(map->bit))) || ++ (map->ev_type == EV_SW && (switches & BIT(map->bit)))) + input_set_capability(idev, map->ev_type, map->code); + } + diff --git a/queue-4.19/input-elan_i2c-add-acpi-id-for-lenovo-ideapad-330-15arr.patch b/queue-4.19/input-elan_i2c-add-acpi-id-for-lenovo-ideapad-330-15arr.patch new file mode 100644 index 00000000000..5e1c35c6723 --- /dev/null +++ b/queue-4.19/input-elan_i2c-add-acpi-id-for-lenovo-ideapad-330-15arr.patch @@ -0,0 +1,31 @@ +From ad33429cd02565c28404bb16ae7a4c2bdfda6626 Mon Sep 17 00:00:00 2001 +From: Noah Westervelt +Date: Thu, 29 Nov 2018 10:10:35 -0800 +Subject: Input: elan_i2c - add ACPI ID for Lenovo IdeaPad 330-15ARR + +From: Noah Westervelt + +commit ad33429cd02565c28404bb16ae7a4c2bdfda6626 upstream. + +Add ELAN061E to the ACPI table to support Elan touchpad found in Lenovo +IdeaPad 330-15ARR. + +Signed-off-by: Noah Westervelt +Cc: stable@vger.kernel.org +Signed-off-by: Dmitry Torokhov +Signed-off-by: Greg Kroah-Hartman + +--- + 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 +@@ -1348,6 +1348,7 @@ static const struct acpi_device_id elan_ + { "ELAN0618", 0 }, + { "ELAN061C", 0 }, + { "ELAN061D", 0 }, ++ { "ELAN061E", 0 }, + { "ELAN0620", 0 }, + { "ELAN0622", 0 }, + { "ELAN1000", 0 }, diff --git a/queue-4.19/input-elan_i2c-add-elan0620-to-the-acpi-table.patch b/queue-4.19/input-elan_i2c-add-elan0620-to-the-acpi-table.patch new file mode 100644 index 00000000000..534c4ddfc66 --- /dev/null +++ b/queue-4.19/input-elan_i2c-add-elan0620-to-the-acpi-table.patch @@ -0,0 +1,31 @@ +From 3ed64da3b790be7c63601e8ca6341b7dff74a660 Mon Sep 17 00:00:00 2001 +From: Patrick Gaskin +Date: Mon, 12 Nov 2018 11:12:24 -0800 +Subject: Input: elan_i2c - add ELAN0620 to the ACPI table + +From: Patrick Gaskin + +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 +Cc: stable@vger.kernel.org +Signed-off-by: Dmitry Torokhov +Signed-off-by: Greg Kroah-Hartman + +--- + 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 +@@ -1348,6 +1348,7 @@ static const struct acpi_device_id elan_ + { "ELAN0618", 0 }, + { "ELAN061C", 0 }, + { "ELAN061D", 0 }, ++ { "ELAN0620", 0 }, + { "ELAN0622", 0 }, + { "ELAN1000", 0 }, + { } diff --git a/queue-4.19/input-elan_i2c-add-support-for-elan0621-touchpad.patch b/queue-4.19/input-elan_i2c-add-support-for-elan0621-touchpad.patch new file mode 100644 index 00000000000..64b697d3ea0 --- /dev/null +++ b/queue-4.19/input-elan_i2c-add-support-for-elan0621-touchpad.patch @@ -0,0 +1,31 @@ +From bf87ade0dd7f8cf19dac4d3161d5e86abe0c062b Mon Sep 17 00:00:00 2001 +From: Adam Wong +Date: Thu, 29 Nov 2018 10:04:35 -0800 +Subject: Input: elan_i2c - add support for ELAN0621 touchpad + +From: Adam Wong + +commit bf87ade0dd7f8cf19dac4d3161d5e86abe0c062b upstream. + +Added the ability to detect the ELAN0621 touchpad found in some Lenovo +laptops. + +Signed-off-by: Adam Wong +Cc: stable@vger.kernel.org +Signed-off-by: Dmitry Torokhov +Signed-off-by: Greg Kroah-Hartman + +--- + 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 +@@ -1350,6 +1350,7 @@ static const struct acpi_device_id elan_ + { "ELAN061D", 0 }, + { "ELAN061E", 0 }, + { "ELAN0620", 0 }, ++ { "ELAN0621", 0 }, + { "ELAN0622", 0 }, + { "ELAN1000", 0 }, + { } diff --git a/queue-4.19/input-matrix_keypad-check-for-errors-from-of_get_named_gpio.patch b/queue-4.19/input-matrix_keypad-check-for-errors-from-of_get_named_gpio.patch new file mode 100644 index 00000000000..968f8a2fd76 --- /dev/null +++ b/queue-4.19/input-matrix_keypad-check-for-errors-from-of_get_named_gpio.patch @@ -0,0 +1,91 @@ +From d55bda1b3e7c5a87f10da54fdda866a9a9cef30b Mon Sep 17 00:00:00 2001 +From: Christian Hoff +Date: Mon, 12 Nov 2018 11:11:29 -0800 +Subject: Input: matrix_keypad - check for errors from of_get_named_gpio() + +From: Christian Hoff + +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 +Suggested-by: Sebastian Reichel +Reviewed-by: Sebastian Reichel +Cc: stable@vger.kernel.org +Signed-off-by: Dmitry Torokhov +Signed-off-by: Greg Kroah-Hartman + +--- + 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 +@@ -407,7 +407,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"); +@@ -452,12 +452,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]; +@@ -484,10 +491,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; diff --git a/queue-4.19/input-synaptics-add-pnp-id-for-thinkpad-p50-to-smbus.patch b/queue-4.19/input-synaptics-add-pnp-id-for-thinkpad-p50-to-smbus.patch new file mode 100644 index 00000000000..4d62e7b79f8 --- /dev/null +++ b/queue-4.19/input-synaptics-add-pnp-id-for-thinkpad-p50-to-smbus.patch @@ -0,0 +1,33 @@ +From 9df39bedbf292680655c6a947c77d6562c693d4a Mon Sep 17 00:00:00 2001 +From: Lyude Paul +Date: Sat, 24 Nov 2018 23:28:10 -0800 +Subject: Input: synaptics - add PNP ID for ThinkPad P50 to SMBus + +From: Lyude Paul + +commit 9df39bedbf292680655c6a947c77d6562c693d4a upstream. + +Noticed the other day the trackpoint felt different on my P50, then +realized it was because rmi4 wasn't loading for this machine +automatically. Suspend/resume, hibernate, and everything else seem to +work perfectly fine on here. + +Signed-off-by: Lyude Paul +Cc: stable@vger.kernel.org +Signed-off-by: Dmitry Torokhov +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/input/mouse/synaptics.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/input/mouse/synaptics.c ++++ b/drivers/input/mouse/synaptics.c +@@ -170,6 +170,7 @@ static const char * const smbus_pnp_ids[ + "LEN0048", /* X1 Carbon 3 */ + "LEN0046", /* X250 */ + "LEN004a", /* W541 */ ++ "LEN005b", /* P50 */ + "LEN0071", /* T480 */ + "LEN0072", /* X1 Carbon Gen 5 (2017) - Elan/ALPS trackpoint */ + "LEN0073", /* X1 Carbon G5 (Elantech) */ diff --git a/queue-4.19/input-xpad-quirk-all-pdp-xbox-one-gamepads.patch b/queue-4.19/input-xpad-quirk-all-pdp-xbox-one-gamepads.patch new file mode 100644 index 00000000000..2877a83b542 --- /dev/null +++ b/queue-4.19/input-xpad-quirk-all-pdp-xbox-one-gamepads.patch @@ -0,0 +1,70 @@ +From a6754fae1e66e9a40fed406290d7ca3f2b4d227c Mon Sep 17 00:00:00 2001 +From: Cameron Gutman +Date: Thu, 29 Nov 2018 10:09:33 -0800 +Subject: Input: xpad - quirk all PDP Xbox One gamepads + +From: Cameron Gutman + +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 +Signed-off-by: Dmitry Torokhov +Signed-off-by: Greg Kroah-Hartman + +--- + 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 +@@ -480,18 +480,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 +@@ -527,12 +527,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), diff --git a/queue-4.19/kgdboc-fix-warning-with-module-build.patch b/queue-4.19/kgdboc-fix-warning-with-module-build.patch new file mode 100644 index 00000000000..83d408ec93b --- /dev/null +++ b/queue-4.19/kgdboc-fix-warning-with-module-build.patch @@ -0,0 +1,81 @@ +From 1cd25cbb2fedbc777f3a8c3cb1ba69b645aeaa64 Mon Sep 17 00:00:00 2001 +From: Laura Abbott +Date: Wed, 19 Sep 2018 18:59:01 -0700 +Subject: kgdboc: Fix warning with module build + +From: Laura Abbott + +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 +Signed-off-by: Laura Abbott +Signed-off-by: Greg Kroah-Hartman + +--- + 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 +@@ -128,24 +128,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()) +@@ -314,6 +296,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) + { diff --git a/queue-4.19/scsi-lpfc-fix-block-guard-enablement-on-sli3-adapters.patch b/queue-4.19/scsi-lpfc-fix-block-guard-enablement-on-sli3-adapters.patch new file mode 100644 index 00000000000..5565a2057e5 --- /dev/null +++ b/queue-4.19/scsi-lpfc-fix-block-guard-enablement-on-sli3-adapters.patch @@ -0,0 +1,55 @@ +From dfb7513374c1f8e7cd595106fbdba3fd07ebaf30 Mon Sep 17 00:00:00 2001 +From: Martin Wilck +Date: Mon, 12 Nov 2018 09:58:37 +0100 +Subject: scsi: lpfc: fix block guard enablement on SLI3 adapters + +From: Martin Wilck + +commit dfb7513374c1f8e7cd595106fbdba3fd07ebaf30 upstream. + +Since f44ac12f1dcc, BG enablement is tracked with the LPFC_SLI3_BG_ENABLED +bit, which is set in lpfc_get_cfgparam before lpfc_sli_config_sli_port() is +called. The bit shouldn't be cleared before checking the feature. Based on +problem analysis by David Bond. + +Fixes: f44ac12f1dcc "scsi: lpfc: Memory allocation error during driver start-up on power8" +Tested-by: David Bond +Signed-off-by: Martin Wilck +Cc: stable@vger.kernel.org # 4.17.x +Cc: stable@vger.kernel.org # 4.18.x +Cc: stable@vger.kernel.org # 4.19.x +Reviewed-by: Hannes Reinecke +Acked-by: James Smart +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/lpfc/lpfc_init.c | 6 +++++- + drivers/scsi/lpfc/lpfc_sli.c | 1 - + 2 files changed, 5 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_init.c ++++ b/drivers/scsi/lpfc/lpfc_init.c +@@ -167,7 +167,11 @@ lpfc_config_port_prep(struct lpfc_hba *p + sizeof(phba->wwpn)); + } + +- phba->sli3_options = 0x0; ++ /* ++ * Clear all option bits except LPFC_SLI3_BG_ENABLED, ++ * which was already set in lpfc_get_cfgparam() ++ */ ++ phba->sli3_options &= (uint32_t)LPFC_SLI3_BG_ENABLED; + + /* Setup and issue mailbox READ REV command */ + lpfc_read_rev(phba, pmb); +--- a/drivers/scsi/lpfc/lpfc_sli.c ++++ b/drivers/scsi/lpfc/lpfc_sli.c +@@ -4969,7 +4969,6 @@ lpfc_sli_config_port(struct lpfc_hba *ph + phba->sli3_options &= ~(LPFC_SLI3_NPIV_ENABLED | + LPFC_SLI3_HBQ_ENABLED | + LPFC_SLI3_CRP_ENABLED | +- LPFC_SLI3_BG_ENABLED | + LPFC_SLI3_DSS_ENABLED); + if (rc != MBX_SUCCESS) { + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, diff --git a/queue-4.19/selinux-add-support-for-rtm_newchain-rtm_delchain-and-rtm_getchain.patch b/queue-4.19/selinux-add-support-for-rtm_newchain-rtm_delchain-and-rtm_getchain.patch new file mode 100644 index 00000000000..a19cb296ee0 --- /dev/null +++ b/queue-4.19/selinux-add-support-for-rtm_newchain-rtm_delchain-and-rtm_getchain.patch @@ -0,0 +1,65 @@ +From 598e1a42e9626213565d3b22ea948ce78556512a Mon Sep 17 00:00:00 2001 +From: Paul Moore +Date: Wed, 28 Nov 2018 12:57:33 -0500 +Subject: selinux: add support for RTM_NEWCHAIN, RTM_DELCHAIN, and RTM_GETCHAIN + +From: Paul Moore + +commit 598e1a42e9626213565d3b22ea948ce78556512a upstream. + +Commit 32a4f5ecd738 ("net: sched: introduce chain object to uapi") +added new RTM_* definitions without properly updating SELinux, this +patch adds the necessary SELinux support. + +While there was a BUILD_BUG_ON() in the SELinux code to protect from +exactly this case, it was bypassed in the broken commit. In order to +hopefully prevent this from happening in the future, add additional +comments which provide some instructions on how to resolve the +BUILD_BUG_ON() failures. + +Fixes: 32a4f5ecd738 ("net: sched: introduce chain object to uapi") +Cc: # 4.19 +Acked-by: David S. Miller +Signed-off-by: Paul Moore +Signed-off-by: Greg Kroah-Hartman + +--- + security/selinux/nlmsgtab.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +--- a/security/selinux/nlmsgtab.c ++++ b/security/selinux/nlmsgtab.c +@@ -80,6 +80,9 @@ static const struct nlmsg_perm nlmsg_rou + { RTM_NEWSTATS, NETLINK_ROUTE_SOCKET__NLMSG_READ }, + { RTM_GETSTATS, NETLINK_ROUTE_SOCKET__NLMSG_READ }, + { RTM_NEWCACHEREPORT, NETLINK_ROUTE_SOCKET__NLMSG_READ }, ++ { RTM_NEWCHAIN, NETLINK_ROUTE_SOCKET__NLMSG_WRITE }, ++ { RTM_DELCHAIN, NETLINK_ROUTE_SOCKET__NLMSG_WRITE }, ++ { RTM_GETCHAIN, NETLINK_ROUTE_SOCKET__NLMSG_READ }, + }; + + static const struct nlmsg_perm nlmsg_tcpdiag_perms[] = +@@ -158,7 +161,11 @@ int selinux_nlmsg_lookup(u16 sclass, u16 + + switch (sclass) { + case SECCLASS_NETLINK_ROUTE_SOCKET: +- /* RTM_MAX always point to RTM_SETxxxx, ie RTM_NEWxxx + 3 */ ++ /* RTM_MAX always points to RTM_SETxxxx, ie RTM_NEWxxx + 3. ++ * If the BUILD_BUG_ON() below fails you must update the ++ * structures at the top of this file with the new mappings ++ * before updating the BUILD_BUG_ON() macro! ++ */ + BUILD_BUG_ON(RTM_MAX != (RTM_NEWCHAIN + 3)); + err = nlmsg_perm(nlmsg_type, perm, nlmsg_route_perms, + sizeof(nlmsg_route_perms)); +@@ -170,6 +177,10 @@ int selinux_nlmsg_lookup(u16 sclass, u16 + break; + + case SECCLASS_NETLINK_XFRM_SOCKET: ++ /* If the BUILD_BUG_ON() below fails you must update the ++ * structures at the top of this file with the new mappings ++ * before updating the BUILD_BUG_ON() macro! ++ */ + BUILD_BUG_ON(XFRM_MSG_MAX != XFRM_MSG_MAPPING); + err = nlmsg_perm(nlmsg_type, perm, nlmsg_xfrm_perms, + sizeof(nlmsg_xfrm_perms)); diff --git a/queue-4.19/series b/queue-4.19/series index 3505d378fef..5be174bf6ef 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -23,3 +23,18 @@ userfaultfd-shmem-allocate-anonymous-memory-for-map_private-shmem.patch userfaultfd-shmem-add-i_size-checks.patch userfaultfd-shmem-uffdio_copy-set-the-page-dirty-if-vm_write-is-not-set.patch kgdboc-fix-restrict-error.patch +kgdboc-fix-warning-with-module-build.patch +svm-add-mutex_lock-to-protect-apic_access_page_done-on-amd-systems.patch +selinux-add-support-for-rtm_newchain-rtm_delchain-and-rtm_getchain.patch +i40e-fix-deletion-of-mac-filters.patch +scsi-lpfc-fix-block-guard-enablement-on-sli3-adapters.patch +input-xpad-quirk-all-pdp-xbox-one-gamepads.patch +input-synaptics-add-pnp-id-for-thinkpad-p50-to-smbus.patch +input-matrix_keypad-check-for-errors-from-of_get_named_gpio.patch +input-cros_ec_keyb-fix-button-switch-capability-reports.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-tree-checker-don-t-check-max-block-group-size-as-current-max-chunk-size-limit-is-unreliable.patch +arc-change-defconfig-defaults-to-arcv2.patch +arc-add-support-of-nfsv3-acl.patch diff --git a/queue-4.19/svm-add-mutex_lock-to-protect-apic_access_page_done-on-amd-systems.patch b/queue-4.19/svm-add-mutex_lock-to-protect-apic_access_page_done-on-amd-systems.patch new file mode 100644 index 00000000000..c5f0187ebc2 --- /dev/null +++ b/queue-4.19/svm-add-mutex_lock-to-protect-apic_access_page_done-on-amd-systems.patch @@ -0,0 +1,63 @@ +From 30510387a5e45bfcf8190e03ec7aa15b295828e2 Mon Sep 17 00:00:00 2001 +From: Wei Wang +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 + +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 +Signed-off-by: Amadeusz Juskowiak +Signed-off-by: Julian Stecklina +Signed-off-by: Suravee Suthikulpanit +Reviewed-by: Joerg Roedel +Cc: stable@vger.kernel.org +Signed-off-by: Paolo Bonzini +Signed-off-by: Greg Kroah-Hartman + +--- + 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 +@@ -1663,20 +1663,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)