From: Sasha Levin Date: Thu, 16 Apr 2020 12:44:22 +0000 (-0400) Subject: Fixes for 4.4 X-Git-Tag: v4.19.116~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e8a51d8f27315a83dc0c774c77efc04e3a35b907;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.4 Signed-off-by: Sasha Levin --- diff --git a/queue-4.4/drm-dp_mst-fix-clearing-payload-state-on-topology-di.patch b/queue-4.4/drm-dp_mst-fix-clearing-payload-state-on-topology-di.patch new file mode 100644 index 00000000000..467d51f6b01 --- /dev/null +++ b/queue-4.4/drm-dp_mst-fix-clearing-payload-state-on-topology-di.patch @@ -0,0 +1,94 @@ +From d071c8d6f5fe6ae55c7dfe7b6ef82277faa0ac7e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Jan 2020 14:43:20 -0500 +Subject: drm/dp_mst: Fix clearing payload state on topology disable +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Lyude Paul + +[ Upstream commit 8732fe46b20c951493bfc4dba0ad08efdf41de81 ] + +The issues caused by: + +commit 64e62bdf04ab ("drm/dp_mst: Remove VCPI while disabling topology +mgr") + +Prompted me to take a closer look at how we clear the payload state in +general when disabling the topology, and it turns out there's actually +two subtle issues here. + +The first is that we're not grabbing &mgr.payload_lock when clearing the +payloads in drm_dp_mst_topology_mgr_set_mst(). Seeing as the canonical +lock order is &mgr.payload_lock -> &mgr.lock (because we always want +&mgr.lock to be the inner-most lock so topology validation always +works), this makes perfect sense. It also means that -technically- there +could be racing between someone calling +drm_dp_mst_topology_mgr_set_mst() to disable the topology, along with a +modeset occurring that's modifying the payload state at the same time. + +The second is the more obvious issue that Wayne Lin discovered, that +we're not clearing proposed_payloads when disabling the topology. + +I actually can't see any obvious places where the racing caused by the +first issue would break something, and it could be that some of our +higher-level locks already prevent this by happenstance, but better safe +then sorry. So, let's make it so that drm_dp_mst_topology_mgr_set_mst() +first grabs &mgr.payload_lock followed by &mgr.lock so that we never +race when modifying the payload state. Then, we also clear +proposed_payloads to fix the original issue of enabling a new topology +with a dirty payload state. This doesn't clear any of the drm_dp_vcpi +structures, but those are getting destroyed along with the ports anyway. + +Changes since v1: +* Use sizeof(mgr->payloads[0])/sizeof(mgr->proposed_vcpis[0]) instead - + vsyrjala + +Cc: Sean Paul +Cc: Wayne Lin +Cc: Ville Syrjälä +Cc: stable@vger.kernel.org # v4.4+ +Signed-off-by: Lyude Paul +Reviewed-by: Ville Syrjälä +Link: https://patchwork.freedesktop.org/patch/msgid/20200122194321.14953-1-lyude@redhat.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/drm_dp_mst_topology.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c +index f5229b083f8ea..483bd48467312 100644 +--- a/drivers/gpu/drm/drm_dp_mst_topology.c ++++ b/drivers/gpu/drm/drm_dp_mst_topology.c +@@ -2031,6 +2031,7 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms + int ret = 0; + struct drm_dp_mst_branch *mstb = NULL; + ++ mutex_lock(&mgr->payload_lock); + mutex_lock(&mgr->lock); + if (mst_state == mgr->mst_state) + goto out_unlock; +@@ -2093,7 +2094,10 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms + /* this can fail if the device is gone */ + drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL, 0); + ret = 0; +- memset(mgr->payloads, 0, mgr->max_payloads * sizeof(struct drm_dp_payload)); ++ memset(mgr->payloads, 0, ++ mgr->max_payloads * sizeof(mgr->payloads[0])); ++ memset(mgr->proposed_vcpis, 0, ++ mgr->max_payloads * sizeof(mgr->proposed_vcpis[0])); + mgr->payload_mask = 0; + set_bit(0, &mgr->payload_mask); + mgr->vcpi_mask = 0; +@@ -2101,6 +2105,7 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms + + out_unlock: + mutex_unlock(&mgr->lock); ++ mutex_unlock(&mgr->payload_lock); + if (mstb) + drm_dp_put_mst_branch_device(mstb); + return ret; +-- +2.20.1 + diff --git a/queue-4.4/ipmi-fix-hung-processes-in-__get_guid.patch b/queue-4.4/ipmi-fix-hung-processes-in-__get_guid.patch new file mode 100644 index 00000000000..fb630e4cd0e --- /dev/null +++ b/queue-4.4/ipmi-fix-hung-processes-in-__get_guid.patch @@ -0,0 +1,72 @@ +From 1aba483c75f3c1adfc22146afc6d9f045d41dbd9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Apr 2020 17:04:08 +0800 +Subject: ipmi: fix hung processes in __get_guid() + +From: Wen Yang + +[ Upstream commit 32830a0534700f86366f371b150b17f0f0d140d7 ] + +The wait_event() function is used to detect command completion. +When send_guid_cmd() returns an error, smi_send() has not been +called to send data. Therefore, wait_event() should not be used +on the error path, otherwise it will cause the following warning: + +[ 1361.588808] systemd-udevd D 0 1501 1436 0x00000004 +[ 1361.588813] ffff883f4b1298c0 0000000000000000 ffff883f4b188000 ffff887f7e3d9f40 +[ 1361.677952] ffff887f64bd4280 ffffc90037297a68 ffffffff8173ca3b ffffc90000000010 +[ 1361.767077] 00ffc90037297ad0 ffff887f7e3d9f40 0000000000000286 ffff883f4b188000 +[ 1361.856199] Call Trace: +[ 1361.885578] [] ? __schedule+0x23b/0x780 +[ 1361.951406] [] schedule+0x36/0x80 +[ 1362.010979] [] get_guid+0x118/0x150 [ipmi_msghandler] +[ 1362.091281] [] ? prepare_to_wait_event+0x100/0x100 +[ 1362.168533] [] ipmi_register_smi+0x405/0x940 [ipmi_msghandler] +[ 1362.258337] [] try_smi_init+0x529/0x950 [ipmi_si] +[ 1362.334521] [] ? std_irq_setup+0xd0/0xd0 [ipmi_si] +[ 1362.411701] [] init_ipmi_si+0x492/0x9e0 [ipmi_si] +[ 1362.487917] [] ? ipmi_pci_probe+0x280/0x280 [ipmi_si] +[ 1362.568219] [] do_one_initcall+0x50/0x180 +[ 1362.636109] [] ? kmem_cache_alloc_trace+0x142/0x190 +[ 1362.714330] [] do_init_module+0x5f/0x200 +[ 1362.781208] [] load_module+0x1898/0x1de0 +[ 1362.848069] [] ? __symbol_put+0x60/0x60 +[ 1362.913886] [] ? security_kernel_post_read_file+0x6b/0x80 +[ 1362.998514] [] SYSC_finit_module+0xe5/0x120 +[ 1363.068463] [] ? SYSC_finit_module+0xe5/0x120 +[ 1363.140513] [] SyS_finit_module+0xe/0x10 +[ 1363.207364] [] do_syscall_64+0x74/0x180 + +Fixes: 50c812b2b951 ("[PATCH] ipmi: add full sysfs support") +Signed-off-by: Wen Yang +Cc: Corey Minyard +Cc: Arnd Bergmann +Cc: Greg Kroah-Hartman +Cc: openipmi-developer@lists.sourceforge.net +Cc: linux-kernel@vger.kernel.org +Cc: stable@vger.kernel.org # 2.6.17- +Message-Id: <20200403090408.58745-1-wenyang@linux.alibaba.com> +Signed-off-by: Corey Minyard +Signed-off-by: Sasha Levin +--- + drivers/char/ipmi/ipmi_msghandler.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c +index 5cb5e8ff02240..7b8c1a64a1009 100644 +--- a/drivers/char/ipmi/ipmi_msghandler.c ++++ b/drivers/char/ipmi/ipmi_msghandler.c +@@ -2645,7 +2645,9 @@ get_guid(ipmi_smi_t intf) + if (rv) + /* Send failed, no GUID available. */ + intf->bmc->guid_set = 0; +- wait_event(intf->waitq, intf->bmc->guid_set != 2); ++ else ++ wait_event(intf->waitq, intf->bmc->guid_set != 2); ++ + intf->null_user_handler = NULL; + } + +-- +2.20.1 + diff --git a/queue-4.4/misc-echo-remove-unnecessary-parentheses-and-simplif.patch b/queue-4.4/misc-echo-remove-unnecessary-parentheses-and-simplif.patch new file mode 100644 index 00000000000..20052326448 --- /dev/null +++ b/queue-4.4/misc-echo-remove-unnecessary-parentheses-and-simplif.patch @@ -0,0 +1,56 @@ +From 2322d4f4381e66db31ae174e92a03ca6dbec0430 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 14 Sep 2018 23:43:37 -0700 +Subject: misc: echo: Remove unnecessary parentheses and simplify check for + zero + +From: Nathan Chancellor + +[ Upstream commit 85dc2c65e6c975baaf36ea30f2ccc0a36a8c8add ] + +Clang warns when multiple pairs of parentheses are used for a single +conditional statement. + +drivers/misc/echo/echo.c:384:27: warning: equality comparison with +extraneous parentheses [-Wparentheses-equality] + if ((ec->nonupdate_dwell == 0)) { + ~~~~~~~~~~~~~~~~~~~~^~~~ +drivers/misc/echo/echo.c:384:27: note: remove extraneous parentheses +around the comparison to silence this warning + if ((ec->nonupdate_dwell == 0)) { + ~ ^ ~ +drivers/misc/echo/echo.c:384:27: note: use '=' to turn this equality +comparison into an assignment + if ((ec->nonupdate_dwell == 0)) { + ^~ + = +1 warning generated. + +Remove them and while we're at it, simplify the zero check as '!var' is +used more than 'var == 0'. + +Reported-by: Nick Desaulniers +Signed-off-by: Nathan Chancellor +Reviewed-by: Nick Desaulniers +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/misc/echo/echo.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/misc/echo/echo.c b/drivers/misc/echo/echo.c +index 9597e9523cac4..fff13176f9b8b 100644 +--- a/drivers/misc/echo/echo.c ++++ b/drivers/misc/echo/echo.c +@@ -454,7 +454,7 @@ int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx) + */ + ec->factor = 0; + ec->shift = 0; +- if ((ec->nonupdate_dwell == 0)) { ++ if (!ec->nonupdate_dwell) { + int p, logp, shift; + + /* Determine: +-- +2.20.1 + diff --git a/queue-4.4/powerpc-fsl_booke-avoid-creating-duplicate-tlb1-entr.patch b/queue-4.4/powerpc-fsl_booke-avoid-creating-duplicate-tlb1-entr.patch new file mode 100644 index 00000000000..399590b90a4 --- /dev/null +++ b/queue-4.4/powerpc-fsl_booke-avoid-creating-duplicate-tlb1-entr.patch @@ -0,0 +1,80 @@ +From fddd33dfc2186dfa0b9b979e4355f3155b1a73da Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jan 2020 11:19:25 +0000 +Subject: powerpc/fsl_booke: Avoid creating duplicate tlb1 entry + +From: Laurentiu Tudor + +[ Upstream commit aa4113340ae6c2811e046f08c2bc21011d20a072 ] + +In the current implementation, the call to loadcam_multi() is wrapped +between switch_to_as1() and restore_to_as0() calls so, when it tries +to create its own temporary AS=1 TLB1 entry, it ends up duplicating +the existing one created by switch_to_as1(). Add a check to skip +creating the temporary entry if already running in AS=1. + +Fixes: d9e1831a4202 ("powerpc/85xx: Load all early TLB entries at once") +Cc: stable@vger.kernel.org # v4.4+ +Signed-off-by: Laurentiu Tudor +Acked-by: Scott Wood +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20200123111914.2565-1-laurentiu.tudor@nxp.com +Signed-off-by: Sasha Levin +--- + arch/powerpc/mm/tlb_nohash_low.S | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/arch/powerpc/mm/tlb_nohash_low.S b/arch/powerpc/mm/tlb_nohash_low.S +index 68c477592e436..6e6a10bf3907e 100644 +--- a/arch/powerpc/mm/tlb_nohash_low.S ++++ b/arch/powerpc/mm/tlb_nohash_low.S +@@ -400,7 +400,7 @@ _GLOBAL(set_context) + * extern void loadcam_entry(unsigned int index) + * + * Load TLBCAM[index] entry in to the L2 CAM MMU +- * Must preserve r7, r8, r9, and r10 ++ * Must preserve r7, r8, r9, r10 and r11 + */ + _GLOBAL(loadcam_entry) + mflr r5 +@@ -436,6 +436,10 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_BIG_PHYS) + */ + _GLOBAL(loadcam_multi) + mflr r8 ++ /* Don't switch to AS=1 if already there */ ++ mfmsr r11 ++ andi. r11,r11,MSR_IS ++ bne 10f + + /* + * Set up temporary TLB entry that is the same as what we're +@@ -461,6 +465,7 @@ _GLOBAL(loadcam_multi) + mtmsr r6 + isync + ++10: + mr r9,r3 + add r10,r3,r4 + 2: bl loadcam_entry +@@ -469,6 +474,10 @@ _GLOBAL(loadcam_multi) + mr r3,r9 + blt 2b + ++ /* Don't return to AS=0 if we were in AS=1 at function start */ ++ andi. r11,r11,MSR_IS ++ bne 3f ++ + /* Return to AS=0 and clear the temporary entry */ + mfmsr r6 + rlwinm. r6,r6,0,~(MSR_IS|MSR_DS) +@@ -484,6 +493,7 @@ _GLOBAL(loadcam_multi) + tlbwe + isync + ++3: + mtlr r8 + blr + #endif +-- +2.20.1 + diff --git a/queue-4.4/series b/queue-4.4/series index f261f443196..80159804f57 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -48,3 +48,7 @@ hfsplus-fix-crash-and-filesystem-corruption-when-deleting-files.patch libata-return-correct-status-in-sata_pmp_eh_recover_pm-when-ata_dflag_detach-is-set.patch powerpc-64-tm-don-t-let-userspace-set-regs-trap-via-sigreturn.patch btrfs-fix-crash-during-unmount-due-to-race-with-dela.patch +drm-dp_mst-fix-clearing-payload-state-on-topology-di.patch +ipmi-fix-hung-processes-in-__get_guid.patch +powerpc-fsl_booke-avoid-creating-duplicate-tlb1-entr.patch +misc-echo-remove-unnecessary-parentheses-and-simplif.patch