From: Greg Kroah-Hartman Date: Mon, 25 Nov 2019 17:50:02 +0000 (+0100) Subject: 4.9-stable patches X-Git-Tag: v4.4.204~91 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eb69534cc8d6350e527e4d9b989da7a71646e1cc;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: drm-amdgpu-disable-gfxoff-when-using-register-read-interface.patch gpio-max77620-fixup-debounce-delays.patch mm-ksm.c-don-t-warn-if-page-is-still-mapped-in-remove_stable_node.patch revert-fs-ocfs2-fix-possible-null-pointer-dereferences-in-ocfs2_xa_prepare_entry.patch tools-gpio-correctly-add-make-dependencies-for-gpio_utils.patch --- diff --git a/queue-4.9/drm-amdgpu-disable-gfxoff-when-using-register-read-interface.patch b/queue-4.9/drm-amdgpu-disable-gfxoff-when-using-register-read-interface.patch new file mode 100644 index 00000000000..018ca0b4278 --- /dev/null +++ b/queue-4.9/drm-amdgpu-disable-gfxoff-when-using-register-read-interface.patch @@ -0,0 +1,46 @@ +From c57040d333c6729ce99c2cb95061045ff84c89ea Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Thu, 14 Nov 2019 11:39:05 -0500 +Subject: drm/amdgpu: disable gfxoff when using register read interface + +From: Alex Deucher + +commit c57040d333c6729ce99c2cb95061045ff84c89ea upstream. + +When gfxoff is enabled, accessing gfx registers via MMIO +can lead to a hang. + +Bug: https://bugzilla.kernel.org/show_bug.cgi?id=205497 +Acked-by: Xiaojie Yuan +Reviewed-by: Evan Quan +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +@@ -438,15 +438,19 @@ static int amdgpu_info_ioctl(struct drm_ + return -ENOMEM; + alloc_size = info->read_mmr_reg.count * sizeof(*regs); + +- for (i = 0; i < info->read_mmr_reg.count; i++) ++ amdgpu_gfx_off_ctrl(adev, false); ++ for (i = 0; i < info->read_mmr_reg.count; i++) { + if (amdgpu_asic_read_register(adev, se_num, sh_num, + info->read_mmr_reg.dword_offset + i, + ®s[i])) { + DRM_DEBUG_KMS("unallowed offset %#x\n", + info->read_mmr_reg.dword_offset + i); + kfree(regs); ++ amdgpu_gfx_off_ctrl(adev, true); + return -EFAULT; + } ++ } ++ amdgpu_gfx_off_ctrl(adev, true); + n = copy_to_user(out, regs, min(size, alloc_size)); + kfree(regs); + return n ? -EFAULT : 0; diff --git a/queue-4.9/gpio-max77620-fixup-debounce-delays.patch b/queue-4.9/gpio-max77620-fixup-debounce-delays.patch new file mode 100644 index 00000000000..9b0873ec4a7 --- /dev/null +++ b/queue-4.9/gpio-max77620-fixup-debounce-delays.patch @@ -0,0 +1,56 @@ +From b0391479ae04dfcbd208b9571c375064caad9a57 Mon Sep 17 00:00:00 2001 +From: Thierry Reding +Date: Fri, 8 Nov 2019 17:07:46 +0100 +Subject: gpio: max77620: Fixup debounce delays + +From: Thierry Reding + +commit b0391479ae04dfcbd208b9571c375064caad9a57 upstream. + +When converting milliseconds to microseconds in commit fffa6af94894 +("gpio: max77620: Use correct unit for debounce times") some ~1 ms gaps +were introduced between the various ranges supported by the controller. +Fix this by changing the start of each range to the value immediately +following the end of the previous range. This way a debounce time of, +say 8250 us will translate into 16 ms instead of returning an -EINVAL +error. + +Typically the debounce delay is only ever set through device tree and +specified in milliseconds, so we can never really hit this issue because +debounce times are always a multiple of 1000 us. + +The only notable exception for this is drivers/mmc/host/mmc-spi.c where +the CD GPIO is requested, which passes a 1 us debounce time. According +to a comment preceeding that code this should actually be 1 ms (i.e. +1000 us). + +Reported-by: Pavel Machek +Signed-off-by: Thierry Reding +Acked-by: Pavel Machek +Cc: +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpio/gpio-max77620.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/gpio/gpio-max77620.c ++++ b/drivers/gpio/gpio-max77620.c +@@ -167,13 +167,13 @@ static int max77620_gpio_set_debounce(st + case 0: + val = MAX77620_CNFG_GPIO_DBNC_None; + break; +- case 1000 ... 8000: ++ case 1 ... 8000: + val = MAX77620_CNFG_GPIO_DBNC_8ms; + break; +- case 9000 ... 16000: ++ case 8001 ... 16000: + val = MAX77620_CNFG_GPIO_DBNC_16ms; + break; +- case 17000 ... 32000: ++ case 16001 ... 32000: + val = MAX77620_CNFG_GPIO_DBNC_32ms; + break; + default: diff --git a/queue-4.9/mm-ksm.c-don-t-warn-if-page-is-still-mapped-in-remove_stable_node.patch b/queue-4.9/mm-ksm.c-don-t-warn-if-page-is-still-mapped-in-remove_stable_node.patch new file mode 100644 index 00000000000..c29b6bfaa45 --- /dev/null +++ b/queue-4.9/mm-ksm.c-don-t-warn-if-page-is-still-mapped-in-remove_stable_node.patch @@ -0,0 +1,63 @@ +From 9a63236f1ad82d71a98aa80320b6cb618fb32f44 Mon Sep 17 00:00:00 2001 +From: Andrey Ryabinin +Date: Thu, 21 Nov 2019 17:54:01 -0800 +Subject: mm/ksm.c: don't WARN if page is still mapped in remove_stable_node() + +From: Andrey Ryabinin + +commit 9a63236f1ad82d71a98aa80320b6cb618fb32f44 upstream. + +It's possible to hit the WARN_ON_ONCE(page_mapped(page)) in +remove_stable_node() when it races with __mmput() and squeezes in +between ksm_exit() and exit_mmap(). + + WARNING: CPU: 0 PID: 3295 at mm/ksm.c:888 remove_stable_node+0x10c/0x150 + + Call Trace: + remove_all_stable_nodes+0x12b/0x330 + run_store+0x4ef/0x7b0 + kernfs_fop_write+0x200/0x420 + vfs_write+0x154/0x450 + ksys_write+0xf9/0x1d0 + do_syscall_64+0x99/0x510 + entry_SYSCALL_64_after_hwframe+0x49/0xbe + +Remove the warning as there is nothing scary going on. + +Link: http://lkml.kernel.org/r/20191119131850.5675-1-aryabinin@virtuozzo.com +Fixes: cbf86cfe04a6 ("ksm: remove old stable nodes more thoroughly") +Signed-off-by: Andrey Ryabinin +Acked-by: Hugh Dickins +Cc: Andrea Arcangeli +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/ksm.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +--- a/mm/ksm.c ++++ b/mm/ksm.c +@@ -710,13 +710,13 @@ static int remove_stable_node(struct sta + return 0; + } + +- if (WARN_ON_ONCE(page_mapped(page))) { +- /* +- * This should not happen: but if it does, just refuse to let +- * merge_across_nodes be switched - there is no need to panic. +- */ +- err = -EBUSY; +- } else { ++ /* ++ * Page could be still mapped if this races with __mmput() running in ++ * between ksm_exit() and exit_mmap(). Just refuse to let ++ * merge_across_nodes/max_page_sharing be switched. ++ */ ++ err = -EBUSY; ++ if (!page_mapped(page)) { + /* + * The stable node did not yet appear stale to get_ksm_page(), + * since that allows for an unmapped ksm page to be recognized diff --git a/queue-4.9/revert-fs-ocfs2-fix-possible-null-pointer-dereferences-in-ocfs2_xa_prepare_entry.patch b/queue-4.9/revert-fs-ocfs2-fix-possible-null-pointer-dereferences-in-ocfs2_xa_prepare_entry.patch new file mode 100644 index 00000000000..76f5c437391 --- /dev/null +++ b/queue-4.9/revert-fs-ocfs2-fix-possible-null-pointer-dereferences-in-ocfs2_xa_prepare_entry.patch @@ -0,0 +1,111 @@ +From 94b07b6f9e2e996afff7395de6b35f34f4cb10bf Mon Sep 17 00:00:00 2001 +From: Joseph Qi +Date: Thu, 21 Nov 2019 17:53:52 -0800 +Subject: Revert "fs: ocfs2: fix possible null-pointer dereferences in ocfs2_xa_prepare_entry()" + +From: Joseph Qi + +commit 94b07b6f9e2e996afff7395de6b35f34f4cb10bf upstream. + +This reverts commit 56e94ea132bb5c2c1d0b60a6aeb34dcb7d71a53d. + +Commit 56e94ea132bb ("fs: ocfs2: fix possible null-pointer dereferences +in ocfs2_xa_prepare_entry()") introduces a regression that fail to +create directory with mount option user_xattr and acl. Actually the +reported NULL pointer dereference case can be correctly handled by +loc->xl_ops->xlo_add_entry(), so revert it. + +Link: http://lkml.kernel.org/r/1573624916-83825-1-git-send-email-joseph.qi@linux.alibaba.com +Fixes: 56e94ea132bb ("fs: ocfs2: fix possible null-pointer dereferences in ocfs2_xa_prepare_entry()") +Signed-off-by: Joseph Qi +Reported-by: Thomas Voegtle +Acked-by: Changwei Ge +Cc: Jia-Ju Bai +Cc: Mark Fasheh +Cc: Joel Becker +Cc: Junxiao Bi +Cc: Gang He +Cc: Jun Piao +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ocfs2/xattr.c | 56 ++++++++++++++++++++++++++++++++----------------------- + 1 file changed, 33 insertions(+), 23 deletions(-) + +--- a/fs/ocfs2/xattr.c ++++ b/fs/ocfs2/xattr.c +@@ -1497,6 +1497,18 @@ static int ocfs2_xa_check_space(struct o + return loc->xl_ops->xlo_check_space(loc, xi); + } + ++static void ocfs2_xa_add_entry(struct ocfs2_xa_loc *loc, u32 name_hash) ++{ ++ loc->xl_ops->xlo_add_entry(loc, name_hash); ++ loc->xl_entry->xe_name_hash = cpu_to_le32(name_hash); ++ /* ++ * We can't leave the new entry's xe_name_offset at zero or ++ * add_namevalue() will go nuts. We set it to the size of our ++ * storage so that it can never be less than any other entry. ++ */ ++ loc->xl_entry->xe_name_offset = cpu_to_le16(loc->xl_size); ++} ++ + static void ocfs2_xa_add_namevalue(struct ocfs2_xa_loc *loc, + struct ocfs2_xattr_info *xi) + { +@@ -2128,31 +2140,29 @@ static int ocfs2_xa_prepare_entry(struct + if (rc) + goto out; + +- if (!loc->xl_entry) { +- rc = -EINVAL; +- goto out; +- } +- +- if (ocfs2_xa_can_reuse_entry(loc, xi)) { +- orig_value_size = loc->xl_entry->xe_value_size; +- rc = ocfs2_xa_reuse_entry(loc, xi, ctxt); +- if (rc) +- goto out; +- goto alloc_value; +- } ++ if (loc->xl_entry) { ++ if (ocfs2_xa_can_reuse_entry(loc, xi)) { ++ orig_value_size = loc->xl_entry->xe_value_size; ++ rc = ocfs2_xa_reuse_entry(loc, xi, ctxt); ++ if (rc) ++ goto out; ++ goto alloc_value; ++ } + +- if (!ocfs2_xattr_is_local(loc->xl_entry)) { +- orig_clusters = ocfs2_xa_value_clusters(loc); +- rc = ocfs2_xa_value_truncate(loc, 0, ctxt); +- if (rc) { +- mlog_errno(rc); +- ocfs2_xa_cleanup_value_truncate(loc, +- "overwriting", +- orig_clusters); +- goto out; ++ if (!ocfs2_xattr_is_local(loc->xl_entry)) { ++ orig_clusters = ocfs2_xa_value_clusters(loc); ++ rc = ocfs2_xa_value_truncate(loc, 0, ctxt); ++ if (rc) { ++ mlog_errno(rc); ++ ocfs2_xa_cleanup_value_truncate(loc, ++ "overwriting", ++ orig_clusters); ++ goto out; ++ } + } +- } +- ocfs2_xa_wipe_namevalue(loc); ++ ocfs2_xa_wipe_namevalue(loc); ++ } else ++ ocfs2_xa_add_entry(loc, name_hash); + + /* + * If we get here, we have a blank entry. Fill it. We grow our diff --git a/queue-4.9/series b/queue-4.9/series index 574ce725921..93b964a215b 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -3,3 +3,8 @@ net-rtnetlink-prevent-underflows-in-do_setvfinfo.patch sfc-only-cancel-the-pps-workqueue-if-it-exists.patch net-mlx5e-fix-set-vf-link-state-error-flow.patch net-sched-act_pedit-fix-warn-in-the-traffic-path.patch +gpio-max77620-fixup-debounce-delays.patch +tools-gpio-correctly-add-make-dependencies-for-gpio_utils.patch +revert-fs-ocfs2-fix-possible-null-pointer-dereferences-in-ocfs2_xa_prepare_entry.patch +mm-ksm.c-don-t-warn-if-page-is-still-mapped-in-remove_stable_node.patch +drm-amdgpu-disable-gfxoff-when-using-register-read-interface.patch diff --git a/queue-4.9/tools-gpio-correctly-add-make-dependencies-for-gpio_utils.patch b/queue-4.9/tools-gpio-correctly-add-make-dependencies-for-gpio_utils.patch new file mode 100644 index 00000000000..8686d548038 --- /dev/null +++ b/queue-4.9/tools-gpio-correctly-add-make-dependencies-for-gpio_utils.patch @@ -0,0 +1,74 @@ +From 0161a94e2d1c713bd34d72bc0239d87c31747bf7 Mon Sep 17 00:00:00 2001 +From: Laura Abbott +Date: Tue, 12 Nov 2019 17:10:26 -0500 +Subject: tools: gpio: Correctly add make dependencies for gpio_utils + +From: Laura Abbott + +commit 0161a94e2d1c713bd34d72bc0239d87c31747bf7 upstream. + +gpio tools fail to build correctly with make parallelization: + +$ make -s -j24 +ld: gpio-utils.o: file not recognized: file truncated +make[1]: *** [/home/labbott/linux_upstream/tools/build/Makefile.build:145: lsgpio-in.o] Error 1 +make: *** [Makefile:43: lsgpio-in.o] Error 2 +make: *** Waiting for unfinished jobs.... + +This is because gpio-utils.o is used across multiple targets. +Fix this by making gpio-utios.o a proper dependency. + +Cc: +Signed-off-by: Laura Abbott +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Greg Kroah-Hartman + +--- + tools/gpio/Build | 1 + + tools/gpio/Makefile | 10 +++++++--- + 2 files changed, 8 insertions(+), 3 deletions(-) + +--- a/tools/gpio/Build ++++ b/tools/gpio/Build +@@ -1,3 +1,4 @@ ++gpio-utils-y += gpio-utils.o + lsgpio-y += lsgpio.o gpio-utils.o + gpio-hammer-y += gpio-hammer.o gpio-utils.o + gpio-event-mon-y += gpio-event-mon.o gpio-utils.o +--- a/tools/gpio/Makefile ++++ b/tools/gpio/Makefile +@@ -32,11 +32,15 @@ $(OUTPUT)include/linux/gpio.h: ../../inc + + prepare: $(OUTPUT)include/linux/gpio.h + ++GPIO_UTILS_IN := $(output)gpio-utils-in.o ++$(GPIO_UTILS_IN): prepare FORCE ++ $(Q)$(MAKE) $(build)=gpio-utils ++ + # + # lsgpio + # + LSGPIO_IN := $(OUTPUT)lsgpio-in.o +-$(LSGPIO_IN): prepare FORCE ++$(LSGPIO_IN): prepare FORCE $(OUTPUT)gpio-utils-in.o + $(Q)$(MAKE) $(build)=lsgpio + $(OUTPUT)lsgpio: $(LSGPIO_IN) + $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ +@@ -45,7 +49,7 @@ $(OUTPUT)lsgpio: $(LSGPIO_IN) + # gpio-hammer + # + GPIO_HAMMER_IN := $(OUTPUT)gpio-hammer-in.o +-$(GPIO_HAMMER_IN): prepare FORCE ++$(GPIO_HAMMER_IN): prepare FORCE $(OUTPUT)gpio-utils-in.o + $(Q)$(MAKE) $(build)=gpio-hammer + $(OUTPUT)gpio-hammer: $(GPIO_HAMMER_IN) + $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ +@@ -54,7 +58,7 @@ $(OUTPUT)gpio-hammer: $(GPIO_HAMMER_IN) + # gpio-event-mon + # + GPIO_EVENT_MON_IN := $(OUTPUT)gpio-event-mon-in.o +-$(GPIO_EVENT_MON_IN): prepare FORCE ++$(GPIO_EVENT_MON_IN): prepare FORCE $(OUTPUT)gpio-utils-in.o + $(Q)$(MAKE) $(build)=gpio-event-mon + $(OUTPUT)gpio-event-mon: $(GPIO_EVENT_MON_IN) + $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@