From 1197133eebf4fb76d063287deba613e09ba417e8 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 23 Jun 2020 14:24:28 +0200 Subject: [PATCH] 4.19-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 net-octeon-mgmt-repair-filling-of-rx-ring.patch --- ...-don-t-wait-during-notifier-callback.patch | 58 +++++++++++++++++ ...kcipher-cap-recv-sg-list-at-ctx-used.patch | 42 ++++++++++++ ...via-wol-if-device-wakeup-is-disabled.patch | 65 +++++++++++++++++++ ...ick_kprobe_optimizer-by-kprobe_mutex.patch | 53 +++++++++++++++ ...cteon-mgmt-repair-filling-of-rx-ring.patch | 43 ++++++++++++ queue-4.19/series | 5 ++ 6 files changed, 266 insertions(+) create mode 100644 queue-4.19/crypto-algboss-don-t-wait-during-notifier-callback.patch create mode 100644 queue-4.19/crypto-algif_skcipher-cap-recv-sg-list-at-ctx-used.patch create mode 100644 queue-4.19/e1000e-do-not-wake-up-the-system-via-wol-if-device-wakeup-is-disabled.patch create mode 100644 queue-4.19/kprobes-fix-to-protect-kick_kprobe_optimizer-by-kprobe_mutex.patch create mode 100644 queue-4.19/net-octeon-mgmt-repair-filling-of-rx-ring.patch diff --git a/queue-4.19/crypto-algboss-don-t-wait-during-notifier-callback.patch b/queue-4.19/crypto-algboss-don-t-wait-during-notifier-callback.patch new file mode 100644 index 00000000000..49dda159e8b --- /dev/null +++ b/queue-4.19/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 +@@ -193,8 +193,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.19/crypto-algif_skcipher-cap-recv-sg-list-at-ctx-used.patch b/queue-4.19/crypto-algif_skcipher-cap-recv-sg-list-at-ctx-used.patch new file mode 100644 index 00000000000..7ef50310072 --- /dev/null +++ b/queue-4.19/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 +@@ -78,14 +78,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.19/e1000e-do-not-wake-up-the-system-via-wol-if-device-wakeup-is-disabled.patch b/queue-4.19/e1000e-do-not-wake-up-the-system-via-wol-if-device-wakeup-is-disabled.patch new file mode 100644 index 00000000000..4c53678ce03 --- /dev/null +++ b/queue-4.19/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 +@@ -6308,11 +6308,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; +@@ -6369,7 +6375,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.19/kprobes-fix-to-protect-kick_kprobe_optimizer-by-kprobe_mutex.patch b/queue-4.19/kprobes-fix-to-protect-kick_kprobe_optimizer-by-kprobe_mutex.patch new file mode 100644 index 00000000000..8f4cf204a64 --- /dev/null +++ b/queue-4.19/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.19/net-octeon-mgmt-repair-filling-of-rx-ring.patch b/queue-4.19/net-octeon-mgmt-repair-filling-of-rx-ring.patch new file mode 100644 index 00000000000..42b84d1ba2c --- /dev/null +++ b/queue-4.19/net-octeon-mgmt-repair-filling-of-rx-ring.patch @@ -0,0 +1,43 @@ +From 0c34bb598c510e070160029f34efeeb217000f8d Mon Sep 17 00:00:00 2001 +From: Alexander Sverdlin +Date: Fri, 29 May 2020 14:17:10 +0200 +Subject: net: octeon: mgmt: Repair filling of RX ring + +From: Alexander Sverdlin + +commit 0c34bb598c510e070160029f34efeeb217000f8d upstream. + +The removal of mips_swiotlb_ops exposed a problem in octeon_mgmt Ethernet +driver. mips_swiotlb_ops had an mb() after most of the operations and the +removal of the ops had broken the receive functionality of the driver. +My code inspection has shown no other places except +octeon_mgmt_rx_fill_ring() where an explicit barrier would be obviously +missing. The latter function however has to make sure that "ringing the +bell" doesn't happen before RX ring entry is really written. + +The patch has been successfully tested on Octeon II. + +Fixes: a999933db9ed ("MIPS: remove mips_swiotlb_ops") +Cc: stable@vger.kernel.org +Signed-off-by: Alexander Sverdlin +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/cavium/octeon/octeon_mgmt.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c ++++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c +@@ -235,6 +235,11 @@ static void octeon_mgmt_rx_fill_ring(str + + /* Put it in the ring. */ + p->rx_ring[p->rx_next_fill] = re.d64; ++ /* Make sure there is no reorder of filling the ring and ringing ++ * the bell ++ */ ++ wmb(); ++ + dma_sync_single_for_device(p->dev, p->rx_ring_handle, + ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE), + DMA_BIDIRECTIONAL); diff --git a/queue-4.19/series b/queue-4.19/series index ac45a1d518d..b8c7ac5b4af 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -195,3 +195,8 @@ mtd-rawnand-tmio-fix-the-probe-error-path.patch s390-fix-syscall_get_error-for-compat-processes.patch drm-i915-whitelist-context-local-timestamp-in-the-gen9-cmdparser.patch drm-i915-icl-fix-hotplug-interrupt-disabling-after-storm-detection.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 +net-octeon-mgmt-repair-filling-of-rx-ring.patch -- 2.47.3