From: Greg Kroah-Hartman Date: Tue, 23 Jun 2020 12:23:38 +0000 (+0200) Subject: 4.14-stable patches X-Git-Tag: v5.7.6~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=93eecb350ad2e5489c72ff164133a884e9d3c5d9;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: crypto-algboss-don-t-wait-during-notifier-callback.patch crypto-algif_skcipher-cap-recv-sg-list-at-ctx-used.patch e1000e-do-not-wake-up-the-system-via-wol-if-device-wakeup-is-disabled.patch kprobes-fix-to-protect-kick_kprobe_optimizer-by-kprobe_mutex.patch --- diff --git a/queue-4.14/crypto-algboss-don-t-wait-during-notifier-callback.patch b/queue-4.14/crypto-algboss-don-t-wait-during-notifier-callback.patch new file mode 100644 index 00000000000..88e532d28e8 --- /dev/null +++ b/queue-4.14/crypto-algboss-don-t-wait-during-notifier-callback.patch @@ -0,0 +1,58 @@ +From 77251e41f89a813b4090f5199442f217bbf11297 Mon Sep 17 00:00:00 2001 +From: Eric Biggers +Date: Thu, 4 Jun 2020 11:52:53 -0700 +Subject: crypto: algboss - don't wait during notifier callback +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Eric Biggers + +commit 77251e41f89a813b4090f5199442f217bbf11297 upstream. + +When a crypto template needs to be instantiated, CRYPTO_MSG_ALG_REQUEST +is sent to crypto_chain. cryptomgr_schedule_probe() handles this by +starting a thread to instantiate the template, then waiting for this +thread to complete via crypto_larval::completion. + +This can deadlock because instantiating the template may require loading +modules, and this (apparently depending on userspace) may need to wait +for the crc-t10dif module (lib/crc-t10dif.c) to be loaded. But +crc-t10dif's module_init function uses crypto_register_notifier() and +therefore takes crypto_chain.rwsem for write. That can't proceed until +the notifier callback has finished, as it holds this semaphore for read. + +Fix this by removing the wait on crypto_larval::completion from within +cryptomgr_schedule_probe(). It's actually unnecessary because +crypto_alg_mod_lookup() calls crypto_larval_wait() itself after sending +CRYPTO_MSG_ALG_REQUEST. + +This only actually became a problem in v4.20 due to commit b76377543b73 +("crc-t10dif: Pick better transform if one becomes available"), but the +unnecessary wait was much older. + +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207159 +Reported-by: Mike Gerow +Fixes: 398710379f51 ("crypto: algapi - Move larval completion into algboss") +Cc: # v3.6+ +Cc: Martin K. Petersen +Signed-off-by: Eric Biggers +Reported-by: Kai Lüke +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + crypto/algboss.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/crypto/algboss.c ++++ b/crypto/algboss.c +@@ -194,8 +194,6 @@ static int cryptomgr_schedule_probe(stru + if (IS_ERR(thread)) + goto err_put_larval; + +- wait_for_completion_interruptible(&larval->completion); +- + return NOTIFY_STOP; + + err_put_larval: diff --git a/queue-4.14/crypto-algif_skcipher-cap-recv-sg-list-at-ctx-used.patch b/queue-4.14/crypto-algif_skcipher-cap-recv-sg-list-at-ctx-used.patch new file mode 100644 index 00000000000..36dc3ed9446 --- /dev/null +++ b/queue-4.14/crypto-algif_skcipher-cap-recv-sg-list-at-ctx-used.patch @@ -0,0 +1,42 @@ +From 7cf81954705b7e5b057f7dc39a7ded54422ab6e1 Mon Sep 17 00:00:00 2001 +From: Herbert Xu +Date: Fri, 29 May 2020 14:54:43 +1000 +Subject: crypto: algif_skcipher - Cap recv SG list at ctx->used + +From: Herbert Xu + +commit 7cf81954705b7e5b057f7dc39a7ded54422ab6e1 upstream. + +Somewhere along the line the cap on the SG list length for receive +was lost. This patch restores it and removes the subsequent test +which is now redundant. + +Fixes: 2d97591ef43d ("crypto: af_alg - consolidation of...") +Cc: +Signed-off-by: Herbert Xu +Reviewed-by: Stephan Mueller +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + crypto/algif_skcipher.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +--- a/crypto/algif_skcipher.c ++++ b/crypto/algif_skcipher.c +@@ -85,14 +85,10 @@ static int _skcipher_recvmsg(struct sock + return PTR_ERR(areq); + + /* convert iovecs of output buffers into RX SGL */ +- err = af_alg_get_rsgl(sk, msg, flags, areq, -1, &len); ++ err = af_alg_get_rsgl(sk, msg, flags, areq, ctx->used, &len); + if (err) + goto free; + +- /* Process only as much RX buffers for which we have TX data */ +- if (len > ctx->used) +- len = ctx->used; +- + /* + * If more buffers are to be expected to be processed, process only + * full block size buffers. diff --git a/queue-4.14/e1000e-do-not-wake-up-the-system-via-wol-if-device-wakeup-is-disabled.patch b/queue-4.14/e1000e-do-not-wake-up-the-system-via-wol-if-device-wakeup-is-disabled.patch new file mode 100644 index 00000000000..874680a81fc --- /dev/null +++ b/queue-4.14/e1000e-do-not-wake-up-the-system-via-wol-if-device-wakeup-is-disabled.patch @@ -0,0 +1,65 @@ +From 6bf6be1127f7e6d4bf39f84d56854e944d045d74 Mon Sep 17 00:00:00 2001 +From: Chen Yu +Date: Fri, 22 May 2020 01:59:00 +0800 +Subject: e1000e: Do not wake up the system via WOL if device wakeup is disabled + +From: Chen Yu + +commit 6bf6be1127f7e6d4bf39f84d56854e944d045d74 upstream. + +Currently the system will be woken up via WOL(Wake On LAN) even if the +device wakeup ability has been disabled via sysfs: + cat /sys/devices/pci0000:00/0000:00:1f.6/power/wakeup + disabled + +The system should not be woken up if the user has explicitly +disabled the wake up ability for this device. + +This patch clears the WOL ability of this network device if the +user has disabled the wake up ability in sysfs. + +Fixes: bc7f75fa9788 ("[E1000E]: New pci-express e1000 driver") +Reported-by: "Rafael J. Wysocki" +Reviewed-by: Andy Shevchenko +Cc: +Signed-off-by: Chen Yu +Tested-by: Aaron Brown +Signed-off-by: Jeff Kirsher +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/intel/e1000e/netdev.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +--- a/drivers/net/ethernet/intel/e1000e/netdev.c ++++ b/drivers/net/ethernet/intel/e1000e/netdev.c +@@ -6328,11 +6328,17 @@ static int __e1000_shutdown(struct pci_d + struct net_device *netdev = pci_get_drvdata(pdev); + struct e1000_adapter *adapter = netdev_priv(netdev); + struct e1000_hw *hw = &adapter->hw; +- u32 ctrl, ctrl_ext, rctl, status; +- /* Runtime suspend should only enable wakeup for link changes */ +- u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol; ++ u32 ctrl, ctrl_ext, rctl, status, wufc; + int retval = 0; + ++ /* Runtime suspend should only enable wakeup for link changes */ ++ if (runtime) ++ wufc = E1000_WUFC_LNKC; ++ else if (device_may_wakeup(&pdev->dev)) ++ wufc = adapter->wol; ++ else ++ wufc = 0; ++ + status = er32(STATUS); + if (status & E1000_STATUS_LU) + wufc &= ~E1000_WUFC_LNKC; +@@ -6389,7 +6395,7 @@ static int __e1000_shutdown(struct pci_d + if (adapter->hw.phy.type == e1000_phy_igp_3) { + e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); + } else if (hw->mac.type >= e1000_pch_lpt) { +- if (!(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC))) ++ if (wufc && !(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC))) + /* ULP does not support wake from unicast, multicast + * or broadcast. + */ diff --git a/queue-4.14/kprobes-fix-to-protect-kick_kprobe_optimizer-by-kprobe_mutex.patch b/queue-4.14/kprobes-fix-to-protect-kick_kprobe_optimizer-by-kprobe_mutex.patch new file mode 100644 index 00000000000..8f4cf204a64 --- /dev/null +++ b/queue-4.14/kprobes-fix-to-protect-kick_kprobe_optimizer-by-kprobe_mutex.patch @@ -0,0 +1,53 @@ +From 1a0aa991a6274161c95a844c58cfb801d681eb59 Mon Sep 17 00:00:00 2001 +From: Masami Hiramatsu +Date: Tue, 12 May 2020 17:02:56 +0900 +Subject: kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex + +From: Masami Hiramatsu + +commit 1a0aa991a6274161c95a844c58cfb801d681eb59 upstream. + +In kprobe_optimizer() kick_kprobe_optimizer() is called +without kprobe_mutex, but this can race with other caller +which is protected by kprobe_mutex. + +To fix that, expand kprobe_mutex protected area to protect +kick_kprobe_optimizer() call. + +Link: http://lkml.kernel.org/r/158927057586.27680.5036330063955940456.stgit@devnote2 + +Fixes: cd7ebe2298ff ("kprobes: Use text_poke_smp_batch for optimizing") +Cc: Ingo Molnar +Cc: "Gustavo A . R . Silva" +Cc: Anders Roxell +Cc: "Naveen N . Rao" +Cc: Anil S Keshavamurthy +Cc: David Miller +Cc: Ingo Molnar +Cc: Peter Zijlstra +Cc: Ziqian SUN +Cc: stable@vger.kernel.org +Signed-off-by: Masami Hiramatsu +Signed-off-by: Steven Rostedt (VMware) +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/kprobes.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/kernel/kprobes.c ++++ b/kernel/kprobes.c +@@ -599,11 +599,12 @@ static void kprobe_optimizer(struct work + mutex_unlock(&module_mutex); + mutex_unlock(&text_mutex); + cpus_read_unlock(); +- mutex_unlock(&kprobe_mutex); + + /* Step 5: Kick optimizer again if needed */ + if (!list_empty(&optimizing_list) || !list_empty(&unoptimizing_list)) + kick_kprobe_optimizer(); ++ ++ mutex_unlock(&kprobe_mutex); + } + + /* Wait for completing optimization and unoptimization */ diff --git a/queue-4.14/series b/queue-4.14/series index 321a7f7b94e..566c95b0cea 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -127,3 +127,7 @@ mtd-rawnand-socrates-fix-the-probe-error-path.patch mtd-rawnand-plat_nand-fix-the-probe-error-path.patch mtd-rawnand-mtk-fix-the-probe-error-path.patch mtd-rawnand-tmio-fix-the-probe-error-path.patch +crypto-algif_skcipher-cap-recv-sg-list-at-ctx-used.patch +crypto-algboss-don-t-wait-during-notifier-callback.patch +kprobes-fix-to-protect-kick_kprobe_optimizer-by-kprobe_mutex.patch +e1000e-do-not-wake-up-the-system-via-wol-if-device-wakeup-is-disabled.patch