]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.9
authorSasha Levin <sashal@kernel.org>
Mon, 13 Sep 2021 01:33:32 +0000 (21:33 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 13 Sep 2021 01:33:32 +0000 (21:33 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
51 files changed:
queue-4.9/6lowpan-iphc-fix-an-off-by-one-check-of-array-index.patch [new file with mode: 0644]
queue-4.9/arm64-dts-exynos-correct-gic-cpu-interfaces-address-.patch [new file with mode: 0644]
queue-4.9/ath6kl-wmi-fix-an-error-code-in-ath6kl_wmi_sync_poin.patch [new file with mode: 0644]
queue-4.9/bcma-fix-memory-leak-for-internally-handled-cores.patch [new file with mode: 0644]
queue-4.9/bluetooth-add-timeout-sanity-check-to-hci_inquiry.patch [new file with mode: 0644]
queue-4.9/bluetooth-fix-repeated-calls-to-sco_sock_kill.patch [new file with mode: 0644]
queue-4.9/bluetooth-increase-btnamsiz-to-21-chars-to-fix-poten.patch [new file with mode: 0644]
queue-4.9/bluetooth-move-shutdown-callback-before-flushing-tx-.patch [new file with mode: 0644]
queue-4.9/bluetooth-sco-prevent-information-leak-in-sco_conn_d.patch [new file with mode: 0644]
queue-4.9/certs-trigger-creation-of-rsa-module-signing-key-if-.patch [new file with mode: 0644]
queue-4.9/cifs-fix-a-potencially-linear-read-overflow.patch [new file with mode: 0644]
queue-4.9/crypto-mxs-dcp-check-for-dma-mapping-errors.patch [new file with mode: 0644]
queue-4.9/crypto-omap-sham-clear-dma-flags-only-after-omap_sha.patch [new file with mode: 0644]
queue-4.9/crypto-qat-do-not-export-adf_iov_putmsg.patch [new file with mode: 0644]
queue-4.9/crypto-qat-do-not-ignore-errors-from-enable_vf2pf_co.patch [new file with mode: 0644]
queue-4.9/crypto-qat-fix-naming-for-init-shutdown-vf-to-pf-not.patch [new file with mode: 0644]
queue-4.9/crypto-qat-fix-reuse-of-completion-variable.patch [new file with mode: 0644]
queue-4.9/crypto-qat-handle-both-source-of-interrupt-in-vf-isr.patch [new file with mode: 0644]
queue-4.9/crypto-qat-use-proper-type-for-vf_mask.patch [new file with mode: 0644]
queue-4.9/drm-msm-dsi-fix-some-reference-counted-resource-leak.patch [new file with mode: 0644]
queue-4.9/i2c-highlander-add-irq-check.patch [new file with mode: 0644]
queue-4.9/i2c-iop3xx-fix-deferred-probing.patch [new file with mode: 0644]
queue-4.9/i2c-mt65xx-fix-irq-check.patch [new file with mode: 0644]
queue-4.9/i2c-s3c2410-fix-irq-check.patch [new file with mode: 0644]
queue-4.9/ipv4-make-exception-cache-less-predictible.patch [new file with mode: 0644]
queue-4.9/libata-fix-ata_host_start.patch [new file with mode: 0644]
queue-4.9/m68k-emu-fix-invalid-free-in-nfeth_cleanup.patch [new file with mode: 0644]
queue-4.9/media-dvb-usb-fix-uninit-value-in-dvb_usb_adapter_dv.patch [new file with mode: 0644]
queue-4.9/media-dvb-usb-fix-uninit-value-in-vp702x_read_mac_ad.patch [new file with mode: 0644]
queue-4.9/media-go7007-remove-redundant-initialization.patch [new file with mode: 0644]
queue-4.9/mmc-dw_mmc-fix-issue-with-uninitialized-dma_slave_co.patch [new file with mode: 0644]
queue-4.9/mmc-moxart-fix-issue-with-uninitialized-dma_slave_co.patch [new file with mode: 0644]
queue-4.9/net-cipso-fix-warnings-in-netlbl_cipsov4_add_std.patch [new file with mode: 0644]
queue-4.9/pci-pm-enable-pme-if-it-can-be-signaled-from-d3cold.patch [new file with mode: 0644]
queue-4.9/posix-cpu-timers-force-next-expiration-recalc-after-.patch [new file with mode: 0644]
queue-4.9/power-supply-axp288_fuel_gauge-report-register-addre.patch [new file with mode: 0644]
queue-4.9/power-supply-max17042_battery-fix-typo-in-max17042_t.patch [new file with mode: 0644]
queue-4.9/regmap-fix-the-offset-of-register-error-log.patch [new file with mode: 0644]
queue-4.9/series
queue-4.9/soc-qcom-smsm-fix-missed-interrupts-if-state-changes.patch [new file with mode: 0644]
queue-4.9/spi-spi-pic32-fix-issue-with-uninitialized-dma_slave.patch [new file with mode: 0644]
queue-4.9/tcp-seq_file-avoid-skipping-sk-during-tcp_seek_last_.patch [new file with mode: 0644]
queue-4.9/udf-check-lvid-earlier.patch [new file with mode: 0644]
queue-4.9/udf_get_extendedattr-had-no-boundary-checks.patch [new file with mode: 0644]
queue-4.9/usb-ehci-orion-handle-errors-of-clk_prepare_enable-i.patch [new file with mode: 0644]
queue-4.9/usb-gadget-mv_u3d-request_irq-after-initializing-udc.patch [new file with mode: 0644]
queue-4.9/usb-gadget-udc-at91-add-irq-check.patch [new file with mode: 0644]
queue-4.9/usb-host-ohci-tmio-add-irq-check.patch [new file with mode: 0644]
queue-4.9/usb-phy-fsl-usb-add-irq-check.patch [new file with mode: 0644]
queue-4.9/usb-phy-tahvo-add-irq-check.patch [new file with mode: 0644]
queue-4.9/usb-phy-twl6030-add-irq-checks.patch [new file with mode: 0644]

diff --git a/queue-4.9/6lowpan-iphc-fix-an-off-by-one-check-of-array-index.patch b/queue-4.9/6lowpan-iphc-fix-an-off-by-one-check-of-array-index.patch
new file mode 100644 (file)
index 0000000..ca024e0
--- /dev/null
@@ -0,0 +1,40 @@
+From 68c66a31cc9a38a26a89f9594945390a09355728 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 12 Jul 2021 13:14:40 +0100
+Subject: 6lowpan: iphc: Fix an off-by-one check of array index
+
+From: Colin Ian King <colin.king@canonical.com>
+
+[ Upstream commit 9af417610b6142e826fd1ee8ba7ff3e9a2133a5a ]
+
+The bounds check of id is off-by-one and the comparison should
+be >= rather >. Currently the WARN_ON_ONCE check does not stop
+the out of range indexing of &ldev->ctx.table[id] so also add
+a return path if the bounds are out of range.
+
+Addresses-Coverity: ("Illegal address computation").
+Fixes: 5609c185f24d ("6lowpan: iphc: add support for stateful compression")
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/6lowpan/debugfs.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/net/6lowpan/debugfs.c b/net/6lowpan/debugfs.c
+index 24915e0bb9ea..2a05c5b5005b 100644
+--- a/net/6lowpan/debugfs.c
++++ b/net/6lowpan/debugfs.c
+@@ -176,7 +176,8 @@ static int lowpan_dev_debugfs_ctx_init(struct net_device *dev,
+       struct dentry *dentry, *root;
+       char buf[32];
+-      WARN_ON_ONCE(id > LOWPAN_IPHC_CTX_TABLE_SIZE);
++      if (WARN_ON_ONCE(id >= LOWPAN_IPHC_CTX_TABLE_SIZE))
++              return;
+       sprintf(buf, "%d", id);
+-- 
+2.30.2
+
diff --git a/queue-4.9/arm64-dts-exynos-correct-gic-cpu-interfaces-address-.patch b/queue-4.9/arm64-dts-exynos-correct-gic-cpu-interfaces-address-.patch
new file mode 100644 (file)
index 0000000..b4b39f6
--- /dev/null
@@ -0,0 +1,41 @@
+From 20689888cf4a153e57f0bc9b38e4e263f4920cc9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 5 Aug 2021 09:21:10 +0200
+Subject: arm64: dts: exynos: correct GIC CPU interfaces address range on
+ Exynos7
+
+From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+
+[ Upstream commit 01c72cad790cb6cd3ccbe4c1402b6cb6c6bbffd0 ]
+
+The GIC-400 CPU interfaces address range is defined as 0x2000-0x3FFF (by
+ARM).
+
+Reported-by: Sam Protsenko <semen.protsenko@linaro.org>
+Reported-by: Marc Zyngier <maz@kernel.org>
+Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
+Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
+Fixes: b9024cbc937d ("arm64: dts: Add initial device tree support for exynos7")
+Link: https://lore.kernel.org/r/20210805072110.4730-1-krzysztof.kozlowski@canonical.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/exynos/exynos7.dtsi | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi b/arch/arm64/boot/dts/exynos/exynos7.dtsi
+index 4c7c40ce5066..1fe4d1dd50ee 100644
+--- a/arch/arm64/boot/dts/exynos/exynos7.dtsi
++++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi
+@@ -94,7 +94,7 @@
+                       #address-cells = <0>;
+                       interrupt-controller;
+                       reg =   <0x11001000 0x1000>,
+-                              <0x11002000 0x1000>,
++                              <0x11002000 0x2000>,
+                               <0x11004000 0x2000>,
+                               <0x11006000 0x2000>;
+               };
+-- 
+2.30.2
+
diff --git a/queue-4.9/ath6kl-wmi-fix-an-error-code-in-ath6kl_wmi_sync_poin.patch b/queue-4.9/ath6kl-wmi-fix-an-error-code-in-ath6kl_wmi_sync_poin.patch
new file mode 100644 (file)
index 0000000..203df37
--- /dev/null
@@ -0,0 +1,42 @@
+From 7d452cd9a52b0df7b33c8321d8b1cfcb150fddc4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 13 Aug 2021 14:34:38 +0300
+Subject: ath6kl: wmi: fix an error code in ath6kl_wmi_sync_point()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit fd6729ec534cffbbeb3917761e6d1fe6a412d3fe ]
+
+This error path is unlikely because of it checked for NULL and
+returned -ENOMEM earlier in the function.  But it should return
+an error code here as well if we ever do hit it because of a
+race condition or something.
+
+Fixes: bdcd81707973 ("Add ath6kl cleaned up driver")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/20210813113438.GB30697@kili
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/ath/ath6kl/wmi.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
+index 73eab12cb3bd..9c2d26b12b69 100644
+--- a/drivers/net/wireless/ath/ath6kl/wmi.c
++++ b/drivers/net/wireless/ath/ath6kl/wmi.c
+@@ -2513,8 +2513,10 @@ static int ath6kl_wmi_sync_point(struct wmi *wmi, u8 if_idx)
+               goto free_data_skb;
+       for (index = 0; index < num_pri_streams; index++) {
+-              if (WARN_ON(!data_sync_bufs[index].skb))
++              if (WARN_ON(!data_sync_bufs[index].skb)) {
++                      ret = -ENOMEM;
+                       goto free_data_skb;
++              }
+               ep_id = ath6kl_ac2_endpoint_id(wmi->parent_dev,
+                                              data_sync_bufs[index].
+-- 
+2.30.2
+
diff --git a/queue-4.9/bcma-fix-memory-leak-for-internally-handled-cores.patch b/queue-4.9/bcma-fix-memory-leak-for-internally-handled-cores.patch
new file mode 100644 (file)
index 0000000..7cba7ef
--- /dev/null
@@ -0,0 +1,65 @@
+From 193cb215c21f2105629a86e36fb59f33b2edab18 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 27 Jul 2021 10:52:31 +0800
+Subject: bcma: Fix memory leak for internally-handled cores
+
+From: Zenghui Yu <yuzenghui@huawei.com>
+
+[ Upstream commit b63aed3ff195130fef12e0af590f4838cf0201d8 ]
+
+kmemleak reported that dev_name() of internally-handled cores were leaked
+on driver unbinding. Let's use device_initialize() to take refcounts for
+them and put_device() to properly free the related stuff.
+
+While looking at it, there's another potential issue for those which should
+be *registered* into driver core. If device_register() failed, we put
+device once and freed bcma_device structures. In bcma_unregister_cores(),
+they're treated as unregistered and we hit both UAF and double-free. That
+smells not good and has also been fixed now.
+
+Fixes: ab54bc8460b5 ("bcma: fill core details for every device")
+Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Link: https://lore.kernel.org/r/20210727025232.663-2-yuzenghui@huawei.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/bcma/main.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
+index 38688236b3cd..be551f01f7f0 100644
+--- a/drivers/bcma/main.c
++++ b/drivers/bcma/main.c
+@@ -239,6 +239,7 @@ EXPORT_SYMBOL(bcma_core_irq);
+ void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
+ {
++      device_initialize(&core->dev);
+       core->dev.release = bcma_release_core_dev;
+       core->dev.bus = &bcma_bus_type;
+       dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index);
+@@ -302,11 +303,10 @@ static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
+ {
+       int err;
+-      err = device_register(&core->dev);
++      err = device_add(&core->dev);
+       if (err) {
+               bcma_err(bus, "Could not register dev for core 0x%03X\n",
+                        core->id.id);
+-              put_device(&core->dev);
+               return;
+       }
+       core->dev_registered = true;
+@@ -397,7 +397,7 @@ void bcma_unregister_cores(struct bcma_bus *bus)
+       /* Now noone uses internally-handled cores, we can free them */
+       list_for_each_entry_safe(core, tmp, &bus->cores, list) {
+               list_del(&core->list);
+-              kfree(core);
++              put_device(&core->dev);
+       }
+ }
+-- 
+2.30.2
+
diff --git a/queue-4.9/bluetooth-add-timeout-sanity-check-to-hci_inquiry.patch b/queue-4.9/bluetooth-add-timeout-sanity-check-to-hci_inquiry.patch
new file mode 100644 (file)
index 0000000..5ec97c3
--- /dev/null
@@ -0,0 +1,46 @@
+From 00370e1d147eb1483615a231dd8ba1e902069b44 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 19 Aug 2021 18:15:21 +0300
+Subject: Bluetooth: add timeout sanity check to hci_inquiry
+
+From: Pavel Skripkin <paskripkin@gmail.com>
+
+[ Upstream commit f41a4b2b5eb7872109723dab8ae1603bdd9d9ec1 ]
+
+Syzbot hit "task hung" bug in hci_req_sync(). The problem was in
+unreasonable huge inquiry timeout passed from userspace.
+Fix it by adding sanity check for timeout value to hci_inquiry().
+
+Since hci_inquiry() is the only user of hci_req_sync() with user
+controlled timeout value, it makes sense to check timeout value in
+hci_inquiry() and don't touch hci_req_sync().
+
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Reported-and-tested-by: syzbot+be2baed593ea56c6a84c@syzkaller.appspotmail.com
+Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
+Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/bluetooth/hci_core.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
+index b4875e6339c6..b43f31203a43 100644
+--- a/net/bluetooth/hci_core.c
++++ b/net/bluetooth/hci_core.c
+@@ -1223,6 +1223,12 @@ int hci_inquiry(void __user *arg)
+               goto done;
+       }
++      /* Restrict maximum inquiry length to 60 seconds */
++      if (ir.length > 60) {
++              err = -EINVAL;
++              goto done;
++      }
++
+       hci_dev_lock(hdev);
+       if (inquiry_cache_age(hdev) > INQUIRY_CACHE_AGE_MAX ||
+           inquiry_cache_empty(hdev) || ir.flags & IREQ_CACHE_FLUSH) {
+-- 
+2.30.2
+
diff --git a/queue-4.9/bluetooth-fix-repeated-calls-to-sco_sock_kill.patch b/queue-4.9/bluetooth-fix-repeated-calls-to-sco_sock_kill.patch
new file mode 100644 (file)
index 0000000..2b7077e
--- /dev/null
@@ -0,0 +1,86 @@
+From 16162dfbd28b7ee11723c0878eb13be5bf72b857 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 10 Aug 2021 12:14:10 +0800
+Subject: Bluetooth: fix repeated calls to sco_sock_kill
+
+From: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
+
+[ Upstream commit e1dee2c1de2b4dd00eb44004a4bda6326ed07b59 ]
+
+In commit 4e1a720d0312 ("Bluetooth: avoid killing an already killed
+socket"), a check was added to sco_sock_kill to skip killing a socket
+if the SOCK_DEAD flag was set.
+
+This was done after a trace for a use-after-free bug showed that the
+same sock pointer was being killed twice.
+
+Unfortunately, this check prevents sco_sock_kill from running on any
+socket. sco_sock_kill kills a socket only if it's zapped and orphaned,
+however sock_orphan announces that the socket is dead before detaching
+it. i.e., orphaned sockets have the SOCK_DEAD flag set.
+
+To fix this, we remove the check for SOCK_DEAD, and avoid repeated
+calls to sco_sock_kill by removing incorrect calls in:
+
+1. sco_sock_timeout. The socket should not be killed on timeout as
+further processing is expected to be done. For example,
+sco_sock_connect sets the timer then waits for the socket to be
+connected or for an error to be returned.
+
+2. sco_conn_del. This function should clean up resources for the
+connection, but the socket itself should be cleaned up in
+sco_sock_release.
+
+3. sco_sock_close. Calls to sco_sock_close in sco_sock_cleanup_listen
+and sco_sock_release are followed by sco_sock_kill. Hence the
+duplicated call should be removed.
+
+Fixes: 4e1a720d0312 ("Bluetooth: avoid killing an already killed socket")
+Signed-off-by: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/bluetooth/sco.c | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
+index 3174eab6eafc..70eb28df20d3 100644
+--- a/net/bluetooth/sco.c
++++ b/net/bluetooth/sco.c
+@@ -83,7 +83,6 @@ static void sco_sock_timeout(unsigned long arg)
+       sk->sk_state_change(sk);
+       bh_unlock_sock(sk);
+-      sco_sock_kill(sk);
+       sock_put(sk);
+ }
+@@ -175,7 +174,6 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
+               sco_sock_clear_timer(sk);
+               sco_chan_del(sk, err);
+               bh_unlock_sock(sk);
+-              sco_sock_kill(sk);
+               sock_put(sk);
+       }
+@@ -392,8 +390,7 @@ static void sco_sock_cleanup_listen(struct sock *parent)
+  */
+ static void sco_sock_kill(struct sock *sk)
+ {
+-      if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket ||
+-          sock_flag(sk, SOCK_DEAD))
++      if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket)
+               return;
+       BT_DBG("sk %p state %d", sk, sk->sk_state);
+@@ -445,7 +442,6 @@ static void sco_sock_close(struct sock *sk)
+       lock_sock(sk);
+       __sco_sock_close(sk);
+       release_sock(sk);
+-      sco_sock_kill(sk);
+ }
+ static void sco_sock_init(struct sock *sk, struct sock *parent)
+-- 
+2.30.2
+
diff --git a/queue-4.9/bluetooth-increase-btnamsiz-to-21-chars-to-fix-poten.patch b/queue-4.9/bluetooth-increase-btnamsiz-to-21-chars-to-fix-poten.patch
new file mode 100644 (file)
index 0000000..bebaefa
--- /dev/null
@@ -0,0 +1,41 @@
+From 19c6238315f2a885a3a2ce5cd58514d647879f6f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 4 Aug 2021 16:09:51 +0100
+Subject: Bluetooth: increase BTNAMSIZ to 21 chars to fix potential buffer
+ overflow
+
+From: Colin Ian King <colin.king@canonical.com>
+
+[ Upstream commit 713baf3dae8f45dc8ada4ed2f5fdcbf94a5c274d ]
+
+An earlier commit replaced using batostr to using %pMR sprintf for the
+construction of session->name. Static analysis detected that this new
+method can use a total of 21 characters (including the trailing '\0')
+so we need to increase the BTNAMSIZ from 18 to 21 to fix potential
+buffer overflows.
+
+Addresses-Coverity: ("Out-of-bounds write")
+Fixes: fcb73338ed53 ("Bluetooth: Use %pMR in sprintf/seq_printf instead of batostr")
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/bluetooth/cmtp/cmtp.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/bluetooth/cmtp/cmtp.h b/net/bluetooth/cmtp/cmtp.h
+index c32638dddbf9..f6b9dc4e408f 100644
+--- a/net/bluetooth/cmtp/cmtp.h
++++ b/net/bluetooth/cmtp/cmtp.h
+@@ -26,7 +26,7 @@
+ #include <linux/types.h>
+ #include <net/bluetooth/bluetooth.h>
+-#define BTNAMSIZ 18
++#define BTNAMSIZ 21
+ /* CMTP ioctl defines */
+ #define CMTPCONNADD   _IOW('C', 200, int)
+-- 
+2.30.2
+
diff --git a/queue-4.9/bluetooth-move-shutdown-callback-before-flushing-tx-.patch b/queue-4.9/bluetooth-move-shutdown-callback-before-flushing-tx-.patch
new file mode 100644 (file)
index 0000000..ee49d87
--- /dev/null
@@ -0,0 +1,64 @@
+From 58a3697b2fa276bb818882b76345220b705fd858 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 10 Aug 2021 12:53:15 +0800
+Subject: Bluetooth: Move shutdown callback before flushing tx and rx queue
+
+From: Kai-Heng Feng <kai.heng.feng@canonical.com>
+
+[ Upstream commit 0ea53674d07fb6db2dd7a7ec2fdc85a12eb246c2 ]
+
+Commit 0ea9fd001a14 ("Bluetooth: Shutdown controller after workqueues
+are flushed or cancelled") introduced a regression that makes mtkbtsdio
+driver stops working:
+[   36.593956] Bluetooth: hci0: Firmware already downloaded
+[   46.814613] Bluetooth: hci0: Execution of wmt command timed out
+[   46.814619] Bluetooth: hci0: Failed to send wmt func ctrl (-110)
+
+The shutdown callback depends on the result of hdev->rx_work, so we
+should call it before flushing rx_work:
+-> btmtksdio_shutdown()
+ -> mtk_hci_wmt_sync()
+  -> __hci_cmd_send()
+   -> wait for BTMTKSDIO_TX_WAIT_VND_EVT gets cleared
+
+-> btmtksdio_recv_event()
+ -> hci_recv_frame()
+  -> queue_work(hdev->workqueue, &hdev->rx_work)
+   -> clears BTMTKSDIO_TX_WAIT_VND_EVT
+
+So move the shutdown callback before flushing TX/RX queue to resolve the
+issue.
+
+Reported-and-tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
+Tested-by: Hsin-Yi Wang <hsinyi@chromium.org>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Fixes: 0ea9fd001a14 ("Bluetooth: Shutdown controller after workqueues are flushed or cancelled")
+Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
+Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/bluetooth/hci_core.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
+index 8517da7f282e..b4875e6339c6 100644
+--- a/net/bluetooth/hci_core.c
++++ b/net/bluetooth/hci_core.c
+@@ -1546,6 +1546,14 @@ int hci_dev_do_close(struct hci_dev *hdev)
+       hci_request_cancel_all(hdev);
+       hci_req_sync_lock(hdev);
++      if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) &&
++          !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) &&
++          test_bit(HCI_UP, &hdev->flags)) {
++              /* Execute vendor specific shutdown routine */
++              if (hdev->shutdown)
++                      hdev->shutdown(hdev);
++      }
++
+       if (!test_and_clear_bit(HCI_UP, &hdev->flags)) {
+               cancel_delayed_work_sync(&hdev->cmd_timer);
+               hci_req_sync_unlock(hdev);
+-- 
+2.30.2
+
diff --git a/queue-4.9/bluetooth-sco-prevent-information-leak-in-sco_conn_d.patch b/queue-4.9/bluetooth-sco-prevent-information-leak-in-sco_conn_d.patch
new file mode 100644 (file)
index 0000000..9f412ce
--- /dev/null
@@ -0,0 +1,45 @@
+From 45d6477a9a98327f09a13327b6bc85565377dc1a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 25 Jun 2021 18:00:09 +0300
+Subject: Bluetooth: sco: prevent information leak in sco_conn_defer_accept()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit 59da0b38bc2ea570ede23a3332ecb3e7574ce6b2 ]
+
+Smatch complains that some of these struct members are not initialized
+leading to a stack information disclosure:
+
+    net/bluetooth/sco.c:778 sco_conn_defer_accept() warn:
+    check that 'cp.retrans_effort' doesn't leak information
+
+This seems like a valid warning.  I've added a default case to fix
+this issue.
+
+Fixes: 2f69a82acf6f ("Bluetooth: Use voice setting in deferred SCO connection request")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/bluetooth/sco.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
+index 95fd7a837dc5..3174eab6eafc 100644
+--- a/net/bluetooth/sco.c
++++ b/net/bluetooth/sco.c
+@@ -763,6 +763,11 @@ static void sco_conn_defer_accept(struct hci_conn *conn, u16 setting)
+                       cp.max_latency = cpu_to_le16(0xffff);
+                       cp.retrans_effort = 0xff;
+                       break;
++              default:
++                      /* use CVSD settings as fallback */
++                      cp.max_latency = cpu_to_le16(0xffff);
++                      cp.retrans_effort = 0xff;
++                      break;
+               }
+               hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ,
+-- 
+2.30.2
+
diff --git a/queue-4.9/certs-trigger-creation-of-rsa-module-signing-key-if-.patch b/queue-4.9/certs-trigger-creation-of-rsa-module-signing-key-if-.patch
new file mode 100644 (file)
index 0000000..d7f606d
--- /dev/null
@@ -0,0 +1,56 @@
+From bab24c6158a546396e328f56669025790dcc938f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 29 Jun 2021 17:34:20 -0400
+Subject: certs: Trigger creation of RSA module signing key if it's not an RSA
+ key
+
+From: Stefan Berger <stefanb@linux.ibm.com>
+
+[ Upstream commit ea35e0d5df6c92fa2e124bb1b91d09b2240715ba ]
+
+Address a kbuild issue where a developer created an ECDSA key for signing
+kernel modules and then builds an older version of the kernel, when bi-
+secting the kernel for example, that does not support ECDSA keys.
+
+If openssl is installed, trigger the creation of an RSA module signing
+key if it is not an RSA key.
+
+Fixes: cfc411e7fff3 ("Move certificate handling to its own directory")
+Cc: David Howells <dhowells@redhat.com>
+Cc: David Woodhouse <dwmw2@infradead.org>
+Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
+Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
+Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
+Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ certs/Makefile | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/certs/Makefile b/certs/Makefile
+index 2773c4afa24c..4417cc5cf5e8 100644
+--- a/certs/Makefile
++++ b/certs/Makefile
+@@ -39,11 +39,19 @@ endif
+ redirect_openssl      = 2>&1
+ quiet_redirect_openssl        = 2>&1
+ silent_redirect_openssl = 2>/dev/null
++openssl_available       = $(shell openssl help 2>/dev/null && echo yes)
+ # We do it this way rather than having a boolean option for enabling an
+ # external private key, because 'make randconfig' might enable such a
+ # boolean option and we unfortunately can't make it depend on !RANDCONFIG.
+ ifeq ($(CONFIG_MODULE_SIG_KEY),"certs/signing_key.pem")
++
++ifeq ($(openssl_available),yes)
++X509TEXT=$(shell openssl x509 -in "certs/signing_key.pem" -text 2>/dev/null)
++
++$(if $(findstring rsaEncryption,$(X509TEXT)),,$(shell rm -f "certs/signing_key.pem"))
++endif
++
+ $(obj)/signing_key.pem: $(obj)/x509.genkey
+       @$(kecho) "###"
+       @$(kecho) "### Now generating an X.509 key pair to be used for signing modules."
+-- 
+2.30.2
+
diff --git a/queue-4.9/cifs-fix-a-potencially-linear-read-overflow.patch b/queue-4.9/cifs-fix-a-potencially-linear-read-overflow.patch
new file mode 100644 (file)
index 0000000..95cb182
--- /dev/null
@@ -0,0 +1,53 @@
+From c14f8ac9ead58443594a88e7184ea396f9aed3fa Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 17 Aug 2021 12:27:09 +0200
+Subject: CIFS: Fix a potencially linear read overflow
+
+From: Len Baker <len.baker@gmx.com>
+
+[ Upstream commit f980d055a0f858d73d9467bb0b570721bbfcdfb8 ]
+
+strlcpy() reads the entire source buffer first. This read may exceed the
+destination size limit. This is both inefficient and can lead to linear
+read overflows if a source string is not NUL-terminated.
+
+Also, the strnlen() call does not avoid the read overflow in the strlcpy
+function when a not NUL-terminated string is passed.
+
+So, replace this block by a call to kstrndup() that avoids this type of
+overflow and does the same.
+
+Fixes: 066ce6899484d ("cifs: rename cifs_strlcpy_to_host and make it use new functions")
+Signed-off-by: Len Baker <len.baker@gmx.com>
+Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
+Reviewed-by: Jeff Layton <jlayton@kernel.org>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/cifs/cifs_unicode.c | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c
+index 942874257a09..e5e780145728 100644
+--- a/fs/cifs/cifs_unicode.c
++++ b/fs/cifs/cifs_unicode.c
+@@ -367,14 +367,9 @@ cifs_strndup_from_utf16(const char *src, const int maxlen,
+               if (!dst)
+                       return NULL;
+               cifs_from_utf16(dst, (__le16 *) src, len, maxlen, codepage,
+-                             NO_MAP_UNI_RSVD);
++                              NO_MAP_UNI_RSVD);
+       } else {
+-              len = strnlen(src, maxlen);
+-              len++;
+-              dst = kmalloc(len, GFP_KERNEL);
+-              if (!dst)
+-                      return NULL;
+-              strlcpy(dst, src, len);
++              dst = kstrndup(src, maxlen, GFP_KERNEL);
+       }
+       return dst;
+-- 
+2.30.2
+
diff --git a/queue-4.9/crypto-mxs-dcp-check-for-dma-mapping-errors.patch b/queue-4.9/crypto-mxs-dcp-check-for-dma-mapping-errors.patch
new file mode 100644 (file)
index 0000000..5cffb32
--- /dev/null
@@ -0,0 +1,125 @@
+From c3eabf9786ddd0fccde3b46eec6dde34597b8e59 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 1 Jul 2021 14:56:37 -0400
+Subject: crypto: mxs-dcp - Check for DMA mapping errors
+
+From: Sean Anderson <sean.anderson@seco.com>
+
+[ Upstream commit df6313d707e575a679ada3313358289af24454c0 ]
+
+After calling dma_map_single(), we must also call dma_mapping_error().
+This fixes the following warning when compiling with CONFIG_DMA_API_DEBUG:
+
+[  311.241478] WARNING: CPU: 0 PID: 428 at kernel/dma/debug.c:1027 check_unmap+0x79c/0x96c
+[  311.249547] DMA-API: mxs-dcp 2280000.crypto: device driver failed to check map error[device address=0x00000000860cb080] [size=32 bytes] [mapped as single]
+
+Signed-off-by: Sean Anderson <sean.anderson@seco.com>
+Reviewed-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/crypto/mxs-dcp.c | 45 +++++++++++++++++++++++++++++++---------
+ 1 file changed, 35 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
+index 34839b539207..1bab5b99ebbd 100644
+--- a/drivers/crypto/mxs-dcp.c
++++ b/drivers/crypto/mxs-dcp.c
+@@ -167,15 +167,19 @@ static struct dcp *global_sdcp;
+ static int mxs_dcp_start_dma(struct dcp_async_ctx *actx)
+ {
++      int dma_err;
+       struct dcp *sdcp = global_sdcp;
+       const int chan = actx->chan;
+       uint32_t stat;
+       unsigned long ret;
+       struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan];
+-
+       dma_addr_t desc_phys = dma_map_single(sdcp->dev, desc, sizeof(*desc),
+                                             DMA_TO_DEVICE);
++      dma_err = dma_mapping_error(sdcp->dev, desc_phys);
++      if (dma_err)
++              return dma_err;
++
+       reinit_completion(&sdcp->completion[chan]);
+       /* Clear status register. */
+@@ -213,18 +217,29 @@ static int mxs_dcp_start_dma(struct dcp_async_ctx *actx)
+ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx,
+                          struct ablkcipher_request *req, int init)
+ {
++      dma_addr_t key_phys, src_phys, dst_phys;
+       struct dcp *sdcp = global_sdcp;
+       struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan];
+       struct dcp_aes_req_ctx *rctx = ablkcipher_request_ctx(req);
+       int ret;
+-      dma_addr_t key_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_key,
+-                                           2 * AES_KEYSIZE_128,
+-                                           DMA_TO_DEVICE);
+-      dma_addr_t src_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_in_buf,
+-                                           DCP_BUF_SZ, DMA_TO_DEVICE);
+-      dma_addr_t dst_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_out_buf,
+-                                           DCP_BUF_SZ, DMA_FROM_DEVICE);
++      key_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_key,
++                                2 * AES_KEYSIZE_128, DMA_TO_DEVICE);
++      ret = dma_mapping_error(sdcp->dev, key_phys);
++      if (ret)
++              return ret;
++
++      src_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_in_buf,
++                                DCP_BUF_SZ, DMA_TO_DEVICE);
++      ret = dma_mapping_error(sdcp->dev, src_phys);
++      if (ret)
++              goto err_src;
++
++      dst_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_out_buf,
++                                DCP_BUF_SZ, DMA_FROM_DEVICE);
++      ret = dma_mapping_error(sdcp->dev, dst_phys);
++      if (ret)
++              goto err_dst;
+       if (actx->fill % AES_BLOCK_SIZE) {
+               dev_err(sdcp->dev, "Invalid block size!\n");
+@@ -262,10 +277,12 @@ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx,
+       ret = mxs_dcp_start_dma(actx);
+ aes_done_run:
++      dma_unmap_single(sdcp->dev, dst_phys, DCP_BUF_SZ, DMA_FROM_DEVICE);
++err_dst:
++      dma_unmap_single(sdcp->dev, src_phys, DCP_BUF_SZ, DMA_TO_DEVICE);
++err_src:
+       dma_unmap_single(sdcp->dev, key_phys, 2 * AES_KEYSIZE_128,
+                        DMA_TO_DEVICE);
+-      dma_unmap_single(sdcp->dev, src_phys, DCP_BUF_SZ, DMA_TO_DEVICE);
+-      dma_unmap_single(sdcp->dev, dst_phys, DCP_BUF_SZ, DMA_FROM_DEVICE);
+       return ret;
+ }
+@@ -565,6 +582,10 @@ static int mxs_dcp_run_sha(struct ahash_request *req)
+       dma_addr_t buf_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_in_buf,
+                                            DCP_BUF_SZ, DMA_TO_DEVICE);
++      ret = dma_mapping_error(sdcp->dev, buf_phys);
++      if (ret)
++              return ret;
++
+       /* Fill in the DMA descriptor. */
+       desc->control0 = MXS_DCP_CONTROL0_DECR_SEMAPHORE |
+                   MXS_DCP_CONTROL0_INTERRUPT |
+@@ -597,6 +618,10 @@ static int mxs_dcp_run_sha(struct ahash_request *req)
+       if (rctx->fini) {
+               digest_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_out_buf,
+                                            DCP_SHA_PAY_SZ, DMA_FROM_DEVICE);
++              ret = dma_mapping_error(sdcp->dev, digest_phys);
++              if (ret)
++                      goto done_run;
++
+               desc->control0 |= MXS_DCP_CONTROL0_HASH_TERM;
+               desc->payload = digest_phys;
+       }
+-- 
+2.30.2
+
diff --git a/queue-4.9/crypto-omap-sham-clear-dma-flags-only-after-omap_sha.patch b/queue-4.9/crypto-omap-sham-clear-dma-flags-only-after-omap_sha.patch
new file mode 100644 (file)
index 0000000..0a3d325
--- /dev/null
@@ -0,0 +1,43 @@
+From eeedac7a333f9d3f08c100928e4b9157746165ec Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 27 Jul 2021 13:23:34 +0300
+Subject: crypto: omap-sham - clear dma flags only after
+ omap_sham_update_dma_stop()
+
+From: Tony Lindgren <tony@atomide.com>
+
+[ Upstream commit fe28140b3393b0ba1eb95cc109f974a7e58b26fd ]
+
+We should not clear FLAGS_DMA_ACTIVE before omap_sham_update_dma_stop() is
+done calling dma_unmap_sg(). We already clear FLAGS_DMA_ACTIVE at the
+end of omap_sham_update_dma_stop().
+
+The early clearing of FLAGS_DMA_ACTIVE is not causing issues as we do not
+need to defer anything based on FLAGS_DMA_ACTIVE currently. So this can be
+applied as clean-up.
+
+Cc: Lokesh Vutla <lokeshvutla@ti.com>
+Cc: Tero Kristo <kristo@kernel.org>
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/crypto/omap-sham.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
+index 4adcf89add25..801ae958b0ad 100644
+--- a/drivers/crypto/omap-sham.c
++++ b/drivers/crypto/omap-sham.c
+@@ -1745,7 +1745,7 @@ static void omap_sham_done_task(unsigned long data)
+               if (test_and_clear_bit(FLAGS_OUTPUT_READY, &dd->flags))
+                       goto finish;
+       } else if (test_bit(FLAGS_DMA_READY, &dd->flags)) {
+-              if (test_and_clear_bit(FLAGS_DMA_ACTIVE, &dd->flags)) {
++              if (test_bit(FLAGS_DMA_ACTIVE, &dd->flags)) {
+                       omap_sham_update_dma_stop(dd);
+                       if (dd->err) {
+                               err = dd->err;
+-- 
+2.30.2
+
diff --git a/queue-4.9/crypto-qat-do-not-export-adf_iov_putmsg.patch b/queue-4.9/crypto-qat-do-not-export-adf_iov_putmsg.patch
new file mode 100644 (file)
index 0000000..60ddd79
--- /dev/null
@@ -0,0 +1,36 @@
+From 47678a446b809ddaeaab8e67483781fd3ba571eb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 12 Aug 2021 21:21:28 +0100
+Subject: crypto: qat - do not export adf_iov_putmsg()
+
+From: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
+
+[ Upstream commit 645ae0af1840199086c33e4f841892ebee73f615 ]
+
+The function adf_iov_putmsg() is only used inside the intel_qat module
+therefore should not be exported.
+Remove EXPORT_SYMBOL for the function adf_iov_putmsg().
+
+Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
+Reviewed-by: Fiona Trahe <fiona.trahe@intel.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
+index 9dab2cc11fdf..c64481160b71 100644
+--- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
++++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
+@@ -231,7 +231,6 @@ int adf_iov_putmsg(struct adf_accel_dev *accel_dev, u32 msg, u8 vf_nr)
+       return ret;
+ }
+-EXPORT_SYMBOL_GPL(adf_iov_putmsg);
+ void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info)
+ {
+-- 
+2.30.2
+
diff --git a/queue-4.9/crypto-qat-do-not-ignore-errors-from-enable_vf2pf_co.patch b/queue-4.9/crypto-qat-do-not-ignore-errors-from-enable_vf2pf_co.patch
new file mode 100644 (file)
index 0000000..4fc5add
--- /dev/null
@@ -0,0 +1,51 @@
+From aad10e88e6379fe6fb249b2f2b96605556b2a848 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 12 Aug 2021 21:21:13 +0100
+Subject: crypto: qat - do not ignore errors from enable_vf2pf_comms()
+
+From: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
+
+[ Upstream commit 5147f0906d50a9d26f2b8698cd06b5680e9867ff ]
+
+The function adf_dev_init() ignores the error code reported by
+enable_vf2pf_comms(). If the latter fails, e.g. the VF is not compatible
+with the pf, then the load of the VF driver progresses.
+This patch changes adf_dev_init() so that the error code from
+enable_vf2pf_comms() is returned to the caller.
+
+Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
+Reviewed-by: Marco Chiappero <marco.chiappero@intel.com>
+Reviewed-by: Fiona Trahe <fiona.trahe@intel.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/crypto/qat/qat_common/adf_init.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/crypto/qat/qat_common/adf_init.c b/drivers/crypto/qat/qat_common/adf_init.c
+index 888c6675e7e5..03856cc604b6 100644
+--- a/drivers/crypto/qat/qat_common/adf_init.c
++++ b/drivers/crypto/qat/qat_common/adf_init.c
+@@ -101,6 +101,7 @@ int adf_dev_init(struct adf_accel_dev *accel_dev)
+       struct service_hndl *service;
+       struct list_head *list_itr;
+       struct adf_hw_device_data *hw_data = accel_dev->hw_device;
++      int ret;
+       if (!hw_data) {
+               dev_err(&GET_DEV(accel_dev),
+@@ -167,9 +168,9 @@ int adf_dev_init(struct adf_accel_dev *accel_dev)
+       }
+       hw_data->enable_error_correction(accel_dev);
+-      hw_data->enable_vf2pf_comms(accel_dev);
++      ret = hw_data->enable_vf2pf_comms(accel_dev);
+-      return 0;
++      return ret;
+ }
+ EXPORT_SYMBOL_GPL(adf_dev_init);
+-- 
+2.30.2
+
diff --git a/queue-4.9/crypto-qat-fix-naming-for-init-shutdown-vf-to-pf-not.patch b/queue-4.9/crypto-qat-fix-naming-for-init-shutdown-vf-to-pf-not.patch
new file mode 100644 (file)
index 0000000..661d650
--- /dev/null
@@ -0,0 +1,162 @@
+From 42c1c7898b9d918f86dae442d815b102f5952a19 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 12 Aug 2021 21:21:22 +0100
+Subject: crypto: qat - fix naming for init/shutdown VF to PF notifications
+
+From: Marco Chiappero <marco.chiappero@intel.com>
+
+[ Upstream commit b90c1c4d3fa8cd90f4e8245b13564380fd0bfad1 ]
+
+At start and shutdown, VFs notify the PF about their state. These
+notifications are carried out through a message exchange using the PFVF
+protocol.
+
+Function names lead to believe they do perform init or shutdown logic.
+This is to fix the naming to better reflect their purpose.
+
+Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
+Co-developed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
+Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
+Reviewed-by: Fiona Trahe <fiona.trahe@intel.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c |  4 ++--
+ drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c   |  4 ++--
+ drivers/crypto/qat/qat_common/adf_common_drv.h       |  8 ++++----
+ drivers/crypto/qat/qat_common/adf_vf2pf_msg.c        | 12 ++++++------
+ .../qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c      |  4 ++--
+ 5 files changed, 16 insertions(+), 16 deletions(-)
+
+diff --git a/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c b/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c
+index d2d0ae445fd8..7c7d49a8a403 100644
+--- a/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c
++++ b/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c
+@@ -123,10 +123,10 @@ void adf_init_hw_data_c3xxxiov(struct adf_hw_device_data *hw_data)
+       hw_data->enable_error_correction = adf_vf_void_noop;
+       hw_data->init_admin_comms = adf_vf_int_noop;
+       hw_data->exit_admin_comms = adf_vf_void_noop;
+-      hw_data->send_admin_init = adf_vf2pf_init;
++      hw_data->send_admin_init = adf_vf2pf_notify_init;
+       hw_data->init_arb = adf_vf_int_noop;
+       hw_data->exit_arb = adf_vf_void_noop;
+-      hw_data->disable_iov = adf_vf2pf_shutdown;
++      hw_data->disable_iov = adf_vf2pf_notify_shutdown;
+       hw_data->get_accel_mask = get_accel_mask;
+       hw_data->get_ae_mask = get_ae_mask;
+       hw_data->get_num_accels = get_num_accels;
+diff --git a/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c b/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c
+index 38e4bc04f407..90e8a7564756 100644
+--- a/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c
++++ b/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c
+@@ -123,10 +123,10 @@ void adf_init_hw_data_c62xiov(struct adf_hw_device_data *hw_data)
+       hw_data->enable_error_correction = adf_vf_void_noop;
+       hw_data->init_admin_comms = adf_vf_int_noop;
+       hw_data->exit_admin_comms = adf_vf_void_noop;
+-      hw_data->send_admin_init = adf_vf2pf_init;
++      hw_data->send_admin_init = adf_vf2pf_notify_init;
+       hw_data->init_arb = adf_vf_int_noop;
+       hw_data->exit_arb = adf_vf_void_noop;
+-      hw_data->disable_iov = adf_vf2pf_shutdown;
++      hw_data->disable_iov = adf_vf2pf_notify_shutdown;
+       hw_data->get_accel_mask = get_accel_mask;
+       hw_data->get_ae_mask = get_ae_mask;
+       hw_data->get_num_accels = get_num_accels;
+diff --git a/drivers/crypto/qat/qat_common/adf_common_drv.h b/drivers/crypto/qat/qat_common/adf_common_drv.h
+index 0d596a99f564..88c8831503e4 100644
+--- a/drivers/crypto/qat/qat_common/adf_common_drv.h
++++ b/drivers/crypto/qat/qat_common/adf_common_drv.h
+@@ -239,8 +239,8 @@ void adf_enable_vf2pf_interrupts(struct adf_accel_dev *accel_dev,
+ void adf_enable_pf2vf_interrupts(struct adf_accel_dev *accel_dev);
+ void adf_disable_pf2vf_interrupts(struct adf_accel_dev *accel_dev);
+-int adf_vf2pf_init(struct adf_accel_dev *accel_dev);
+-void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev);
++int adf_vf2pf_notify_init(struct adf_accel_dev *accel_dev);
++void adf_vf2pf_notify_shutdown(struct adf_accel_dev *accel_dev);
+ int adf_init_pf_wq(void);
+ void adf_exit_pf_wq(void);
+ int adf_init_vf_wq(void);
+@@ -263,12 +263,12 @@ static inline void adf_disable_pf2vf_interrupts(struct adf_accel_dev *accel_dev)
+ {
+ }
+-static inline int adf_vf2pf_init(struct adf_accel_dev *accel_dev)
++static inline int adf_vf2pf_notify_init(struct adf_accel_dev *accel_dev)
+ {
+       return 0;
+ }
+-static inline void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev)
++static inline void adf_vf2pf_notify_shutdown(struct adf_accel_dev *accel_dev)
+ {
+ }
+diff --git a/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c b/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c
+index cd5f37dffe8a..1830194567e8 100644
+--- a/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c
++++ b/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c
+@@ -49,14 +49,14 @@
+ #include "adf_pf2vf_msg.h"
+ /**
+- * adf_vf2pf_init() - send init msg to PF
++ * adf_vf2pf_notify_init() - send init msg to PF
+  * @accel_dev:  Pointer to acceleration VF device.
+  *
+  * Function sends an init messge from the VF to a PF
+  *
+  * Return: 0 on success, error code otherwise.
+  */
+-int adf_vf2pf_init(struct adf_accel_dev *accel_dev)
++int adf_vf2pf_notify_init(struct adf_accel_dev *accel_dev)
+ {
+       u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM |
+               (ADF_VF2PF_MSGTYPE_INIT << ADF_VF2PF_MSGTYPE_SHIFT));
+@@ -69,17 +69,17 @@ int adf_vf2pf_init(struct adf_accel_dev *accel_dev)
+       set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status);
+       return 0;
+ }
+-EXPORT_SYMBOL_GPL(adf_vf2pf_init);
++EXPORT_SYMBOL_GPL(adf_vf2pf_notify_init);
+ /**
+- * adf_vf2pf_shutdown() - send shutdown msg to PF
++ * adf_vf2pf_notify_shutdown() - send shutdown msg to PF
+  * @accel_dev:  Pointer to acceleration VF device.
+  *
+  * Function sends a shutdown messge from the VF to a PF
+  *
+  * Return: void
+  */
+-void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev)
++void adf_vf2pf_notify_shutdown(struct adf_accel_dev *accel_dev)
+ {
+       u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM |
+           (ADF_VF2PF_MSGTYPE_SHUTDOWN << ADF_VF2PF_MSGTYPE_SHIFT));
+@@ -89,4 +89,4 @@ void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev)
+                       dev_err(&GET_DEV(accel_dev),
+                               "Failed to send Shutdown event to PF\n");
+ }
+-EXPORT_SYMBOL_GPL(adf_vf2pf_shutdown);
++EXPORT_SYMBOL_GPL(adf_vf2pf_notify_shutdown);
+diff --git a/drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c b/drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c
+index a3b4dd8099a7..3a8361c83f0b 100644
+--- a/drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c
++++ b/drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c
+@@ -123,10 +123,10 @@ void adf_init_hw_data_dh895xcciov(struct adf_hw_device_data *hw_data)
+       hw_data->enable_error_correction = adf_vf_void_noop;
+       hw_data->init_admin_comms = adf_vf_int_noop;
+       hw_data->exit_admin_comms = adf_vf_void_noop;
+-      hw_data->send_admin_init = adf_vf2pf_init;
++      hw_data->send_admin_init = adf_vf2pf_notify_init;
+       hw_data->init_arb = adf_vf_int_noop;
+       hw_data->exit_arb = adf_vf_void_noop;
+-      hw_data->disable_iov = adf_vf2pf_shutdown;
++      hw_data->disable_iov = adf_vf2pf_notify_shutdown;
+       hw_data->get_accel_mask = get_accel_mask;
+       hw_data->get_ae_mask = get_ae_mask;
+       hw_data->get_num_accels = get_num_accels;
+-- 
+2.30.2
+
diff --git a/queue-4.9/crypto-qat-fix-reuse-of-completion-variable.patch b/queue-4.9/crypto-qat-fix-reuse-of-completion-variable.patch
new file mode 100644 (file)
index 0000000..cd250d5
--- /dev/null
@@ -0,0 +1,39 @@
+From acaba1e966153759b4df297a5d397fb6c325cf3d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 12 Aug 2021 21:21:19 +0100
+Subject: crypto: qat - fix reuse of completion variable
+
+From: Marco Chiappero <marco.chiappero@intel.com>
+
+[ Upstream commit 3d655732b0199562267a05c7ff69ecdd11632939 ]
+
+Use reinit_completion() to set to a clean state a completion variable,
+used to coordinate the VF to PF request-response flow, before every
+new VF request.
+
+Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
+Co-developed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
+Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
+Reviewed-by: Fiona Trahe <fiona.trahe@intel.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
+index b3875fdf6cd7..9dab2cc11fdf 100644
+--- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
++++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
+@@ -361,6 +361,8 @@ static int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev)
+       msg |= ADF_PFVF_COMPATIBILITY_VERSION << ADF_VF2PF_COMPAT_VER_REQ_SHIFT;
+       BUILD_BUG_ON(ADF_PFVF_COMPATIBILITY_VERSION > 255);
++      reinit_completion(&accel_dev->vf.iov_msg_completion);
++
+       /* Send request from VF to PF */
+       ret = adf_iov_putmsg(accel_dev, msg, 0);
+       if (ret) {
+-- 
+2.30.2
+
diff --git a/queue-4.9/crypto-qat-handle-both-source-of-interrupt-in-vf-isr.patch b/queue-4.9/crypto-qat-handle-both-source-of-interrupt-in-vf-isr.patch
new file mode 100644 (file)
index 0000000..7e7d13a
--- /dev/null
@@ -0,0 +1,63 @@
+From e96613998cfbd28d8de00f7f125e336bd49fc7f5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 12 Aug 2021 21:21:14 +0100
+Subject: crypto: qat - handle both source of interrupt in VF ISR
+
+From: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
+
+[ Upstream commit 0a73c762e1eee33a5e5dc0e3488f1b7cd17249b3 ]
+
+The top half of the VF drivers handled only a source at the time.
+If an interrupt for PF2VF and bundle occurred at the same time, the ISR
+scheduled only the bottom half for PF2VF.
+This patch fixes the VF top half so that if both sources of interrupt
+trigger at the same time, both bottom halves are scheduled.
+
+This patch is based on earlier work done by Conor McLoughlin.
+
+Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
+Reviewed-by: Marco Chiappero <marco.chiappero@intel.com>
+Reviewed-by: Fiona Trahe <fiona.trahe@intel.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/crypto/qat/qat_common/adf_vf_isr.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/crypto/qat/qat_common/adf_vf_isr.c b/drivers/crypto/qat/qat_common/adf_vf_isr.c
+index 4c1217ba83ae..36db3c443e7e 100644
+--- a/drivers/crypto/qat/qat_common/adf_vf_isr.c
++++ b/drivers/crypto/qat/qat_common/adf_vf_isr.c
+@@ -203,6 +203,7 @@ static irqreturn_t adf_isr(int irq, void *privdata)
+       struct adf_bar *pmisc =
+                       &GET_BARS(accel_dev)[hw_data->get_misc_bar_id(hw_data)];
+       void __iomem *pmisc_bar_addr = pmisc->virt_addr;
++      bool handled = false;
+       u32 v_int;
+       /* Read VF INT source CSR to determine the source of VF interrupt */
+@@ -215,7 +216,7 @@ static irqreturn_t adf_isr(int irq, void *privdata)
+               /* Schedule tasklet to handle interrupt BH */
+               tasklet_hi_schedule(&accel_dev->vf.pf2vf_bh_tasklet);
+-              return IRQ_HANDLED;
++              handled = true;
+       }
+       /* Check bundle interrupt */
+@@ -227,10 +228,10 @@ static irqreturn_t adf_isr(int irq, void *privdata)
+               WRITE_CSR_INT_FLAG_AND_COL(bank->csr_addr, bank->bank_number,
+                                          0);
+               tasklet_hi_schedule(&bank->resp_handler);
+-              return IRQ_HANDLED;
++              handled = true;
+       }
+-      return IRQ_NONE;
++      return handled ? IRQ_HANDLED : IRQ_NONE;
+ }
+ static int adf_request_msi_irq(struct adf_accel_dev *accel_dev)
+-- 
+2.30.2
+
diff --git a/queue-4.9/crypto-qat-use-proper-type-for-vf_mask.patch b/queue-4.9/crypto-qat-use-proper-type-for-vf_mask.patch
new file mode 100644 (file)
index 0000000..669ae1c
--- /dev/null
@@ -0,0 +1,72 @@
+From dbb5803b1aba13e2d8d37bed74c6b43a323ab256 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 12 Aug 2021 21:21:10 +0100
+Subject: crypto: qat - use proper type for vf_mask
+
+From: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
+
+[ Upstream commit 462354d986b6a89c6449b85f17aaacf44e455216 ]
+
+Replace vf_mask type with unsigned long to avoid a stack-out-of-bound.
+
+This is to fix the following warning reported by KASAN the first time
+adf_msix_isr_ae() gets called.
+
+    [  692.091987] BUG: KASAN: stack-out-of-bounds in find_first_bit+0x28/0x50
+    [  692.092017] Read of size 8 at addr ffff88afdf789e60 by task swapper/32/0
+    [  692.092076] Call Trace:
+    [  692.092089]  <IRQ>
+    [  692.092101]  dump_stack+0x9c/0xcf
+    [  692.092132]  print_address_description.constprop.0+0x18/0x130
+    [  692.092164]  ? find_first_bit+0x28/0x50
+    [  692.092185]  kasan_report.cold+0x7f/0x111
+    [  692.092213]  ? static_obj+0x10/0x80
+    [  692.092234]  ? find_first_bit+0x28/0x50
+    [  692.092262]  find_first_bit+0x28/0x50
+    [  692.092288]  adf_msix_isr_ae+0x16e/0x230 [intel_qat]
+
+Fixes: ed8ccaef52fa ("crypto: qat - Add support for SRIOV")
+Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
+Reviewed-by: Marco Chiappero <marco.chiappero@intel.com>
+Reviewed-by: Fiona Trahe <fiona.trahe@intel.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/crypto/qat/qat_common/adf_isr.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/crypto/qat/qat_common/adf_isr.c b/drivers/crypto/qat/qat_common/adf_isr.c
+index 2c0be14309cf..7877ba677220 100644
+--- a/drivers/crypto/qat/qat_common/adf_isr.c
++++ b/drivers/crypto/qat/qat_common/adf_isr.c
+@@ -59,6 +59,8 @@
+ #include "adf_transport_access_macros.h"
+ #include "adf_transport_internal.h"
++#define ADF_MAX_NUM_VFS       32
++
+ static int adf_enable_msix(struct adf_accel_dev *accel_dev)
+ {
+       struct adf_accel_pci *pci_dev_info = &accel_dev->accel_pci_dev;
+@@ -111,7 +113,7 @@ static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr)
+               struct adf_bar *pmisc =
+                       &GET_BARS(accel_dev)[hw_data->get_misc_bar_id(hw_data)];
+               void __iomem *pmisc_bar_addr = pmisc->virt_addr;
+-              u32 vf_mask;
++              unsigned long vf_mask;
+               /* Get the interrupt sources triggered by VFs */
+               vf_mask = ((ADF_CSR_RD(pmisc_bar_addr, ADF_ERRSOU5) &
+@@ -132,8 +134,7 @@ static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr)
+                        * unless the VF is malicious and is attempting to
+                        * flood the host OS with VF2PF interrupts.
+                        */
+-                      for_each_set_bit(i, (const unsigned long *)&vf_mask,
+-                                       (sizeof(vf_mask) * BITS_PER_BYTE)) {
++                      for_each_set_bit(i, &vf_mask, ADF_MAX_NUM_VFS) {
+                               vf_info = accel_dev->pf.vf_info + i;
+                               if (!__ratelimit(&vf_info->vf2pf_ratelimit)) {
+-- 
+2.30.2
+
diff --git a/queue-4.9/drm-msm-dsi-fix-some-reference-counted-resource-leak.patch b/queue-4.9/drm-msm-dsi-fix-some-reference-counted-resource-leak.patch
new file mode 100644 (file)
index 0000000..5f37420
--- /dev/null
@@ -0,0 +1,62 @@
+From c0dbdaebd7b4a240a2c69b7ee69b71a403622de7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 6 Aug 2021 11:15:13 +0200
+Subject: drm/msm/dsi: Fix some reference counted resource leaks
+
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+
+[ Upstream commit 6977cc89c87506ff17e6c05f0e37f46752256e82 ]
+
+'of_find_device_by_node()' takes a reference that must be released when
+not needed anymore.
+This is expected to be done in 'dsi_destroy()'.
+
+However, there are 2 issues in 'dsi_get_phy()'.
+
+First, if 'of_find_device_by_node()' succeeds but 'platform_get_drvdata()'
+returns NULL, 'msm_dsi->phy_dev' will still be NULL, and the reference
+won't be released in 'dsi_destroy()'.
+
+Secondly, as 'of_find_device_by_node()' already takes a reference, there is
+no need for an additional 'get_device()'.
+
+Move the assignment to 'msm_dsi->phy_dev' a few lines above and remove the
+unneeded 'get_device()' to solve both issues.
+
+Fixes: ec31abf6684e ("drm/msm/dsi: Separate PHY to another platform device")
+Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Link: https://lore.kernel.org/r/f15bc57648a00e7c99f943903468a04639d50596.1628241097.git.christophe.jaillet@wanadoo.fr
+Signed-off-by: Rob Clark <robdclark@chromium.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/msm/dsi/dsi.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
+index ec572f8389ed..3a75586c1989 100644
+--- a/drivers/gpu/drm/msm/dsi/dsi.c
++++ b/drivers/gpu/drm/msm/dsi/dsi.c
+@@ -36,8 +36,10 @@ static int dsi_get_phy(struct msm_dsi *msm_dsi)
+       }
+       phy_pdev = of_find_device_by_node(phy_node);
+-      if (phy_pdev)
++      if (phy_pdev) {
+               msm_dsi->phy = platform_get_drvdata(phy_pdev);
++              msm_dsi->phy_dev = &phy_pdev->dev;
++      }
+       of_node_put(phy_node);
+@@ -46,8 +48,6 @@ static int dsi_get_phy(struct msm_dsi *msm_dsi)
+               return -EPROBE_DEFER;
+       }
+-      msm_dsi->phy_dev = get_device(&phy_pdev->dev);
+-
+       return 0;
+ }
+-- 
+2.30.2
+
diff --git a/queue-4.9/i2c-highlander-add-irq-check.patch b/queue-4.9/i2c-highlander-add-irq-check.patch
new file mode 100644 (file)
index 0000000..4670e6f
--- /dev/null
@@ -0,0 +1,39 @@
+From 9c617cdfcecd016b61848e8c81a9e2f61f64842b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 30 May 2021 22:13:45 +0300
+Subject: i2c: highlander: add IRQ check
+
+From: Sergey Shtylyov <s.shtylyov@omp.ru>
+
+[ Upstream commit f16a3bb69aa6baabf8f0aca982c8cf21e2a4f6bc ]
+
+The driver is written as if platform_get_irq() returns 0 on errors (while
+actually it returns a negative error code), blithely passing these error
+codes to request_irq() (which takes *unsigned* IRQ #) -- which fails with
+-EINVAL. Add the necessary error check to the pre-existing *if* statement
+forcing the driver into the polling mode...
+
+Fixes: 4ad48e6ab18c ("i2c: Renesas Highlander FPGA SMBus support")
+Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
+Signed-off-by: Wolfram Sang <wsa@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/i2c/busses/i2c-highlander.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/i2c/busses/i2c-highlander.c b/drivers/i2c/busses/i2c-highlander.c
+index 56dc69e7349f..9ad031ea3300 100644
+--- a/drivers/i2c/busses/i2c-highlander.c
++++ b/drivers/i2c/busses/i2c-highlander.c
+@@ -382,7 +382,7 @@ static int highlander_i2c_probe(struct platform_device *pdev)
+       platform_set_drvdata(pdev, dev);
+       dev->irq = platform_get_irq(pdev, 0);
+-      if (iic_force_poll)
++      if (dev->irq < 0 || iic_force_poll)
+               dev->irq = 0;
+       if (dev->irq) {
+-- 
+2.30.2
+
diff --git a/queue-4.9/i2c-iop3xx-fix-deferred-probing.patch b/queue-4.9/i2c-iop3xx-fix-deferred-probing.patch
new file mode 100644 (file)
index 0000000..483c335
--- /dev/null
@@ -0,0 +1,53 @@
+From ac894cf2fd6ab6d3000bc7299e006a025614ea09 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 12 Aug 2021 23:35:09 +0300
+Subject: i2c: iop3xx: fix deferred probing
+
+From: Sergey Shtylyov <s.shtylyov@omp.ru>
+
+[ Upstream commit a1299505162ad00def3573260c2c68b9c8e8d697 ]
+
+When adding the code to handle platform_get_irq*() errors in the commit
+489447380a29 ("handle errors returned by platform_get_irq*()"), the
+actual error code was enforced to be -ENXIO in the driver for some
+strange reason.  This didn't matter much until the deferred probing was
+introduced -- which requires an actual error code to be propagated
+upstream from the failure site.
+
+While fixing this, also stop overriding the errors from request_irq() to
+-EIO (done since the pre-git era).
+
+Fixes: 489447380a29 ("[PATCH] handle errors returned by platform_get_irq*()")
+Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
+Signed-off-by: Wolfram Sang <wsa@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/i2c/busses/i2c-iop3xx.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
+index 85cbe4b55578..d4fe7ccccb22 100644
+--- a/drivers/i2c/busses/i2c-iop3xx.c
++++ b/drivers/i2c/busses/i2c-iop3xx.c
+@@ -456,16 +456,14 @@ iop3xx_i2c_probe(struct platform_device *pdev)
+       irq = platform_get_irq(pdev, 0);
+       if (irq < 0) {
+-              ret = -ENXIO;
++              ret = irq;
+               goto unmap;
+       }
+       ret = request_irq(irq, iop3xx_i2c_irq_handler, 0,
+                               pdev->name, adapter_data);
+-      if (ret) {
+-              ret = -EIO;
++      if (ret)
+               goto unmap;
+-      }
+       memcpy(new_adapter->name, pdev->name, strlen(pdev->name));
+       new_adapter->owner = THIS_MODULE;
+-- 
+2.30.2
+
diff --git a/queue-4.9/i2c-mt65xx-fix-irq-check.patch b/queue-4.9/i2c-mt65xx-fix-irq-check.patch
new file mode 100644 (file)
index 0000000..d6ae041
--- /dev/null
@@ -0,0 +1,38 @@
+From 22c609c5ef81a5a18c584b171339a071d9bcb7e8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 4 Jul 2021 17:38:45 +0300
+Subject: i2c: mt65xx: fix IRQ check
+
+From: Sergey Shtylyov <s.shtylyov@omp.ru>
+
+[ Upstream commit 58fb7c643d346e2364404554f531cfa6a1a3917c ]
+
+Iff platform_get_irq() returns 0, the driver's probe() method will return 0
+early (as if the method's call was successful).  Let's consider IRQ0 valid
+for simplicity -- devm_request_irq() can always override that decision...
+
+Fixes: ce38815d39ea ("I2C: mediatek: Add driver for MediaTek I2C controller")
+Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>
+Reviewed-by: Qii Wang <qii.wang@mediatek.com>
+Signed-off-by: Wolfram Sang <wsa@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/i2c/busses/i2c-mt65xx.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
+index 4a7d9bc2142b..0f905f8387f2 100644
+--- a/drivers/i2c/busses/i2c-mt65xx.c
++++ b/drivers/i2c/busses/i2c-mt65xx.c
+@@ -708,7 +708,7 @@ static int mtk_i2c_probe(struct platform_device *pdev)
+               return PTR_ERR(i2c->pdmabase);
+       irq = platform_get_irq(pdev, 0);
+-      if (irq <= 0)
++      if (irq < 0)
+               return irq;
+       init_completion(&i2c->msg_complete);
+-- 
+2.30.2
+
diff --git a/queue-4.9/i2c-s3c2410-fix-irq-check.patch b/queue-4.9/i2c-s3c2410-fix-irq-check.patch
new file mode 100644 (file)
index 0000000..46fbccc
--- /dev/null
@@ -0,0 +1,38 @@
+From 3bffbeccac50d53c216dbda796ec2d9159241896 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 4 Jul 2021 17:45:25 +0300
+Subject: i2c: s3c2410: fix IRQ check
+
+From: Sergey Shtylyov <s.shtylyov@omp.ru>
+
+[ Upstream commit d6840a5e370b7ea4fde16ce2caf431bcc87f9a75 ]
+
+Iff platform_get_irq() returns 0, the driver's probe() method will return 0
+early (as if the method's call was successful).  Let's consider IRQ0 valid
+for simplicity -- devm_request_irq() can always override that decision...
+
+Fixes: e0d1ec97853f ("i2c-s3c2410: Change IRQ to be plain integer.")
+Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
+Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+Signed-off-by: Wolfram Sang <wsa@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/i2c/busses/i2c-s3c2410.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
+index acccdfb95420..3814c160ff17 100644
+--- a/drivers/i2c/busses/i2c-s3c2410.c
++++ b/drivers/i2c/busses/i2c-s3c2410.c
+@@ -1181,7 +1181,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
+        */
+       if (!(i2c->quirks & QUIRK_POLL)) {
+               i2c->irq = ret = platform_get_irq(pdev, 0);
+-              if (ret <= 0) {
++              if (ret < 0) {
+                       dev_err(&pdev->dev, "cannot find IRQ\n");
+                       clk_unprepare(i2c->clk);
+                       return ret;
+-- 
+2.30.2
+
diff --git a/queue-4.9/ipv4-make-exception-cache-less-predictible.patch b/queue-4.9/ipv4-make-exception-cache-less-predictible.patch
new file mode 100644 (file)
index 0000000..5a78ed1
--- /dev/null
@@ -0,0 +1,127 @@
+From 2a1ce5a3b34767c4c3175f7fae2f35f7bbc7b819 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 29 Aug 2021 15:16:15 -0700
+Subject: ipv4: make exception cache less predictible
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit 67d6d681e15b578c1725bad8ad079e05d1c48a8e ]
+
+Even after commit 6457378fe796 ("ipv4: use siphash instead of Jenkins in
+fnhe_hashfun()"), an attacker can still use brute force to learn
+some secrets from a victim linux host.
+
+One way to defeat these attacks is to make the max depth of the hash
+table bucket a random value.
+
+Before this patch, each bucket of the hash table used to store exceptions
+could contain 6 items under attack.
+
+After the patch, each bucket would contains a random number of items,
+between 6 and 10. The attacker can no longer infer secrets.
+
+This is slightly increasing memory size used by the hash table,
+by 50% in average, we do not expect this to be a problem.
+
+This patch is more complex than the prior one (IPv6 equivalent),
+because IPv4 was reusing the oldest entry.
+Since we need to be able to evict more than one entry per
+update_or_create_fnhe() call, I had to replace
+fnhe_oldest() with fnhe_remove_oldest().
+
+Also note that we will queue extra kfree_rcu() calls under stress,
+which hopefully wont be a too big issue.
+
+Fixes: 4895c771c7f0 ("ipv4: Add FIB nexthop exceptions.")
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Reported-by: Keyu Man <kman001@ucr.edu>
+Cc: Willy Tarreau <w@1wt.eu>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Reviewed-by: David Ahern <dsahern@kernel.org>
+Tested-by: David Ahern <dsahern@kernel.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv4/route.c | 46 ++++++++++++++++++++++++++++++----------------
+ 1 file changed, 30 insertions(+), 16 deletions(-)
+
+diff --git a/net/ipv4/route.c b/net/ipv4/route.c
+index 5350e1b61c06..f05b8d63dba3 100644
+--- a/net/ipv4/route.c
++++ b/net/ipv4/route.c
+@@ -597,18 +597,25 @@ static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
+       }
+ }
+-static struct fib_nh_exception *fnhe_oldest(struct fnhe_hash_bucket *hash)
++static void fnhe_remove_oldest(struct fnhe_hash_bucket *hash)
+ {
+-      struct fib_nh_exception *fnhe, *oldest;
++      struct fib_nh_exception __rcu **fnhe_p, **oldest_p;
++      struct fib_nh_exception *fnhe, *oldest = NULL;
+-      oldest = rcu_dereference(hash->chain);
+-      for (fnhe = rcu_dereference(oldest->fnhe_next); fnhe;
+-           fnhe = rcu_dereference(fnhe->fnhe_next)) {
+-              if (time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp))
++      for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) {
++              fnhe = rcu_dereference_protected(*fnhe_p,
++                                               lockdep_is_held(&fnhe_lock));
++              if (!fnhe)
++                      break;
++              if (!oldest ||
++                  time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) {
+                       oldest = fnhe;
++                      oldest_p = fnhe_p;
++              }
+       }
+       fnhe_flush_routes(oldest);
+-      return oldest;
++      *oldest_p = oldest->fnhe_next;
++      kfree_rcu(oldest, rcu);
+ }
+ static inline u32 fnhe_hashfun(__be32 daddr)
+@@ -685,16 +692,21 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw,
+               if (rt)
+                       fill_route_from_fnhe(rt, fnhe);
+       } else {
+-              if (depth > FNHE_RECLAIM_DEPTH)
+-                      fnhe = fnhe_oldest(hash);
+-              else {
+-                      fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC);
+-                      if (!fnhe)
+-                              goto out_unlock;
+-
+-                      fnhe->fnhe_next = hash->chain;
+-                      rcu_assign_pointer(hash->chain, fnhe);
++              /* Randomize max depth to avoid some side channels attacks. */
++              int max_depth = FNHE_RECLAIM_DEPTH +
++                              prandom_u32_max(FNHE_RECLAIM_DEPTH);
++
++              while (depth > max_depth) {
++                      fnhe_remove_oldest(hash);
++                      depth--;
+               }
++
++              fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC);
++              if (!fnhe)
++                      goto out_unlock;
++
++              fnhe->fnhe_next = hash->chain;
++
+               fnhe->fnhe_genid = genid;
+               fnhe->fnhe_daddr = daddr;
+               fnhe->fnhe_gw = gw;
+@@ -702,6 +714,8 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw,
+               fnhe->fnhe_mtu_locked = lock;
+               fnhe->fnhe_expires = expires;
++              rcu_assign_pointer(hash->chain, fnhe);
++
+               /* Exception created; mark the cached routes for the nexthop
+                * stale, so anyone caching it rechecks if this exception
+                * applies to them.
+-- 
+2.30.2
+
diff --git a/queue-4.9/libata-fix-ata_host_start.patch b/queue-4.9/libata-fix-ata_host_start.patch
new file mode 100644 (file)
index 0000000..dd013e7
--- /dev/null
@@ -0,0 +1,39 @@
+From d6d6d7fe8c9fc540695689345f6c20247ab73710 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 16 Aug 2021 10:44:47 +0900
+Subject: libata: fix ata_host_start()
+
+From: Damien Le Moal <damien.lemoal@wdc.com>
+
+[ Upstream commit 355a8031dc174450ccad2a61c513ad7222d87a97 ]
+
+The loop on entry of ata_host_start() may not initialize host->ops to a
+non NULL value. The test on the host_stop field of host->ops must then
+be preceded by a check that host->ops is not NULL.
+
+Reported-by: kernel test robot <lkp@intel.com>
+Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
+Reviewed-by: Hannes Reinecke <hare@suse.de>
+Link: https://lore.kernel.org/r/20210816014456.2191776-3-damien.lemoal@wdc.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/ata/libata-core.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
+index 228a4cfb0e7d..ea42840575ca 100644
+--- a/drivers/ata/libata-core.c
++++ b/drivers/ata/libata-core.c
+@@ -6213,7 +6213,7 @@ int ata_host_start(struct ata_host *host)
+                       have_stop = 1;
+       }
+-      if (host->ops->host_stop)
++      if (host->ops && host->ops->host_stop)
+               have_stop = 1;
+       if (have_stop) {
+-- 
+2.30.2
+
diff --git a/queue-4.9/m68k-emu-fix-invalid-free-in-nfeth_cleanup.patch b/queue-4.9/m68k-emu-fix-invalid-free-in-nfeth_cleanup.patch
new file mode 100644 (file)
index 0000000..d83705c
--- /dev/null
@@ -0,0 +1,40 @@
+From 9cc63322dc2701fa78a70bf363a0a278fcfac430 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 5 Jul 2021 23:47:27 +0300
+Subject: m68k: emu: Fix invalid free in nfeth_cleanup()
+
+From: Pavel Skripkin <paskripkin@gmail.com>
+
+[ Upstream commit 761608f5cf70e8876c2f0e39ca54b516bdcb7c12 ]
+
+In the for loop all nfeth_dev array members should be freed, not only
+the first one.  Freeing only the first array member can cause
+double-free bugs and memory leaks.
+
+Fixes: 9cd7b148312f ("m68k/atari: ARAnyM - Add support for network access")
+Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
+Link: https://lore.kernel.org/r/20210705204727.10743-1-paskripkin@gmail.com
+Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/m68k/emu/nfeth.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/m68k/emu/nfeth.c b/arch/m68k/emu/nfeth.c
+index a0985fd088d1..7d695fc7a2d0 100644
+--- a/arch/m68k/emu/nfeth.c
++++ b/arch/m68k/emu/nfeth.c
+@@ -260,8 +260,8 @@ static void __exit nfeth_cleanup(void)
+       for (i = 0; i < MAX_UNIT; i++) {
+               if (nfeth_dev[i]) {
+-                      unregister_netdev(nfeth_dev[0]);
+-                      free_netdev(nfeth_dev[0]);
++                      unregister_netdev(nfeth_dev[i]);
++                      free_netdev(nfeth_dev[i]);
+               }
+       }
+       free_irq(nfEtherIRQ, nfeth_interrupt);
+-- 
+2.30.2
+
diff --git a/queue-4.9/media-dvb-usb-fix-uninit-value-in-dvb_usb_adapter_dv.patch b/queue-4.9/media-dvb-usb-fix-uninit-value-in-dvb_usb_adapter_dv.patch
new file mode 100644 (file)
index 0000000..9ff5d44
--- /dev/null
@@ -0,0 +1,52 @@
+From bf811bf50ef6ce05a9a05a925c0ad5098a2cc2ea Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 25 Jun 2021 07:33:27 +0200
+Subject: media: dvb-usb: fix uninit-value in dvb_usb_adapter_dvb_init
+
+From: Dongliang Mu <mudongliangabcd@gmail.com>
+
+[ Upstream commit c5453769f77ce19a5b03f1f49946fd3f8a374009 ]
+
+If dibusb_read_eeprom_byte fails, the mac address is not initialized.
+And nova_t_read_mac_address does not handle this failure, which leads to
+the uninit-value in dvb_usb_adapter_dvb_init.
+
+Fix this by handling the failure of dibusb_read_eeprom_byte.
+
+Reported-by: syzbot+e27b4fd589762b0b9329@syzkaller.appspotmail.com
+Fixes: 786baecfe78f ("[media] dvb-usb: move it to drivers/media/usb/dvb-usb")
+Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
+Signed-off-by: Sean Young <sean@mess.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/dvb-usb/nova-t-usb2.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/media/usb/dvb-usb/nova-t-usb2.c b/drivers/media/usb/dvb-usb/nova-t-usb2.c
+index 1babd3341910..016a6d1ad279 100644
+--- a/drivers/media/usb/dvb-usb/nova-t-usb2.c
++++ b/drivers/media/usb/dvb-usb/nova-t-usb2.c
+@@ -133,7 +133,7 @@ ret:
+ static int nova_t_read_mac_address (struct dvb_usb_device *d, u8 mac[6])
+ {
+-      int i;
++      int i, ret;
+       u8 b;
+       mac[0] = 0x00;
+@@ -142,7 +142,9 @@ static int nova_t_read_mac_address (struct dvb_usb_device *d, u8 mac[6])
+       /* this is a complete guess, but works for my box */
+       for (i = 136; i < 139; i++) {
+-              dibusb_read_eeprom_byte(d,i, &b);
++              ret = dibusb_read_eeprom_byte(d, i, &b);
++              if (ret)
++                      return ret;
+               mac[5 - (i - 136)] = b;
+       }
+-- 
+2.30.2
+
diff --git a/queue-4.9/media-dvb-usb-fix-uninit-value-in-vp702x_read_mac_ad.patch b/queue-4.9/media-dvb-usb-fix-uninit-value-in-vp702x_read_mac_ad.patch
new file mode 100644 (file)
index 0000000..6565cd0
--- /dev/null
@@ -0,0 +1,57 @@
+From 90fdd413e04300d6c99d04ec82f33612c2ae6e90 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 25 Jun 2021 07:59:04 +0200
+Subject: media: dvb-usb: fix uninit-value in vp702x_read_mac_addr
+
+From: Dongliang Mu <mudongliangabcd@gmail.com>
+
+[ Upstream commit 797c061ad715a9a1480eb73f44b6939fbe3209ed ]
+
+If vp702x_usb_in_op fails, the mac address is not initialized.
+And vp702x_read_mac_addr does not handle this failure, which leads to
+the uninit-value in dvb_usb_adapter_dvb_init.
+
+Fix this by handling the failure of vp702x_usb_in_op.
+
+Fixes: 786baecfe78f ("[media] dvb-usb: move it to drivers/media/usb/dvb-usb")
+Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
+Signed-off-by: Sean Young <sean@mess.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/dvb-usb/vp702x.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/media/usb/dvb-usb/vp702x.c b/drivers/media/usb/dvb-usb/vp702x.c
+index 40de33de90a7..5c3b0a7ca27e 100644
+--- a/drivers/media/usb/dvb-usb/vp702x.c
++++ b/drivers/media/usb/dvb-usb/vp702x.c
+@@ -294,16 +294,22 @@ static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
+ static int vp702x_read_mac_addr(struct dvb_usb_device *d,u8 mac[6])
+ {
+       u8 i, *buf;
++      int ret;
+       struct vp702x_device_state *st = d->priv;
+       mutex_lock(&st->buf_mutex);
+       buf = st->buf;
+-      for (i = 6; i < 12; i++)
+-              vp702x_usb_in_op(d, READ_EEPROM_REQ, i, 1, &buf[i - 6], 1);
++      for (i = 6; i < 12; i++) {
++              ret = vp702x_usb_in_op(d, READ_EEPROM_REQ, i, 1,
++                                     &buf[i - 6], 1);
++              if (ret < 0)
++                      goto err;
++      }
+       memcpy(mac, buf, 6);
++err:
+       mutex_unlock(&st->buf_mutex);
+-      return 0;
++      return ret;
+ }
+ static int vp702x_frontend_attach(struct dvb_usb_adapter *adap)
+-- 
+2.30.2
+
diff --git a/queue-4.9/media-go7007-remove-redundant-initialization.patch b/queue-4.9/media-go7007-remove-redundant-initialization.patch
new file mode 100644 (file)
index 0000000..f3c6c56
--- /dev/null
@@ -0,0 +1,87 @@
+From 3f3df644461b87a3234956c14e6e672988c174e8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 20 Jun 2021 21:45:42 +0200
+Subject: media: go7007: remove redundant initialization
+
+From: Pavel Skripkin <paskripkin@gmail.com>
+
+[ Upstream commit 6f5885a7750545973bf1a942d2f0f129aef0aa06 ]
+
+In go7007_alloc() kzalloc() is used for struct go7007
+allocation. It means that there is no need in zeroing
+any members, because kzalloc will take care of it.
+
+Removing these reduntant initialization steps increases
+execution speed a lot:
+
+       Before:
+               + 86.802 us   |    go7007_alloc();
+       After:
+               + 29.595 us   |    go7007_alloc();
+
+Fixes: 866b8695d67e8 ("Staging: add the go7007 video driver")
+Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/go7007/go7007-driver.c | 26 ------------------------
+ 1 file changed, 26 deletions(-)
+
+diff --git a/drivers/media/usb/go7007/go7007-driver.c b/drivers/media/usb/go7007/go7007-driver.c
+index 05b1126f263e..d861d7225f49 100644
+--- a/drivers/media/usb/go7007/go7007-driver.c
++++ b/drivers/media/usb/go7007/go7007-driver.c
+@@ -698,49 +698,23 @@ struct go7007 *go7007_alloc(const struct go7007_board_info *board,
+                                               struct device *dev)
+ {
+       struct go7007 *go;
+-      int i;
+       go = kzalloc(sizeof(struct go7007), GFP_KERNEL);
+       if (go == NULL)
+               return NULL;
+       go->dev = dev;
+       go->board_info = board;
+-      go->board_id = 0;
+       go->tuner_type = -1;
+-      go->channel_number = 0;
+-      go->name[0] = 0;
+       mutex_init(&go->hw_lock);
+       init_waitqueue_head(&go->frame_waitq);
+       spin_lock_init(&go->spinlock);
+       go->status = STATUS_INIT;
+-      memset(&go->i2c_adapter, 0, sizeof(go->i2c_adapter));
+-      go->i2c_adapter_online = 0;
+-      go->interrupt_available = 0;
+       init_waitqueue_head(&go->interrupt_waitq);
+-      go->input = 0;
+       go7007_update_board(go);
+-      go->encoder_h_halve = 0;
+-      go->encoder_v_halve = 0;
+-      go->encoder_subsample = 0;
+       go->format = V4L2_PIX_FMT_MJPEG;
+       go->bitrate = 1500000;
+       go->fps_scale = 1;
+-      go->pali = 0;
+       go->aspect_ratio = GO7007_RATIO_1_1;
+-      go->gop_size = 0;
+-      go->ipb = 0;
+-      go->closed_gop = 0;
+-      go->repeat_seqhead = 0;
+-      go->seq_header_enable = 0;
+-      go->gop_header_enable = 0;
+-      go->dvd_mode = 0;
+-      go->interlace_coding = 0;
+-      for (i = 0; i < 4; ++i)
+-              go->modet[i].enable = 0;
+-      for (i = 0; i < 1624; ++i)
+-              go->modet_map[i] = 0;
+-      go->audio_deliver = NULL;
+-      go->audio_enabled = 0;
+       return go;
+ }
+-- 
+2.30.2
+
diff --git a/queue-4.9/mmc-dw_mmc-fix-issue-with-uninitialized-dma_slave_co.patch b/queue-4.9/mmc-dw_mmc-fix-issue-with-uninitialized-dma_slave_co.patch
new file mode 100644 (file)
index 0000000..cefa7bd
--- /dev/null
@@ -0,0 +1,47 @@
+From e9793e424a3d44aaccdbf592ad03b657b0ad22a4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 10 Aug 2021 11:16:43 +0300
+Subject: mmc: dw_mmc: Fix issue with uninitialized dma_slave_config
+
+From: Tony Lindgren <tony@atomide.com>
+
+[ Upstream commit c3ff0189d3bc9c03845fe37472c140f0fefd0c79 ]
+
+Depending on the DMA driver being used, the struct dma_slave_config may
+need to be initialized to zero for the unused data.
+
+For example, we have three DMA drivers using src_port_window_size and
+dst_port_window_size. If these are left uninitialized, it can cause DMA
+failures.
+
+For dw_mmc, this is probably not currently an issue but is still good to
+fix though.
+
+Fixes: 3fc7eaef44db ("mmc: dw_mmc: Add external dma interface support")
+Cc: Shawn Lin <shawn.lin@rock-chips.com>
+Cc: Jaehoon Chung <jh80.chung@samsung.com>
+Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
+Cc: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Link: https://lore.kernel.org/r/20210810081644.19353-2-tony@atomide.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/mmc/host/dw_mmc.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
+index c6b91efaa956..209bdf0317b3 100644
+--- a/drivers/mmc/host/dw_mmc.c
++++ b/drivers/mmc/host/dw_mmc.c
+@@ -762,6 +762,7 @@ static int dw_mci_edmac_start_dma(struct dw_mci *host,
+       int ret = 0;
+       /* Set external dma config: burst size, burst width */
++      memset(&cfg, 0, sizeof(cfg));
+       cfg.dst_addr = host->phy_regs + fifo_offset;
+       cfg.src_addr = cfg.dst_addr;
+       cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
+-- 
+2.30.2
+
diff --git a/queue-4.9/mmc-moxart-fix-issue-with-uninitialized-dma_slave_co.patch b/queue-4.9/mmc-moxart-fix-issue-with-uninitialized-dma_slave_co.patch
new file mode 100644 (file)
index 0000000..c2c0bed
--- /dev/null
@@ -0,0 +1,46 @@
+From 956508812e187740277e12e3db0b4baf012fd1bb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 10 Aug 2021 11:16:44 +0300
+Subject: mmc: moxart: Fix issue with uninitialized dma_slave_config
+
+From: Tony Lindgren <tony@atomide.com>
+
+[ Upstream commit ee5165354d498e5bceb0b386e480ac84c5f8c28c ]
+
+Depending on the DMA driver being used, the struct dma_slave_config may
+need to be initialized to zero for the unused data.
+
+For example, we have three DMA drivers using src_port_window_size and
+dst_port_window_size. If these are left uninitialized, it can cause DMA
+failures.
+
+For moxart, this is probably not currently an issue but is still good to
+fix though.
+
+Fixes: 1b66e94e6b99 ("mmc: moxart: Add MOXA ART SD/MMC driver")
+Cc: Jonas Jensen <jonas.jensen@gmail.com>
+Cc: Vinod Koul <vkoul@kernel.org>
+Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Link: https://lore.kernel.org/r/20210810081644.19353-3-tony@atomide.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/mmc/host/moxart-mmc.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c
+index bbad309679cf..41a5493cb68d 100644
+--- a/drivers/mmc/host/moxart-mmc.c
++++ b/drivers/mmc/host/moxart-mmc.c
+@@ -633,6 +633,7 @@ static int moxart_probe(struct platform_device *pdev)
+                        host->dma_chan_tx, host->dma_chan_rx);
+               host->have_dma = true;
++              memset(&cfg, 0, sizeof(cfg));
+               cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
+               cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
+-- 
+2.30.2
+
diff --git a/queue-4.9/net-cipso-fix-warnings-in-netlbl_cipsov4_add_std.patch b/queue-4.9/net-cipso-fix-warnings-in-netlbl_cipsov4_add_std.patch
new file mode 100644 (file)
index 0000000..e0a64e7
--- /dev/null
@@ -0,0 +1,70 @@
+From f8032e9ef03d292b683ed8e2d32d0db7d062b8df Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 27 Jul 2021 19:35:30 +0300
+Subject: net: cipso: fix warnings in netlbl_cipsov4_add_std
+
+From: Pavel Skripkin <paskripkin@gmail.com>
+
+[ Upstream commit 8ca34a13f7f9b3fa2c464160ffe8cc1a72088204 ]
+
+Syzbot reported warning in netlbl_cipsov4_add(). The
+problem was in too big doi_def->map.std->lvl.local_size
+passed to kcalloc(). Since this value comes from userpace there is
+no need to warn if value is not correct.
+
+The same problem may occur with other kcalloc() calls in
+this function, so, I've added __GFP_NOWARN flag to all
+kcalloc() calls there.
+
+Reported-and-tested-by: syzbot+cdd51ee2e6b0b2e18c0d@syzkaller.appspotmail.com
+Fixes: 96cb8e3313c7 ("[NetLabel]: CIPSOv4 and Unlabeled packet integration")
+Acked-by: Paul Moore <paul@paul-moore.com>
+Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/netlabel/netlabel_cipso_v4.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c
+index 7fd1104ba900..d31cd4d509ca 100644
+--- a/net/netlabel/netlabel_cipso_v4.c
++++ b/net/netlabel/netlabel_cipso_v4.c
+@@ -205,14 +205,14 @@ static int netlbl_cipsov4_add_std(struct genl_info *info,
+               }
+       doi_def->map.std->lvl.local = kcalloc(doi_def->map.std->lvl.local_size,
+                                             sizeof(u32),
+-                                            GFP_KERNEL);
++                                            GFP_KERNEL | __GFP_NOWARN);
+       if (doi_def->map.std->lvl.local == NULL) {
+               ret_val = -ENOMEM;
+               goto add_std_failure;
+       }
+       doi_def->map.std->lvl.cipso = kcalloc(doi_def->map.std->lvl.cipso_size,
+                                             sizeof(u32),
+-                                            GFP_KERNEL);
++                                            GFP_KERNEL | __GFP_NOWARN);
+       if (doi_def->map.std->lvl.cipso == NULL) {
+               ret_val = -ENOMEM;
+               goto add_std_failure;
+@@ -279,7 +279,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info,
+               doi_def->map.std->cat.local = kcalloc(
+                                             doi_def->map.std->cat.local_size,
+                                             sizeof(u32),
+-                                            GFP_KERNEL);
++                                            GFP_KERNEL | __GFP_NOWARN);
+               if (doi_def->map.std->cat.local == NULL) {
+                       ret_val = -ENOMEM;
+                       goto add_std_failure;
+@@ -287,7 +287,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info,
+               doi_def->map.std->cat.cipso = kcalloc(
+                                             doi_def->map.std->cat.cipso_size,
+                                             sizeof(u32),
+-                                            GFP_KERNEL);
++                                            GFP_KERNEL | __GFP_NOWARN);
+               if (doi_def->map.std->cat.cipso == NULL) {
+                       ret_val = -ENOMEM;
+                       goto add_std_failure;
+-- 
+2.30.2
+
diff --git a/queue-4.9/pci-pm-enable-pme-if-it-can-be-signaled-from-d3cold.patch b/queue-4.9/pci-pm-enable-pme-if-it-can-be-signaled-from-d3cold.patch
new file mode 100644 (file)
index 0000000..6f4ff53
--- /dev/null
@@ -0,0 +1,56 @@
+From 97009c870dbcbb7c47596c98f8894a8c17cbbec6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 29 Jul 2021 16:49:10 +0200
+Subject: PCI: PM: Enable PME if it can be signaled from D3cold
+
+From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+
+[ Upstream commit 0e00392a895c95c6d12d42158236c8862a2f43f2 ]
+
+PME signaling is only enabled by __pci_enable_wake() if the target
+device can signal PME from the given target power state (to avoid
+pointless reconfiguration of the device), but if the hierarchy above
+the device goes into D3cold, the device itself will end up in D3cold
+too, so if it can signal PME from D3cold, it should be enabled to
+do so in __pci_enable_wake().
+
+[Note that if the device does not end up in D3cold and it cannot
+ signal PME from the original target power state, it will not signal
+ PME, so in that case the behavior does not change.]
+
+Link: https://lore.kernel.org/linux-pm/3149540.aeNJFYEL58@kreacher/
+Fixes: 5bcc2fb4e815 ("PCI PM: Simplify PCI wake-up code")
+Reported-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Reported-by: Utkarsh H Patel <utkarsh.h.patel@intel.com>
+Reported-by: Koba Ko <koba.ko@canonical.com>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pci/pci.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
+index e09653c73ab4..510933ff6a26 100644
+--- a/drivers/pci/pci.c
++++ b/drivers/pci/pci.c
+@@ -1926,7 +1926,14 @@ int __pci_enable_wake(struct pci_dev *dev, pci_power_t state,
+       if (enable) {
+               int error;
+-              if (pci_pme_capable(dev, state))
++              /*
++               * Enable PME signaling if the device can signal PME from
++               * D3cold regardless of whether or not it can signal PME from
++               * the current target state, because that will allow it to
++               * signal PME when the hierarchy above it goes into D3cold and
++               * the device itself ends up in D3cold as a result of that.
++               */
++              if (pci_pme_capable(dev, state) || pci_pme_capable(dev, PCI_D3cold))
+                       pci_pme_active(dev, true);
+               else
+                       ret = 1;
+-- 
+2.30.2
+
diff --git a/queue-4.9/posix-cpu-timers-force-next-expiration-recalc-after-.patch b/queue-4.9/posix-cpu-timers-force-next-expiration-recalc-after-.patch
new file mode 100644 (file)
index 0000000..acbd0d2
--- /dev/null
@@ -0,0 +1,54 @@
+From c82bea8d8911f60c096f664134a7b1a53282f0ae Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 26 Jul 2021 14:55:10 +0200
+Subject: posix-cpu-timers: Force next expiration recalc after itimer reset
+
+From: Frederic Weisbecker <frederic@kernel.org>
+
+[ Upstream commit 406dd42bd1ba0c01babf9cde169bb319e52f6147 ]
+
+When an itimer deactivates a previously armed expiration, it simply doesn't
+do anything. As a result the process wide cputime counter keeps running and
+the tick dependency stays set until it reaches the old ghost expiration
+value.
+
+This can be reproduced with the following snippet:
+
+       void trigger_process_counter(void)
+       {
+               struct itimerval n = {};
+
+               n.it_value.tv_sec = 100;
+               setitimer(ITIMER_VIRTUAL, &n, NULL);
+               n.it_value.tv_sec = 0;
+               setitimer(ITIMER_VIRTUAL, &n, NULL);
+       }
+
+Fix this with resetting the relevant base expiration. This is similar to
+disarming a timer.
+
+Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Link: https://lore.kernel.org/r/20210726125513.271824-4-frederic@kernel.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/time/posix-cpu-timers.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
+index 9fff077d0ffc..458ffe4ac6fb 100644
+--- a/kernel/time/posix-cpu-timers.c
++++ b/kernel/time/posix-cpu-timers.c
+@@ -1240,8 +1240,6 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx,
+                       }
+               }
+-              if (!*newval)
+-                      return;
+               *newval += now;
+       }
+-- 
+2.30.2
+
diff --git a/queue-4.9/power-supply-axp288_fuel_gauge-report-register-addre.patch b/queue-4.9/power-supply-axp288_fuel_gauge-report-register-addre.patch
new file mode 100644 (file)
index 0000000..7a452a4
--- /dev/null
@@ -0,0 +1,50 @@
+From be0e09e591a4dc9894b6e17ad16579986d9edc05 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 1 Aug 2021 15:30:59 +0200
+Subject: power: supply: axp288_fuel_gauge: Report register-address on readb /
+ writeb errors
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+[ Upstream commit caa534c3ba40c6e8352b42cbbbca9ba481814ac8 ]
+
+When fuel_gauge_reg_readb()/_writeb() fails, report which register we
+were trying to read / write when the error happened.
+
+Also reword the message a bit:
+- Drop the axp288 prefix, dev_err() already prints this
+- Switch from telegram / abbreviated style to a normal sentence, aligning
+  the message with those from fuel_gauge_read_*bit_word()
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/power/supply/axp288_fuel_gauge.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c
+index 089056cb8e73..85e6c9bacf06 100644
+--- a/drivers/power/supply/axp288_fuel_gauge.c
++++ b/drivers/power/supply/axp288_fuel_gauge.c
+@@ -169,7 +169,7 @@ static int fuel_gauge_reg_readb(struct axp288_fg_info *info, int reg)
+       }
+       if (ret < 0) {
+-              dev_err(&info->pdev->dev, "axp288 reg read err:%d\n", ret);
++              dev_err(&info->pdev->dev, "Error reading reg 0x%02x err: %d\n", reg, ret);
+               return ret;
+       }
+@@ -183,7 +183,7 @@ static int fuel_gauge_reg_writeb(struct axp288_fg_info *info, int reg, u8 val)
+       ret = regmap_write(info->regmap, reg, (unsigned int)val);
+       if (ret < 0)
+-              dev_err(&info->pdev->dev, "axp288 reg write err:%d\n", ret);
++              dev_err(&info->pdev->dev, "Error writing reg 0x%02x err: %d\n", reg, ret);
+       return ret;
+ }
+-- 
+2.30.2
+
diff --git a/queue-4.9/power-supply-max17042_battery-fix-typo-in-max17042_t.patch b/queue-4.9/power-supply-max17042_battery-fix-typo-in-max17042_t.patch
new file mode 100644 (file)
index 0000000..9f26f74
--- /dev/null
@@ -0,0 +1,46 @@
+From cc0d2724d089750673ec365a4598dde0355abb9a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 16 Aug 2021 18:50:14 +0200
+Subject: power: supply: max17042_battery: fix typo in MAx17042_TOFF
+
+From: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>
+
+[ Upstream commit ed0d0a0506025f06061325cedae1bbebd081620a ]
+
+Signed-off-by: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>
+Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/power/supply/max17042_battery.c | 2 +-
+ include/linux/power/max17042_battery.h  | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c
+index da7a75f82489..249b0758dae6 100644
+--- a/drivers/power/supply/max17042_battery.c
++++ b/drivers/power/supply/max17042_battery.c
+@@ -644,7 +644,7 @@ static inline void max17042_override_por_values(struct max17042_chip *chip)
+       struct max17042_config_data *config = chip->pdata->config_data;
+       max17042_override_por(map, MAX17042_TGAIN, config->tgain);
+-      max17042_override_por(map, MAx17042_TOFF, config->toff);
++      max17042_override_por(map, MAX17042_TOFF, config->toff);
+       max17042_override_por(map, MAX17042_CGAIN, config->cgain);
+       max17042_override_por(map, MAX17042_COFF, config->coff);
+diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h
+index 522757ac9cd4..890f53881fad 100644
+--- a/include/linux/power/max17042_battery.h
++++ b/include/linux/power/max17042_battery.h
+@@ -75,7 +75,7 @@ enum max17042_register {
+       MAX17042_RelaxCFG       = 0x2A,
+       MAX17042_MiscCFG        = 0x2B,
+       MAX17042_TGAIN          = 0x2C,
+-      MAx17042_TOFF           = 0x2D,
++      MAX17042_TOFF           = 0x2D,
+       MAX17042_CGAIN          = 0x2E,
+       MAX17042_COFF           = 0x2F,
+-- 
+2.30.2
+
diff --git a/queue-4.9/regmap-fix-the-offset-of-register-error-log.patch b/queue-4.9/regmap-fix-the-offset-of-register-error-log.patch
new file mode 100644 (file)
index 0000000..ae5e3c1
--- /dev/null
@@ -0,0 +1,36 @@
+From a5d9e556c030bac08f3cd8d9fca5e7cdcd58c080 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 1 Jul 2021 23:26:30 +0900
+Subject: regmap: fix the offset of register error log
+
+From: Jeongtae Park <jeongtae.park@gmail.com>
+
+[ Upstream commit 1852f5ed358147095297a09cc3c6f160208a676d ]
+
+This patch fixes the offset of register error log
+by using regmap_get_offset().
+
+Signed-off-by: Jeongtae Park <jeongtae.park@gmail.com>
+Link: https://lore.kernel.org/r/20210701142630.44936-1-jeongtae.park@gmail.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/base/regmap/regmap.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
+index cd984b59a8a1..40a9e5378633 100644
+--- a/drivers/base/regmap/regmap.c
++++ b/drivers/base/regmap/regmap.c
+@@ -1375,7 +1375,7 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
+                       if (ret) {
+                               dev_err(map->dev,
+                                       "Error in caching of register: %x ret: %d\n",
+-                                      reg + i, ret);
++                                      reg + regmap_get_offset(map, i), ret);
+                               return ret;
+                       }
+               }
+-- 
+2.30.2
+
index c6d2fb6119de8e10826746871ecf3e8f9920ee21..b99d4937c8b6c2c94fd4b5381d039c9dfd19b543 100644 (file)
@@ -32,3 +32,53 @@ mm-page_alloc-speed-up-the-iteration-of-max_order.patch
 revert-btrfs-compression-don-t-try-to-compress-if-we-don-t-have-enough-pages.patch
 x86-reboot-limit-dell-optiplex-990-quirk-to-early-bios-versions.patch
 pci-call-max-payload-size-related-fixup-quirks-early.patch
+regmap-fix-the-offset-of-register-error-log.patch
+crypto-mxs-dcp-check-for-dma-mapping-errors.patch
+power-supply-axp288_fuel_gauge-report-register-addre.patch
+crypto-omap-sham-clear-dma-flags-only-after-omap_sha.patch
+posix-cpu-timers-force-next-expiration-recalc-after-.patch
+udf-check-lvid-earlier.patch
+power-supply-max17042_battery-fix-typo-in-max17042_t.patch
+libata-fix-ata_host_start.patch
+crypto-qat-do-not-ignore-errors-from-enable_vf2pf_co.patch
+crypto-qat-handle-both-source-of-interrupt-in-vf-isr.patch
+crypto-qat-fix-reuse-of-completion-variable.patch
+crypto-qat-fix-naming-for-init-shutdown-vf-to-pf-not.patch
+crypto-qat-do-not-export-adf_iov_putmsg.patch
+udf_get_extendedattr-had-no-boundary-checks.patch
+m68k-emu-fix-invalid-free-in-nfeth_cleanup.patch
+spi-spi-pic32-fix-issue-with-uninitialized-dma_slave.patch
+crypto-qat-use-proper-type-for-vf_mask.patch
+certs-trigger-creation-of-rsa-module-signing-key-if-.patch
+media-dvb-usb-fix-uninit-value-in-dvb_usb_adapter_dv.patch
+media-dvb-usb-fix-uninit-value-in-vp702x_read_mac_ad.patch
+media-go7007-remove-redundant-initialization.patch
+bluetooth-sco-prevent-information-leak-in-sco_conn_d.patch
+6lowpan-iphc-fix-an-off-by-one-check-of-array-index.patch
+tcp-seq_file-avoid-skipping-sk-during-tcp_seek_last_.patch
+net-cipso-fix-warnings-in-netlbl_cipsov4_add_std.patch
+i2c-highlander-add-irq-check.patch
+pci-pm-enable-pme-if-it-can-be-signaled-from-d3cold.patch
+soc-qcom-smsm-fix-missed-interrupts-if-state-changes.patch
+bluetooth-increase-btnamsiz-to-21-chars-to-fix-poten.patch
+arm64-dts-exynos-correct-gic-cpu-interfaces-address-.patch
+bluetooth-fix-repeated-calls-to-sco_sock_kill.patch
+drm-msm-dsi-fix-some-reference-counted-resource-leak.patch
+usb-gadget-udc-at91-add-irq-check.patch
+usb-phy-fsl-usb-add-irq-check.patch
+usb-phy-twl6030-add-irq-checks.patch
+bluetooth-move-shutdown-callback-before-flushing-tx-.patch
+usb-host-ohci-tmio-add-irq-check.patch
+usb-phy-tahvo-add-irq-check.patch
+usb-gadget-mv_u3d-request_irq-after-initializing-udc.patch
+bluetooth-add-timeout-sanity-check-to-hci_inquiry.patch
+i2c-iop3xx-fix-deferred-probing.patch
+i2c-s3c2410-fix-irq-check.patch
+mmc-dw_mmc-fix-issue-with-uninitialized-dma_slave_co.patch
+mmc-moxart-fix-issue-with-uninitialized-dma_slave_co.patch
+cifs-fix-a-potencially-linear-read-overflow.patch
+i2c-mt65xx-fix-irq-check.patch
+usb-ehci-orion-handle-errors-of-clk_prepare_enable-i.patch
+ath6kl-wmi-fix-an-error-code-in-ath6kl_wmi_sync_poin.patch
+bcma-fix-memory-leak-for-internally-handled-cores.patch
+ipv4-make-exception-cache-less-predictible.patch
diff --git a/queue-4.9/soc-qcom-smsm-fix-missed-interrupts-if-state-changes.patch b/queue-4.9/soc-qcom-smsm-fix-missed-interrupts-if-state-changes.patch
new file mode 100644 (file)
index 0000000..f312816
--- /dev/null
@@ -0,0 +1,78 @@
+From 22c587561fff6d5d09790068b63f6f3775f8eb10 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 12 Jul 2021 15:57:03 +0200
+Subject: soc: qcom: smsm: Fix missed interrupts if state changes while masked
+
+From: Stephan Gerhold <stephan@gerhold.net>
+
+[ Upstream commit e3d4571955050736bbf3eda0a9538a09d9fcfce8 ]
+
+The SMSM driver detects interrupt edges by tracking the last state
+it has seen (and has triggered the interrupt handler for). This works
+fine, but only if the interrupt does not change state while masked.
+
+For example, if an interrupt is unmasked while the state is HIGH,
+the stored last_value for that interrupt might still be LOW. Then,
+when the remote processor triggers smsm_intr() we assume that nothing
+has changed, even though the state might have changed from HIGH to LOW.
+
+Attempt to fix this by checking the current remote state before
+unmasking an IRQ. Use atomic operations to avoid the interrupt handler
+from interfering with the unmask function.
+
+This fixes modem crashes in some edge cases with the BAM-DMUX driver.
+Specifically, the BAM-DMUX interrupt handler is not called for the
+HIGH -> LOW smsm state transition if the BAM-DMUX driver is loaded
+(and therefore unmasks the interrupt) after the modem was already started:
+
+qcom-q6v5-mss 4080000.remoteproc: fatal error received: a2_task.c:3188:
+  Assert FALSE failed: A2 DL PER deadlock timer expired waiting for Apps ACK
+
+Fixes: c97c4090ff72 ("soc: qcom: smsm: Add driver for Qualcomm SMSM")
+Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
+Link: https://lore.kernel.org/r/20210712135703.324748-2-stephan@gerhold.net
+Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/soc/qcom/smsm.c | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c
+index d0337b2a71c8..783cb3364599 100644
+--- a/drivers/soc/qcom/smsm.c
++++ b/drivers/soc/qcom/smsm.c
+@@ -117,7 +117,7 @@ struct smsm_entry {
+       DECLARE_BITMAP(irq_enabled, 32);
+       DECLARE_BITMAP(irq_rising, 32);
+       DECLARE_BITMAP(irq_falling, 32);
+-      u32 last_value;
++      unsigned long last_value;
+       u32 *remote_state;
+       u32 *subscription;
+@@ -212,8 +212,7 @@ static irqreturn_t smsm_intr(int irq, void *data)
+       u32 val;
+       val = readl(entry->remote_state);
+-      changed = val ^ entry->last_value;
+-      entry->last_value = val;
++      changed = val ^ xchg(&entry->last_value, val);
+       for_each_set_bit(i, entry->irq_enabled, 32) {
+               if (!(changed & BIT(i)))
+@@ -274,6 +273,12 @@ static void smsm_unmask_irq(struct irq_data *irqd)
+       struct qcom_smsm *smsm = entry->smsm;
+       u32 val;
++      /* Make sure our last cached state is up-to-date */
++      if (readl(entry->remote_state) & BIT(irq))
++              set_bit(irq, &entry->last_value);
++      else
++              clear_bit(irq, &entry->last_value);
++
+       set_bit(irq, entry->irq_enabled);
+       if (entry->subscription) {
+-- 
+2.30.2
+
diff --git a/queue-4.9/spi-spi-pic32-fix-issue-with-uninitialized-dma_slave.patch b/queue-4.9/spi-spi-pic32-fix-issue-with-uninitialized-dma_slave.patch
new file mode 100644 (file)
index 0000000..65299fd
--- /dev/null
@@ -0,0 +1,46 @@
+From f72a6dc85119e0f63d37bfea792627993b7dd303 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 10 Aug 2021 11:17:27 +0300
+Subject: spi: spi-pic32: Fix issue with uninitialized dma_slave_config
+
+From: Tony Lindgren <tony@atomide.com>
+
+[ Upstream commit 976c1de1de147bb7f4e0d87482f375221c05aeaf ]
+
+Depending on the DMA driver being used, the struct dma_slave_config may
+need to be initialized to zero for the unused data.
+
+For example, we have three DMA drivers using src_port_window_size and
+dst_port_window_size. If these are left uninitialized, it can cause DMA
+failures.
+
+For spi-pic32, this is probably not currently an issue but is still good to
+fix though.
+
+Fixes: 1bcb9f8ceb67 ("spi: spi-pic32: Add PIC32 SPI master driver")
+Cc: Purna Chandra Mandal <purna.mandal@microchip.com>
+Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
+Cc: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Link: https://lore.kernel.org/r/20210810081727.19491-2-tony@atomide.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-pic32.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c
+index 9a97ad973c41..021dddf484e5 100644
+--- a/drivers/spi/spi-pic32.c
++++ b/drivers/spi/spi-pic32.c
+@@ -369,6 +369,7 @@ static int pic32_spi_dma_config(struct pic32_spi *pic32s, u32 dma_width)
+       struct dma_slave_config cfg;
+       int ret;
++      memset(&cfg, 0, sizeof(cfg));
+       cfg.device_fc = true;
+       cfg.src_addr = pic32s->dma_base + buf_offset;
+       cfg.dst_addr = pic32s->dma_base + buf_offset;
+-- 
+2.30.2
+
diff --git a/queue-4.9/tcp-seq_file-avoid-skipping-sk-during-tcp_seek_last_.patch b/queue-4.9/tcp-seq_file-avoid-skipping-sk-during-tcp_seek_last_.patch
new file mode 100644 (file)
index 0000000..6e8bd30
--- /dev/null
@@ -0,0 +1,75 @@
+From a7917e0fed201a969ab7a5ce24ef60f48db2f067 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 1 Jul 2021 13:05:41 -0700
+Subject: tcp: seq_file: Avoid skipping sk during tcp_seek_last_pos
+
+From: Martin KaFai Lau <kafai@fb.com>
+
+[ Upstream commit 525e2f9fd0229eb10cb460a9e6d978257f24804e ]
+
+st->bucket stores the current bucket number.
+st->offset stores the offset within this bucket that is the sk to be
+seq_show().  Thus, st->offset only makes sense within the same
+st->bucket.
+
+These two variables are an optimization for the common no-lseek case.
+When resuming the seq_file iteration (i.e. seq_start()),
+tcp_seek_last_pos() tries to continue from the st->offset
+at bucket st->bucket.
+
+However, it is possible that the bucket pointed by st->bucket
+has changed and st->offset may end up skipping the whole st->bucket
+without finding a sk.  In this case, tcp_seek_last_pos() currently
+continues to satisfy the offset condition in the next (and incorrect)
+bucket.  Instead, regardless of the offset value, the first sk of the
+next bucket should be returned.  Thus, "bucket == st->bucket" check is
+added to tcp_seek_last_pos().
+
+The chance of hitting this is small and the issue is a decade old,
+so targeting for the next tree.
+
+Fixes: a8b690f98baf ("tcp: Fix slowness in read /proc/net/tcp")
+Signed-off-by: Martin KaFai Lau <kafai@fb.com>
+Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
+Reviewed-by: Eric Dumazet <edumazet@google.com>
+Acked-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
+Acked-by: Yonghong Song <yhs@fb.com>
+Link: https://lore.kernel.org/bpf/20210701200541.1033917-1-kafai@fb.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv4/tcp_ipv4.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
+index 10860c089fda..6f895694cca1 100644
+--- a/net/ipv4/tcp_ipv4.c
++++ b/net/ipv4/tcp_ipv4.c
+@@ -2068,6 +2068,7 @@ static void *tcp_get_idx(struct seq_file *seq, loff_t pos)
+ static void *tcp_seek_last_pos(struct seq_file *seq)
+ {
+       struct tcp_iter_state *st = seq->private;
++      int bucket = st->bucket;
+       int offset = st->offset;
+       int orig_num = st->num;
+       void *rc = NULL;
+@@ -2078,7 +2079,7 @@ static void *tcp_seek_last_pos(struct seq_file *seq)
+                       break;
+               st->state = TCP_SEQ_STATE_LISTENING;
+               rc = listening_get_next(seq, NULL);
+-              while (offset-- && rc)
++              while (offset-- && rc && bucket == st->bucket)
+                       rc = listening_get_next(seq, rc);
+               if (rc)
+                       break;
+@@ -2089,7 +2090,7 @@ static void *tcp_seek_last_pos(struct seq_file *seq)
+               if (st->bucket > tcp_hashinfo.ehash_mask)
+                       break;
+               rc = established_get_first(seq);
+-              while (offset-- && rc)
++              while (offset-- && rc && bucket == st->bucket)
+                       rc = established_get_next(seq, rc);
+       }
+-- 
+2.30.2
+
diff --git a/queue-4.9/udf-check-lvid-earlier.patch b/queue-4.9/udf-check-lvid-earlier.patch
new file mode 100644 (file)
index 0000000..d4a176e
--- /dev/null
@@ -0,0 +1,86 @@
+From 60be79bc07f6a7b5d1307a3a2292755465f60b46 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 3 May 2021 11:39:03 +0200
+Subject: udf: Check LVID earlier
+
+From: Jan Kara <jack@suse.cz>
+
+[ Upstream commit 781d2a9a2fc7d0be53a072794dc03ef6de770f3d ]
+
+We were checking validity of LVID entries only when getting
+implementation use information from LVID in udf_sb_lvidiu(). However if
+the LVID is suitably corrupted, it can cause problems also to code such
+as udf_count_free() which doesn't use udf_sb_lvidiu(). So check validity
+of LVID already when loading it from the disk and just disable LVID
+altogether when it is not valid.
+
+Reported-by: syzbot+7fbfe5fed73ebb675748@syzkaller.appspotmail.com
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/udf/super.c | 25 ++++++++++++++++---------
+ 1 file changed, 16 insertions(+), 9 deletions(-)
+
+diff --git a/fs/udf/super.c b/fs/udf/super.c
+index c8c037e8e57b..cf2e770080f9 100644
+--- a/fs/udf/super.c
++++ b/fs/udf/super.c
+@@ -115,16 +115,10 @@ struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct super_block *sb)
+               return NULL;
+       lvid = (struct logicalVolIntegrityDesc *)UDF_SB(sb)->s_lvid_bh->b_data;
+       partnum = le32_to_cpu(lvid->numOfPartitions);
+-      if ((sb->s_blocksize - sizeof(struct logicalVolIntegrityDescImpUse) -
+-           offsetof(struct logicalVolIntegrityDesc, impUse)) /
+-           (2 * sizeof(uint32_t)) < partnum) {
+-              udf_err(sb, "Logical volume integrity descriptor corrupted "
+-                      "(numOfPartitions = %u)!\n", partnum);
+-              return NULL;
+-      }
+       /* The offset is to skip freeSpaceTable and sizeTable arrays */
+       offset = partnum * 2 * sizeof(uint32_t);
+-      return (struct logicalVolIntegrityDescImpUse *)&(lvid->impUse[offset]);
++      return (struct logicalVolIntegrityDescImpUse *)
++                                      (((uint8_t *)(lvid + 1)) + offset);
+ }
+ /* UDF filesystem type */
+@@ -1571,6 +1565,7 @@ static void udf_load_logicalvolint(struct super_block *sb, struct kernel_extent_
+       struct udf_sb_info *sbi = UDF_SB(sb);
+       struct logicalVolIntegrityDesc *lvid;
+       int indirections = 0;
++      u32 parts, impuselen;
+       while (++indirections <= UDF_MAX_LVID_NESTING) {
+               final_bh = NULL;
+@@ -1597,15 +1592,27 @@ static void udf_load_logicalvolint(struct super_block *sb, struct kernel_extent_
+               lvid = (struct logicalVolIntegrityDesc *)final_bh->b_data;
+               if (lvid->nextIntegrityExt.extLength == 0)
+-                      return;
++                      goto check;
+               loc = leea_to_cpu(lvid->nextIntegrityExt);
+       }
+       udf_warn(sb, "Too many LVID indirections (max %u), ignoring.\n",
+               UDF_MAX_LVID_NESTING);
++out_err:
+       brelse(sbi->s_lvid_bh);
+       sbi->s_lvid_bh = NULL;
++      return;
++check:
++      parts = le32_to_cpu(lvid->numOfPartitions);
++      impuselen = le32_to_cpu(lvid->lengthOfImpUse);
++      if (parts >= sb->s_blocksize || impuselen >= sb->s_blocksize ||
++          sizeof(struct logicalVolIntegrityDesc) + impuselen +
++          2 * parts * sizeof(u32) > sb->s_blocksize) {
++              udf_warn(sb, "Corrupted LVID (parts=%u, impuselen=%u), "
++                       "ignoring.\n", parts, impuselen);
++              goto out_err;
++      }
+ }
+-- 
+2.30.2
+
diff --git a/queue-4.9/udf_get_extendedattr-had-no-boundary-checks.patch b/queue-4.9/udf_get_extendedattr-had-no-boundary-checks.patch
new file mode 100644 (file)
index 0000000..0929f7e
--- /dev/null
@@ -0,0 +1,52 @@
+From 902e72ba1cf00296f1f2f25214dc1af493ba751e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 22 Aug 2021 11:33:32 +0200
+Subject: udf_get_extendedattr() had no boundary checks.
+
+From: Stian Skjelstad <stian.skjelstad@gmail.com>
+
+[ Upstream commit 58bc6d1be2f3b0ceecb6027dfa17513ec6aa2abb ]
+
+When parsing the ExtendedAttr data, malicous or corrupt attribute length
+could cause kernel hangs and buffer overruns in some special cases.
+
+Link: https://lore.kernel.org/r/20210822093332.25234-1-stian.skjelstad@gmail.com
+Signed-off-by: Stian Skjelstad <stian.skjelstad@gmail.com>
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/udf/misc.c | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/fs/udf/misc.c b/fs/udf/misc.c
+index 71d1c25f360d..8c7f9ea251e5 100644
+--- a/fs/udf/misc.c
++++ b/fs/udf/misc.c
+@@ -175,13 +175,22 @@ struct genericFormat *udf_get_extendedattr(struct inode *inode, uint32_t type,
+               else
+                       offset = le32_to_cpu(eahd->appAttrLocation);
+-              while (offset < iinfo->i_lenEAttr) {
++              while (offset + sizeof(*gaf) < iinfo->i_lenEAttr) {
++                      uint32_t attrLength;
++
+                       gaf = (struct genericFormat *)&ea[offset];
++                      attrLength = le32_to_cpu(gaf->attrLength);
++
++                      /* Detect undersized elements and buffer overflows */
++                      if ((attrLength < sizeof(*gaf)) ||
++                          (attrLength > (iinfo->i_lenEAttr - offset)))
++                              break;
++
+                       if (le32_to_cpu(gaf->attrType) == type &&
+                                       gaf->attrSubtype == subtype)
+                               return gaf;
+                       else
+-                              offset += le32_to_cpu(gaf->attrLength);
++                              offset += attrLength;
+               }
+       }
+-- 
+2.30.2
+
diff --git a/queue-4.9/usb-ehci-orion-handle-errors-of-clk_prepare_enable-i.patch b/queue-4.9/usb-ehci-orion-handle-errors-of-clk_prepare_enable-i.patch
new file mode 100644 (file)
index 0000000..c867ddf
--- /dev/null
@@ -0,0 +1,64 @@
+From cb38d10fcb7d438e4c7bf27b5f261ce434274f2b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 25 Aug 2021 20:09:02 +0300
+Subject: usb: ehci-orion: Handle errors of clk_prepare_enable() in probe
+
+From: Evgeny Novikov <novikov@ispras.ru>
+
+[ Upstream commit 4720f1bf4ee4a784d9ece05420ba33c9222a3004 ]
+
+ehci_orion_drv_probe() did not account for possible errors of
+clk_prepare_enable() that in particular could cause invocation of
+clk_disable_unprepare() on clocks that were not prepared/enabled yet,
+e.g. in remove or on handling errors of usb_add_hcd() in probe. Though,
+there were several patches fixing different issues with clocks in this
+driver, they did not solve this problem.
+
+Add handling of errors of clk_prepare_enable() in ehci_orion_drv_probe()
+to avoid calls of clk_disable_unprepare() without previous successful
+invocation of clk_prepare_enable().
+
+Found by Linux Driver Verification project (linuxtesting.org).
+
+Fixes: 8c869edaee07 ("ARM: Orion: EHCI: Add support for enabling clocks")
+Co-developed-by: Kirill Shilimanov <kirill.shilimanov@huawei.com>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
+Signed-off-by: Kirill Shilimanov <kirill.shilimanov@huawei.com>
+Link: https://lore.kernel.org/r/20210825170902.11234-1-novikov@ispras.ru
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/usb/host/ehci-orion.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
+index ee8d5faa0194..3eecf47d4e89 100644
+--- a/drivers/usb/host/ehci-orion.c
++++ b/drivers/usb/host/ehci-orion.c
+@@ -218,8 +218,11 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)
+        * the clock does not exists.
+        */
+       priv->clk = devm_clk_get(&pdev->dev, NULL);
+-      if (!IS_ERR(priv->clk))
+-              clk_prepare_enable(priv->clk);
++      if (!IS_ERR(priv->clk)) {
++              err = clk_prepare_enable(priv->clk);
++              if (err)
++                      goto err_put_hcd;
++      }
+       priv->phy = devm_phy_optional_get(&pdev->dev, "usb");
+       if (IS_ERR(priv->phy)) {
+@@ -280,6 +283,7 @@ err_phy_init:
+ err_phy_get:
+       if (!IS_ERR(priv->clk))
+               clk_disable_unprepare(priv->clk);
++err_put_hcd:
+       usb_put_hcd(hcd);
+ err:
+       dev_err(&pdev->dev, "init %s fail, %d\n",
+-- 
+2.30.2
+
diff --git a/queue-4.9/usb-gadget-mv_u3d-request_irq-after-initializing-udc.patch b/queue-4.9/usb-gadget-mv_u3d-request_irq-after-initializing-udc.patch
new file mode 100644 (file)
index 0000000..30acc5a
--- /dev/null
@@ -0,0 +1,76 @@
+From 5db1b9e978a36748f4cfd5c36a91a4179a2cb409 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 18 Aug 2021 17:12:47 +0300
+Subject: usb: gadget: mv_u3d: request_irq() after initializing UDC
+
+From: Nadezda Lutovinova <lutovinova@ispras.ru>
+
+[ Upstream commit 2af0c5ffadaf9d13eca28409d4238b4e672942d3 ]
+
+If IRQ occurs between calling  request_irq() and  mv_u3d_eps_init(),
+then null pointer dereference occurs since u3d->eps[] wasn't
+initialized yet but used in mv_u3d_nuke().
+
+The patch puts registration of the interrupt handler after
+initializing of neccesery data.
+
+Found by Linux Driver Verification project (linuxtesting.org).
+
+Fixes: 90fccb529d24 ("usb: gadget: Gadget directory cleanup - group UDC drivers")
+Acked-by: Felipe Balbi <balbi@kernel.org>
+Signed-off-by: Nadezda Lutovinova <lutovinova@ispras.ru>
+Link: https://lore.kernel.org/r/20210818141247.4794-1-lutovinova@ispras.ru
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/usb/gadget/udc/mv_u3d_core.c | 19 ++++++++++---------
+ 1 file changed, 10 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/usb/gadget/udc/mv_u3d_core.c b/drivers/usb/gadget/udc/mv_u3d_core.c
+index b9e19a591322..d75c6449616b 100644
+--- a/drivers/usb/gadget/udc/mv_u3d_core.c
++++ b/drivers/usb/gadget/udc/mv_u3d_core.c
+@@ -1912,14 +1912,6 @@ static int mv_u3d_probe(struct platform_device *dev)
+               goto err_get_irq;
+       }
+       u3d->irq = r->start;
+-      if (request_irq(u3d->irq, mv_u3d_irq,
+-              IRQF_SHARED, driver_name, u3d)) {
+-              u3d->irq = 0;
+-              dev_err(&dev->dev, "Request irq %d for u3d failed\n",
+-                      u3d->irq);
+-              retval = -ENODEV;
+-              goto err_request_irq;
+-      }
+       /* initialize gadget structure */
+       u3d->gadget.ops = &mv_u3d_ops;  /* usb_gadget_ops */
+@@ -1932,6 +1924,15 @@ static int mv_u3d_probe(struct platform_device *dev)
+       mv_u3d_eps_init(u3d);
++      if (request_irq(u3d->irq, mv_u3d_irq,
++              IRQF_SHARED, driver_name, u3d)) {
++              u3d->irq = 0;
++              dev_err(&dev->dev, "Request irq %d for u3d failed\n",
++                      u3d->irq);
++              retval = -ENODEV;
++              goto err_request_irq;
++      }
++
+       /* external vbus detection */
+       if (u3d->vbus) {
+               u3d->clock_gating = 1;
+@@ -1955,8 +1956,8 @@ static int mv_u3d_probe(struct platform_device *dev)
+ err_unregister:
+       free_irq(u3d->irq, u3d);
+-err_request_irq:
+ err_get_irq:
++err_request_irq:
+       kfree(u3d->status_req);
+ err_alloc_status_req:
+       kfree(u3d->eps);
+-- 
+2.30.2
+
diff --git a/queue-4.9/usb-gadget-udc-at91-add-irq-check.patch b/queue-4.9/usb-gadget-udc-at91-add-irq-check.patch
new file mode 100644 (file)
index 0000000..0f0f607
--- /dev/null
@@ -0,0 +1,42 @@
+From d113424bd94f20e7049bd65b785e8699462143ed Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Aug 2021 23:27:28 +0300
+Subject: usb: gadget: udc: at91: add IRQ check
+
+From: Sergey Shtylyov <s.shtylyov@omp.ru>
+
+[ Upstream commit 50855c31573b02963f0aa2aacfd4ea41c31ae0e0 ]
+
+The driver neglects to check the result of platform_get_irq()'s call and
+blithely passes the negative error codes to devm_request_irq() (which takes
+*unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original
+error code. Stop calling devm_request_irq() with the invalid IRQ #s.
+
+Fixes: 8b2e76687b39 ("USB: AT91 UDC updates, mostly power management")
+Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
+Acked-by: Felipe Balbi <balbi@kernel.org>
+Link: https://lore.kernel.org/r/6654a224-739a-1a80-12f0-76d920f87b6c@omp.ru
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/usb/gadget/udc/at91_udc.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c
+index 8bc78418d40e..cd92cda03d71 100644
+--- a/drivers/usb/gadget/udc/at91_udc.c
++++ b/drivers/usb/gadget/udc/at91_udc.c
+@@ -1895,7 +1895,9 @@ static int at91udc_probe(struct platform_device *pdev)
+       clk_disable(udc->iclk);
+       /* request UDC and maybe VBUS irqs */
+-      udc->udp_irq = platform_get_irq(pdev, 0);
++      udc->udp_irq = retval = platform_get_irq(pdev, 0);
++      if (retval < 0)
++              goto err_unprepare_iclk;
+       retval = devm_request_irq(dev, udc->udp_irq, at91_udc_irq, 0,
+                                 driver_name, udc);
+       if (retval) {
+-- 
+2.30.2
+
diff --git a/queue-4.9/usb-host-ohci-tmio-add-irq-check.patch b/queue-4.9/usb-host-ohci-tmio-add-irq-check.patch
new file mode 100644 (file)
index 0000000..98f9227
--- /dev/null
@@ -0,0 +1,42 @@
+From 82ccf74db62c3ce6e244b5aa26a1b72205879b93 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 13 Aug 2021 23:30:18 +0300
+Subject: usb: host: ohci-tmio: add IRQ check
+
+From: Sergey Shtylyov <s.shtylyov@omp.ru>
+
+[ Upstream commit 4ac5132e8a4300637a2da8f5d6bc7650db735b8a ]
+
+The driver neglects to check the  result of platform_get_irq()'s call and
+blithely passes the negative error codes to usb_add_hcd() (which takes
+*unsigned* IRQ #), causing request_irq() that it calls to fail with
+-EINVAL, overriding an original error code. Stop calling usb_add_hcd()
+with the invalid IRQ #s.
+
+Fixes: 78c73414f4f6 ("USB: ohci: add support for tmio-ohci cell")
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
+Link: https://lore.kernel.org/r/402e1a45-a0a4-0e08-566a-7ca1331506b1@omp.ru
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/usb/host/ohci-tmio.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
+index cfcfadfc94fc..9c9e97294c18 100644
+--- a/drivers/usb/host/ohci-tmio.c
++++ b/drivers/usb/host/ohci-tmio.c
+@@ -202,6 +202,9 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev)
+       if (!cell)
+               return -EINVAL;
++      if (irq < 0)
++              return irq;
++
+       hcd = usb_create_hcd(&ohci_tmio_hc_driver, &dev->dev, dev_name(&dev->dev));
+       if (!hcd) {
+               ret = -ENOMEM;
+-- 
+2.30.2
+
diff --git a/queue-4.9/usb-phy-fsl-usb-add-irq-check.patch b/queue-4.9/usb-phy-fsl-usb-add-irq-check.patch
new file mode 100644 (file)
index 0000000..9ade93a
--- /dev/null
@@ -0,0 +1,40 @@
+From f0745d28c59c767bf80775b08d49f63d40c069a5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Aug 2021 23:50:18 +0300
+Subject: usb: phy: fsl-usb: add IRQ check
+
+From: Sergey Shtylyov <s.shtylyov@omp.ru>
+
+[ Upstream commit ecc2f30dbb25969908115c81ec23650ed982b004 ]
+
+The driver neglects to check the result of platform_get_irq()'s call and
+blithely passes the negative error codes to request_irq() (which takes
+*unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original
+error code. Stop calling request_irq() with the invalid IRQ #s.
+
+Fixes: 0807c500a1a6 ("USB: add Freescale USB OTG Transceiver driver")
+Acked-by: Felipe Balbi <balbi@kernel.org>
+Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
+Link: https://lore.kernel.org/r/b0a86089-8b8b-122e-fd6d-73e8c2304964@omp.ru
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/usb/phy/phy-fsl-usb.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
+index 85d031ce85c1..63798de8b5ae 100644
+--- a/drivers/usb/phy/phy-fsl-usb.c
++++ b/drivers/usb/phy/phy-fsl-usb.c
+@@ -891,6 +891,8 @@ int usb_otg_start(struct platform_device *pdev)
+       /* request irq */
+       p_otg->irq = platform_get_irq(pdev, 0);
++      if (p_otg->irq < 0)
++              return p_otg->irq;
+       status = request_irq(p_otg->irq, fsl_otg_isr,
+                               IRQF_SHARED, driver_name, p_otg);
+       if (status) {
+-- 
+2.30.2
+
diff --git a/queue-4.9/usb-phy-tahvo-add-irq-check.patch b/queue-4.9/usb-phy-tahvo-add-irq-check.patch
new file mode 100644 (file)
index 0000000..add684d
--- /dev/null
@@ -0,0 +1,43 @@
+From ab3e48fab5c0f3ca9cacde96633c6a744b4ba34d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 13 Aug 2021 23:32:38 +0300
+Subject: usb: phy: tahvo: add IRQ check
+
+From: Sergey Shtylyov <s.shtylyov@omp.ru>
+
+[ Upstream commit 0d45a1373e669880b8beaecc8765f44cb0241e47 ]
+
+The driver neglects to check the result of platform_get_irq()'s call and
+blithely passes the negative error codes to request_threaded_irq() (which
+takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an
+original error code.  Stop calling request_threaded_irq() with the invalid
+IRQ #s.
+
+Fixes: 9ba96ae5074c ("usb: omap1: Tahvo USB transceiver driver")
+Acked-by: Felipe Balbi <balbi@kernel.org>
+Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
+Link: https://lore.kernel.org/r/8280d6a4-8e9a-7cfe-1aa9-db586dc9afdf@omp.ru
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/usb/phy/phy-tahvo.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
+index 335a1ef35224..ec86eedd789b 100644
+--- a/drivers/usb/phy/phy-tahvo.c
++++ b/drivers/usb/phy/phy-tahvo.c
+@@ -404,7 +404,9 @@ static int tahvo_usb_probe(struct platform_device *pdev)
+       dev_set_drvdata(&pdev->dev, tu);
+-      tu->irq = platform_get_irq(pdev, 0);
++      tu->irq = ret = platform_get_irq(pdev, 0);
++      if (ret < 0)
++              return ret;
+       ret = request_threaded_irq(tu->irq, NULL, tahvo_usb_vbus_interrupt,
+                                  IRQF_ONESHOT,
+                                  "tahvo-vbus", tu);
+-- 
+2.30.2
+
diff --git a/queue-4.9/usb-phy-twl6030-add-irq-checks.patch b/queue-4.9/usb-phy-twl6030-add-irq-checks.patch
new file mode 100644 (file)
index 0000000..5238ace
--- /dev/null
@@ -0,0 +1,44 @@
+From 636942e5ef7c46f39075b56a5fcc903c25be139f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Aug 2021 23:53:16 +0300
+Subject: usb: phy: twl6030: add IRQ checks
+
+From: Sergey Shtylyov <s.shtylyov@omp.ru>
+
+[ Upstream commit 0881e22c06e66af0b64773c91c8868ead3d01aa1 ]
+
+The driver neglects to check the result of platform_get_irq()'s calls and
+blithely passes the negative error codes to request_threaded_irq() (which
+takes *unsigned* IRQ #), causing them both to fail with -EINVAL, overriding
+an original error code.  Stop calling request_threaded_irq() with the
+invalid IRQ #s.
+
+Fixes: c33fad0c3748 ("usb: otg: Adding twl6030-usb transceiver driver for OMAP4430")
+Acked-by: Felipe Balbi <balbi@kernel.org>
+Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
+Link: https://lore.kernel.org/r/9507f50b-50f1-6dc4-f57c-3ed4e53a1c25@omp.ru
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/usb/phy/phy-twl6030-usb.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/drivers/usb/phy/phy-twl6030-usb.c b/drivers/usb/phy/phy-twl6030-usb.c
+index cf0b67433ac9..ccb36e240953 100644
+--- a/drivers/usb/phy/phy-twl6030-usb.c
++++ b/drivers/usb/phy/phy-twl6030-usb.c
+@@ -352,6 +352,11 @@ static int twl6030_usb_probe(struct platform_device *pdev)
+       twl->irq2               = platform_get_irq(pdev, 1);
+       twl->linkstat           = MUSB_UNKNOWN;
++      if (twl->irq1 < 0)
++              return twl->irq1;
++      if (twl->irq2 < 0)
++              return twl->irq2;
++
+       twl->comparator.set_vbus        = twl6030_set_vbus;
+       twl->comparator.start_srp       = twl6030_start_srp;
+-- 
+2.30.2
+