]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 23 Jun 2020 12:24:28 +0000 (14:24 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 23 Jun 2020 12:24:28 +0000 (14:24 +0200)
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

queue-4.19/crypto-algboss-don-t-wait-during-notifier-callback.patch [new file with mode: 0644]
queue-4.19/crypto-algif_skcipher-cap-recv-sg-list-at-ctx-used.patch [new file with mode: 0644]
queue-4.19/e1000e-do-not-wake-up-the-system-via-wol-if-device-wakeup-is-disabled.patch [new file with mode: 0644]
queue-4.19/kprobes-fix-to-protect-kick_kprobe_optimizer-by-kprobe_mutex.patch [new file with mode: 0644]
queue-4.19/net-octeon-mgmt-repair-filling-of-rx-ring.patch [new file with mode: 0644]
queue-4.19/series

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 (file)
index 0000000..49dda15
--- /dev/null
@@ -0,0 +1,58 @@
+From 77251e41f89a813b4090f5199442f217bbf11297 Mon Sep 17 00:00:00 2001
+From: Eric Biggers <ebiggers@google.com>
+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 <ebiggers@google.com>
+
+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 <gerow@google.com>
+Fixes: 398710379f51 ("crypto: algapi - Move larval completion into algboss")
+Cc: <stable@vger.kernel.org> # v3.6+
+Cc: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Eric Biggers <ebiggers@google.com>
+Reported-by: Kai Lüke <kai@kinvolk.io>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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 (file)
index 0000000..7ef5031
--- /dev/null
@@ -0,0 +1,42 @@
+From 7cf81954705b7e5b057f7dc39a7ded54422ab6e1 Mon Sep 17 00:00:00 2001
+From: Herbert Xu <herbert@gondor.apana.org.au>
+Date: Fri, 29 May 2020 14:54:43 +1000
+Subject: crypto: algif_skcipher - Cap recv SG list at ctx->used
+
+From: Herbert Xu <herbert@gondor.apana.org.au>
+
+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: <stable@vger.kernel.org>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Reviewed-by: Stephan Mueller <smueller@chronox.de>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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 (file)
index 0000000..4c53678
--- /dev/null
@@ -0,0 +1,65 @@
+From 6bf6be1127f7e6d4bf39f84d56854e944d045d74 Mon Sep 17 00:00:00 2001
+From: Chen Yu <yu.c.chen@intel.com>
+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 <yu.c.chen@intel.com>
+
+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" <rafael.j.wysocki@intel.com>
+Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Chen Yu <yu.c.chen@intel.com>
+Tested-by: Aaron Brown <aaron.f.brown@intel.com>
+Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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 (file)
index 0000000..8f4cf20
--- /dev/null
@@ -0,0 +1,53 @@
+From 1a0aa991a6274161c95a844c58cfb801d681eb59 Mon Sep 17 00:00:00 2001
+From: Masami Hiramatsu <mhiramat@kernel.org>
+Date: Tue, 12 May 2020 17:02:56 +0900
+Subject: kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex
+
+From: Masami Hiramatsu <mhiramat@kernel.org>
+
+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 <mingo@kernel.org>
+Cc: "Gustavo A . R . Silva" <gustavoars@kernel.org>
+Cc: Anders Roxell <anders.roxell@linaro.org>
+Cc: "Naveen N . Rao" <naveen.n.rao@linux.ibm.com>
+Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
+Cc: David Miller <davem@davemloft.net>
+Cc: Ingo Molnar <mingo@elte.hu>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Ziqian SUN <zsun@redhat.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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 (file)
index 0000000..42b84d1
--- /dev/null
@@ -0,0 +1,43 @@
+From 0c34bb598c510e070160029f34efeeb217000f8d Mon Sep 17 00:00:00 2001
+From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
+Date: Fri, 29 May 2020 14:17:10 +0200
+Subject: net: octeon: mgmt: Repair filling of RX ring
+
+From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
+
+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 <alexander.sverdlin@nokia.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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);
index ac45a1d518d9a50337988aae54e877561be127fc..b8c7ac5b4af9fc9aa2a326936e9def7ab1634d76 100644 (file)
@@ -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