From: Sasha Levin Date: Sun, 2 Oct 2022 17:51:57 +0000 (-0400) Subject: Fixes for 4.19 X-Git-Tag: v5.19.13~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5ac169bd2bd283bfcc928a774460b04cb08767ba;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.19 Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/clk-iproc-do-not-rely-on-node-name-for-correct-pll-s.patch b/queue-4.19/clk-iproc-do-not-rely-on-node-name-for-correct-pll-s.patch new file mode 100644 index 00000000000..b9dcda0b73e --- /dev/null +++ b/queue-4.19/clk-iproc-do-not-rely-on-node-name-for-correct-pll-s.patch @@ -0,0 +1,82 @@ +From 14d0da4275c02f28978148bbf1dd2a2a05156f04 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 5 Sep 2022 09:15:03 -0700 +Subject: clk: iproc: Do not rely on node name for correct PLL setup +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Florian Fainelli + +[ Upstream commit 1b24a132eba7a1c19475ba2510ec1c00af3ff914 ] + +After commit 31fd9b79dc58 ("ARM: dts: BCM5301X: update CRU block +description") a warning from clk-iproc-pll.c was generated due to a +duplicate PLL name as well as the console stopped working. Upon closer +inspection it became clear that iproc_pll_clk_setup() used the Device +Tree node unit name as an unique identifier as well as a parent name to +parent all clocks under the PLL. + +BCM5301X was the first platform on which that got noticed because of the +DT node unit name renaming but the same assumptions hold true for any +user of the iproc_pll_clk_setup() function. + +The first 'clock-output-names' property is always guaranteed to be +unique as well as providing the actual desired PLL clock name, so we +utilize that to register the PLL and as a parent name of all children +clock. + +Fixes: 5fe225c105fd ("clk: iproc: add initial common clock support") +Signed-off-by: Florian Fainelli +Acked-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20220905161504.1526-1-f.fainelli@gmail.com +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +--- + drivers/clk/bcm/clk-iproc-pll.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pll.c +index 274441e2ddb2..8f0619f362e3 100644 +--- a/drivers/clk/bcm/clk-iproc-pll.c ++++ b/drivers/clk/bcm/clk-iproc-pll.c +@@ -736,6 +736,7 @@ void iproc_pll_clk_setup(struct device_node *node, + const char *parent_name; + struct iproc_clk *iclk_array; + struct clk_hw_onecell_data *clk_data; ++ const char *clk_name; + + if (WARN_ON(!pll_ctrl) || WARN_ON(!clk_ctrl)) + return; +@@ -783,7 +784,12 @@ void iproc_pll_clk_setup(struct device_node *node, + iclk = &iclk_array[0]; + iclk->pll = pll; + +- init.name = node->name; ++ ret = of_property_read_string_index(node, "clock-output-names", ++ 0, &clk_name); ++ if (WARN_ON(ret)) ++ goto err_pll_register; ++ ++ init.name = clk_name; + init.ops = &iproc_pll_ops; + init.flags = 0; + parent_name = of_clk_get_parent_name(node, 0); +@@ -803,13 +809,11 @@ void iproc_pll_clk_setup(struct device_node *node, + goto err_pll_register; + + clk_data->hws[0] = &iclk->hw; ++ parent_name = clk_name; + + /* now initialize and register all leaf clocks */ + for (i = 1; i < num_clks; i++) { +- const char *clk_name; +- + memset(&init, 0, sizeof(init)); +- parent_name = node->name; + + ret = of_property_read_string_index(node, "clock-output-names", + i, &clk_name); +-- +2.35.1 + diff --git a/queue-4.19/input-melfas_mip4-fix-return-value-check-in-mip4_pro.patch b/queue-4.19/input-melfas_mip4-fix-return-value-check-in-mip4_pro.patch new file mode 100644 index 00000000000..05a62e72e8f --- /dev/null +++ b/queue-4.19/input-melfas_mip4-fix-return-value-check-in-mip4_pro.patch @@ -0,0 +1,37 @@ +From 216ac215cb05df321a0f376cd6af40e1a7a51aab Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 24 Sep 2022 11:07:15 +0800 +Subject: Input: melfas_mip4 - fix return value check in mip4_probe() + +From: Yang Yingliang + +[ Upstream commit a54dc27bd25f20ee3ea2009584b3166d25178243 ] + +devm_gpiod_get_optional() may return ERR_PTR(-EPROBE_DEFER), +add a minus sign to fix it. + +Fixes: 6ccb1d8f78bd ("Input: add MELFAS MIP4 Touchscreen driver") +Signed-off-by: Yang Yingliang +Link: https://lore.kernel.org/r/20220924030715.1653538-1-yangyingliang@huawei.com +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/touchscreen/melfas_mip4.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c +index 430a2bc5f7ca..5d947e721fa5 100644 +--- a/drivers/input/touchscreen/melfas_mip4.c ++++ b/drivers/input/touchscreen/melfas_mip4.c +@@ -1462,7 +1462,7 @@ static int mip4_probe(struct i2c_client *client, const struct i2c_device_id *id) + "ce", GPIOD_OUT_LOW); + if (IS_ERR(ts->gpio_ce)) { + error = PTR_ERR(ts->gpio_ce); +- if (error != EPROBE_DEFER) ++ if (error != -EPROBE_DEFER) + dev_err(&client->dev, + "Failed to get gpio: %d\n", error); + return error; +-- +2.35.1 + diff --git a/queue-4.19/nvme-add-new-line-after-variable-declatation.patch b/queue-4.19/nvme-add-new-line-after-variable-declatation.patch new file mode 100644 index 00000000000..756a5c85ac3 --- /dev/null +++ b/queue-4.19/nvme-add-new-line-after-variable-declatation.patch @@ -0,0 +1,52 @@ +From 1ff5c4ec82a154be70bc6112c6d2c21dac999b4b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 28 Feb 2021 18:06:11 -0800 +Subject: nvme: add new line after variable declatation + +From: Chaitanya Kulkarni + +[ Upstream commit f1c772d581843e3a14bbd62ef7e40b56fc307f27 ] + +Add a new line in functions nvme_pr_preempt(), nvme_pr_clear(), and +nvme_pr_release() after variable declaration which follows the rest of +the code in the nvme/host/core.c. + +No functional change(s) in this patch. + +Signed-off-by: Chaitanya Kulkarni +Signed-off-by: Christoph Hellwig +Stable-dep-of: c292a337d0e4 ("nvme: Fix IOC_PR_CLEAR and IOC_PR_RELEASE ioctls for nvme devices") +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/core.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index a0a805a5ab6b..44ee6dc5e0ca 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -1716,18 +1716,21 @@ static int nvme_pr_preempt(struct block_device *bdev, u64 old, u64 new, + enum pr_type type, bool abort) + { + u32 cdw10 = nvme_pr_type(type) << 8 | (abort ? 2 : 1); ++ + return nvme_pr_command(bdev, cdw10, old, new, nvme_cmd_resv_acquire); + } + + static int nvme_pr_clear(struct block_device *bdev, u64 key) + { + u32 cdw10 = 1 | (key ? 1 << 3 : 0); ++ + return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_register); + } + + static int nvme_pr_release(struct block_device *bdev, u64 key, enum pr_type type) + { + u32 cdw10 = nvme_pr_type(type) << 8 | (key ? 1 << 3 : 0); ++ + return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); + } + +-- +2.35.1 + diff --git a/queue-4.19/nvme-fix-ioc_pr_clear-and-ioc_pr_release-ioctls-for-.patch b/queue-4.19/nvme-fix-ioc_pr_clear-and-ioc_pr_release-ioctls-for-.patch new file mode 100644 index 00000000000..f0c1f7a3c74 --- /dev/null +++ b/queue-4.19/nvme-fix-ioc_pr_clear-and-ioc_pr_release-ioctls-for-.patch @@ -0,0 +1,63 @@ +From a598a31171caf6768ee3c87c5a7e34243c8b3175 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 22 Sep 2022 21:49:09 -0700 +Subject: nvme: Fix IOC_PR_CLEAR and IOC_PR_RELEASE ioctls for nvme devices + +From: Michael Kelley + +[ Upstream commit c292a337d0e45a292c301e3cd51c35aa0ae91e95 ] + +The IOC_PR_CLEAR and IOC_PR_RELEASE ioctls are +non-functional on NVMe devices because the nvme_pr_clear() +and nvme_pr_release() functions set the IEKEY field incorrectly. +The IEKEY field should be set only when the key is zero (i.e, +not specified). The current code does it backwards. + +Furthermore, the NVMe spec describes the persistent +reservation "clear" function as an option on the reservation +release command. The current implementation of nvme_pr_clear() +erroneously uses the reservation register command. + +Fix these errors. Note that NVMe version 1.3 and later specify +that setting the IEKEY field will return an error of Invalid +Field in Command. The fix will set IEKEY when the key is zero, +which is appropriate as these ioctls consider a zero key to +be "unspecified", and the intention of the spec change is +to require a valid key. + +Tested on a version 1.4 PCI NVMe device in an Azure VM. + +Fixes: 1673f1f08c88 ("nvme: move block_device_operations and ns/ctrl freeing to common code") +Fixes: 1d277a637a71 ("NVMe: Add persistent reservation ops") +Signed-off-by: Michael Kelley +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/core.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index 44ee6dc5e0ca..582c3b190418 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -1722,14 +1722,14 @@ static int nvme_pr_preempt(struct block_device *bdev, u64 old, u64 new, + + static int nvme_pr_clear(struct block_device *bdev, u64 key) + { +- u32 cdw10 = 1 | (key ? 1 << 3 : 0); ++ u32 cdw10 = 1 | (key ? 0 : 1 << 3); + +- return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_register); ++ return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); + } + + static int nvme_pr_release(struct block_device *bdev, u64 key, enum pr_type type) + { +- u32 cdw10 = nvme_pr_type(type) << 8 | (key ? 1 << 3 : 0); ++ u32 cdw10 = nvme_pr_type(type) << 8 | (key ? 0 : 1 << 3); + + return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); + } +-- +2.35.1 + diff --git a/queue-4.19/revert-drm-bridge-analogix-dp-add-panel-prepare-unpr.patch b/queue-4.19/revert-drm-bridge-analogix-dp-add-panel-prepare-unpr.patch new file mode 100644 index 00000000000..a94c88ddbb4 --- /dev/null +++ b/queue-4.19/revert-drm-bridge-analogix-dp-add-panel-prepare-unpr.patch @@ -0,0 +1,88 @@ +From 42fa40c9440689bd8d1e99efb29a7b0c9c9ffabe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 22 Aug 2022 18:08:04 -0700 +Subject: Revert "drm: bridge: analogix/dp: add panel prepare/unprepare in + suspend/resume time" + +From: Brian Norris + +[ Upstream commit cc62d98bd56d45de4531844ca23913a15136c05b ] + +This reverts commit 211f276ed3d96e964d2d1106a198c7f4a4b3f4c0. + +For quite some time, core DRM helpers already ensure that any relevant +connectors/CRTCs/etc. are disabled, as well as their associated +components (e.g., bridges) when suspending the system. Thus, +analogix_dp_bridge_{enable,disable}() already get called, which in turn +call drm_panel_{prepare,unprepare}(). This makes these drm_panel_*() +calls redundant. + +Besides redundancy, there are a few problems with this handling: + +(1) drm_panel_{prepare,unprepare}() are *not* reference-counted APIs and +are not in general designed to be handled by multiple callers -- +although some panel drivers have a coarse 'prepared' flag that mitigates +some damage, at least. So at a minimum this is redundant and confusing, +but in some cases, this could be actively harmful. + +(2) The error-handling is a bit non-standard. We ignored errors in +suspend(), but handled errors in resume(). And recently, people noticed +that the clk handling is unbalanced in error paths, and getting *that* +right is not actually trivial, given the current way errors are mostly +ignored. + +(3) In the particular way analogix_dp_{suspend,resume}() get used (e.g., +in rockchip_dp_*(), as a late/early callback), we don't necessarily have +a proper PM relationship between the DP/bridge device and the panel +device. So while the DP bridge gets resumed, the panel's parent device +(e.g., platform_device) may still be suspended, and so any prepare() +calls may fail. + +So remove the superfluous, possibly-harmful suspend()/resume() handling +of panel state. + +Fixes: 211f276ed3d9 ("drm: bridge: analogix/dp: add panel prepare/unprepare in suspend/resume time") +Link: https://lore.kernel.org/all/Yv2CPBD3Picg%2FgVe@google.com/ +Signed-off-by: Brian Norris +Reviewed-by: Douglas Anderson +Signed-off-by: Douglas Anderson +Link: https://patchwork.freedesktop.org/patch/msgid/20220822180729.1.I8ac5abe3a4c1c6fd5c061686c6e883c22f69022c@changeid +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 13 ------------- + 1 file changed, 13 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +index e21c7673cd5b..57781833cae1 100644 +--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c ++++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +@@ -1690,12 +1690,6 @@ EXPORT_SYMBOL_GPL(analogix_dp_unbind); + int analogix_dp_suspend(struct analogix_dp_device *dp) + { + clk_disable_unprepare(dp->clock); +- +- if (dp->plat_data->panel) { +- if (drm_panel_unprepare(dp->plat_data->panel)) +- DRM_ERROR("failed to turnoff the panel\n"); +- } +- + return 0; + } + EXPORT_SYMBOL_GPL(analogix_dp_suspend); +@@ -1710,13 +1704,6 @@ int analogix_dp_resume(struct analogix_dp_device *dp) + return ret; + } + +- if (dp->plat_data->panel) { +- if (drm_panel_prepare(dp->plat_data->panel)) { +- DRM_ERROR("failed to setup the panel\n"); +- return -EBUSY; +- } +- } +- + return 0; + } + EXPORT_SYMBOL_GPL(analogix_dp_resume); +-- +2.35.1 + diff --git a/queue-4.19/selftests-fix-the-if-conditions-of-in-test_extra_fil.patch b/queue-4.19/selftests-fix-the-if-conditions-of-in-test_extra_fil.patch new file mode 100644 index 00000000000..8605b8868f3 --- /dev/null +++ b/queue-4.19/selftests-fix-the-if-conditions-of-in-test_extra_fil.patch @@ -0,0 +1,37 @@ +From e0d571de80b043762d19dd6fc136c25b0c7408ba Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 23 Sep 2022 15:02:37 +0800 +Subject: selftests: Fix the if conditions of in test_extra_filter() + +From: Wang Yufen + +[ Upstream commit bc7a319844891746135dc1f34ab9df78d636a3ac ] + +The socket 2 bind the addr in use, bind should fail with EADDRINUSE. So +if bind success or errno != EADDRINUSE, testcase should be failed. + +Fixes: 3ca8e4029969 ("soreuseport: BPF selection functional test") +Signed-off-by: Wang Yufen +Link: https://lore.kernel.org/r/1663916557-10730-1-git-send-email-wangyufen@huawei.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/net/reuseport_bpf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/testing/selftests/net/reuseport_bpf.c b/tools/testing/selftests/net/reuseport_bpf.c +index b5277106df1f..b0cc082fbb84 100644 +--- a/tools/testing/selftests/net/reuseport_bpf.c ++++ b/tools/testing/selftests/net/reuseport_bpf.c +@@ -330,7 +330,7 @@ static void test_extra_filter(const struct test_params p) + if (bind(fd1, addr, sockaddr_size())) + error(1, errno, "failed to bind recv socket 1"); + +- if (!bind(fd2, addr, sockaddr_size()) && errno != EADDRINUSE) ++ if (!bind(fd2, addr, sockaddr_size()) || errno != EADDRINUSE) + error(1, errno, "bind socket 2 should fail with EADDRINUSE"); + + free(addr); +-- +2.35.1 + diff --git a/queue-4.19/series b/queue-4.19/series index 81928c1d08f..17050385c47 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -12,3 +12,14 @@ mm-migrate_device.c-flush-tlb-while-holding-ptl.patch ima-have-the-lsm-free-its-audit-rule.patch ima-free-the-entire-rule-when-deleting-a-list-of-rules.patch ima-free-the-entire-rule-if-it-fails-to-parse.patch +soc-sunxi-sram-actually-claim-sram-regions.patch +soc-sunxi-sram-prevent-the-driver-from-being-unbound.patch +soc-sunxi-sram-fix-probe-function-ordering-issues.patch +soc-sunxi-sram-fix-debugfs-info-for-a64-sram-c.patch +revert-drm-bridge-analogix-dp-add-panel-prepare-unpr.patch +input-melfas_mip4-fix-return-value-check-in-mip4_pro.patch +usbnet-fix-memory-leak-in-usbnet_disconnect.patch +nvme-add-new-line-after-variable-declatation.patch +nvme-fix-ioc_pr_clear-and-ioc_pr_release-ioctls-for-.patch +selftests-fix-the-if-conditions-of-in-test_extra_fil.patch +clk-iproc-do-not-rely-on-node-name-for-correct-pll-s.patch diff --git a/queue-4.19/soc-sunxi-sram-actually-claim-sram-regions.patch b/queue-4.19/soc-sunxi-sram-actually-claim-sram-regions.patch new file mode 100644 index 00000000000..ac804d2fa86 --- /dev/null +++ b/queue-4.19/soc-sunxi-sram-actually-claim-sram-regions.patch @@ -0,0 +1,40 @@ +From 4d360806c7caca4eb4b3879a7786228280ef899d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 14 Aug 2022 23:12:40 -0500 +Subject: soc: sunxi: sram: Actually claim SRAM regions + +From: Samuel Holland + +[ Upstream commit fd362baad2e659ef0fb5652f023a606b248f1781 ] + +sunxi_sram_claim() checks the sram_desc->claimed flag before updating +the register, with the intent that only one device can claim a region. +However, this was ineffective because the flag was never set. + +Fixes: 4af34b572a85 ("drivers: soc: sunxi: Introduce SoC driver to map SRAMs") +Reviewed-by: Jernej Skrabec +Signed-off-by: Samuel Holland +Reviewed-by: Heiko Stuebner +Tested-by: Heiko Stuebner +Signed-off-by: Jernej Skrabec +Link: https://lore.kernel.org/r/20220815041248.53268-4-samuel@sholland.org +Signed-off-by: Sasha Levin +--- + drivers/soc/sunxi/sunxi_sram.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c +index b4b0f3480bd3..51148704af49 100644 +--- a/drivers/soc/sunxi/sunxi_sram.c ++++ b/drivers/soc/sunxi/sunxi_sram.c +@@ -264,6 +264,7 @@ int sunxi_sram_claim(struct device *dev) + writel(val | ((device << sram_data->offset) & mask), + base + sram_data->reg); + ++ sram_desc->claimed = true; + spin_unlock(&sram_lock); + + return 0; +-- +2.35.1 + diff --git a/queue-4.19/soc-sunxi-sram-fix-debugfs-info-for-a64-sram-c.patch b/queue-4.19/soc-sunxi-sram-fix-debugfs-info-for-a64-sram-c.patch new file mode 100644 index 00000000000..4d8bf27dfed --- /dev/null +++ b/queue-4.19/soc-sunxi-sram-fix-debugfs-info-for-a64-sram-c.patch @@ -0,0 +1,40 @@ +From 765ab1e0c83a732535df1464d7db162b120be76d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 14 Aug 2022 23:12:43 -0500 +Subject: soc: sunxi: sram: Fix debugfs info for A64 SRAM C + +From: Samuel Holland + +[ Upstream commit e3c95edb1bd8b9c2cb0caa6ae382fc8080f6a0ed ] + +The labels were backward with respect to the register values. The SRAM +is mapped to the CPU when the register value is 1. + +Fixes: 5e4fb6429761 ("drivers: soc: sunxi: add support for A64 and its SRAM C") +Acked-by: Jernej Skrabec +Signed-off-by: Samuel Holland +Signed-off-by: Jernej Skrabec +Link: https://lore.kernel.org/r/20220815041248.53268-7-samuel@sholland.org +Signed-off-by: Sasha Levin +--- + drivers/soc/sunxi/sunxi_sram.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c +index 98a4d4548a23..2c1672f9aac9 100644 +--- a/drivers/soc/sunxi/sunxi_sram.c ++++ b/drivers/soc/sunxi/sunxi_sram.c +@@ -78,8 +78,8 @@ static struct sunxi_sram_desc sun4i_a10_sram_d = { + + static struct sunxi_sram_desc sun50i_a64_sram_c = { + .data = SUNXI_SRAM_DATA("C", 0x4, 24, 1, +- SUNXI_SRAM_MAP(0, 1, "cpu"), +- SUNXI_SRAM_MAP(1, 0, "de2")), ++ SUNXI_SRAM_MAP(1, 0, "cpu"), ++ SUNXI_SRAM_MAP(0, 1, "de2")), + }; + + static const struct of_device_id sunxi_sram_dt_ids[] = { +-- +2.35.1 + diff --git a/queue-4.19/soc-sunxi-sram-fix-probe-function-ordering-issues.patch b/queue-4.19/soc-sunxi-sram-fix-probe-function-ordering-issues.patch new file mode 100644 index 00000000000..ede56ae4e80 --- /dev/null +++ b/queue-4.19/soc-sunxi-sram-fix-probe-function-ordering-issues.patch @@ -0,0 +1,74 @@ +From 46e08c1839d3949a2e09b37e85bf23b364ec7762 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 14 Aug 2022 23:12:42 -0500 +Subject: soc: sunxi: sram: Fix probe function ordering issues + +From: Samuel Holland + +[ Upstream commit 49fad91a7b8941979c3e9a35f9894ac45bc5d3d6 ] + +Errors from debugfs are intended to be non-fatal, and should not prevent +the driver from probing. + +Since debugfs file creation is treated as infallible, move it below the +parts of the probe function that can fail. This prevents an error +elsewhere in the probe function from causing the file to leak. Do the +same for the call to of_platform_populate(). + +Finally, checkpatch suggests an octal literal for the file permissions. + +Fixes: 4af34b572a85 ("drivers: soc: sunxi: Introduce SoC driver to map SRAMs") +Fixes: 5828729bebbb ("soc: sunxi: export a regmap for EMAC clock reg on A64") +Reviewed-by: Jernej Skrabec +Signed-off-by: Samuel Holland +Tested-by: Heiko Stuebner +Signed-off-by: Jernej Skrabec +Link: https://lore.kernel.org/r/20220815041248.53268-6-samuel@sholland.org +Signed-off-by: Sasha Levin +--- + drivers/soc/sunxi/sunxi_sram.c | 13 +++++-------- + 1 file changed, 5 insertions(+), 8 deletions(-) + +diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c +index 17ac818622fe..98a4d4548a23 100644 +--- a/drivers/soc/sunxi/sunxi_sram.c ++++ b/drivers/soc/sunxi/sunxi_sram.c +@@ -328,9 +328,9 @@ static struct regmap_config sunxi_sram_emac_clock_regmap = { + static int __init sunxi_sram_probe(struct platform_device *pdev) + { + struct resource *res; +- struct dentry *d; + struct regmap *emac_clock; + const struct sunxi_sramc_variant *variant; ++ struct device *dev = &pdev->dev; + + sram_dev = &pdev->dev; + +@@ -343,13 +343,6 @@ static int __init sunxi_sram_probe(struct platform_device *pdev) + if (IS_ERR(base)) + return PTR_ERR(base); + +- of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); +- +- d = debugfs_create_file("sram", S_IRUGO, NULL, NULL, +- &sunxi_sram_fops); +- if (!d) +- return -ENOMEM; +- + if (variant->has_emac_clock) { + emac_clock = devm_regmap_init_mmio(&pdev->dev, base, + &sunxi_sram_emac_clock_regmap); +@@ -358,6 +351,10 @@ static int __init sunxi_sram_probe(struct platform_device *pdev) + return PTR_ERR(emac_clock); + } + ++ of_platform_populate(dev->of_node, NULL, NULL, dev); ++ ++ debugfs_create_file("sram", 0444, NULL, NULL, &sunxi_sram_fops); ++ + return 0; + } + +-- +2.35.1 + diff --git a/queue-4.19/soc-sunxi-sram-prevent-the-driver-from-being-unbound.patch b/queue-4.19/soc-sunxi-sram-prevent-the-driver-from-being-unbound.patch new file mode 100644 index 00000000000..ff933b478c3 --- /dev/null +++ b/queue-4.19/soc-sunxi-sram-prevent-the-driver-from-being-unbound.patch @@ -0,0 +1,53 @@ +From c7db1f96028daf7a1e4d3518746f16bdd61d1850 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 14 Aug 2022 23:12:41 -0500 +Subject: soc: sunxi: sram: Prevent the driver from being unbound + +From: Samuel Holland + +[ Upstream commit 90e10a1fcd9b24b4ba8c0d35136127473dcd829e ] + +This driver exports a regmap tied to the platform device (as opposed to +a syscon, which exports a regmap tied to the OF node). Because of this, +the driver can never be unbound, as that would destroy the regmap. Use +builtin_platform_driver_probe() to enforce this limitation. + +Fixes: 5828729bebbb ("soc: sunxi: export a regmap for EMAC clock reg on A64") +Reviewed-by: Jernej Skrabec +Signed-off-by: Samuel Holland +Reviewed-by: Heiko Stuebner +Tested-by: Heiko Stuebner +Signed-off-by: Jernej Skrabec +Link: https://lore.kernel.org/r/20220815041248.53268-5-samuel@sholland.org +Signed-off-by: Sasha Levin +--- + drivers/soc/sunxi/sunxi_sram.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c +index 51148704af49..17ac818622fe 100644 +--- a/drivers/soc/sunxi/sunxi_sram.c ++++ b/drivers/soc/sunxi/sunxi_sram.c +@@ -325,7 +325,7 @@ static struct regmap_config sunxi_sram_emac_clock_regmap = { + .writeable_reg = sunxi_sram_regmap_accessible_reg, + }; + +-static int sunxi_sram_probe(struct platform_device *pdev) ++static int __init sunxi_sram_probe(struct platform_device *pdev) + { + struct resource *res; + struct dentry *d; +@@ -399,9 +399,8 @@ static struct platform_driver sunxi_sram_driver = { + .name = "sunxi-sram", + .of_match_table = sunxi_sram_dt_match, + }, +- .probe = sunxi_sram_probe, + }; +-module_platform_driver(sunxi_sram_driver); ++builtin_platform_driver_probe(sunxi_sram_driver, sunxi_sram_probe); + + MODULE_AUTHOR("Maxime Ripard "); + MODULE_DESCRIPTION("Allwinner sunXi SRAM Controller Driver"); +-- +2.35.1 + diff --git a/queue-4.19/usbnet-fix-memory-leak-in-usbnet_disconnect.patch b/queue-4.19/usbnet-fix-memory-leak-in-usbnet_disconnect.patch new file mode 100644 index 00000000000..c3167bba657 --- /dev/null +++ b/queue-4.19/usbnet-fix-memory-leak-in-usbnet_disconnect.patch @@ -0,0 +1,56 @@ +From d78f764ef2550a096144ad9dee7465dfa53f7c30 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 22 Sep 2022 21:25:51 -0700 +Subject: usbnet: Fix memory leak in usbnet_disconnect() + +From: Peilin Ye + +[ Upstream commit a43206156263fbaf1f2b7f96257441f331e91bb7 ] + +Currently usbnet_disconnect() unanchors and frees all deferred URBs +using usb_scuttle_anchored_urbs(), which does not free urb->context, +causing a memory leak as reported by syzbot. + +Use a usb_get_from_anchor() while loop instead, similar to what we did +in commit 19cfe912c37b ("Bluetooth: btusb: Fix memory leak in +play_deferred"). Also free urb->sg. + +Reported-and-tested-by: syzbot+dcd3e13cf4472f2e0ba1@syzkaller.appspotmail.com +Fixes: 69ee472f2706 ("usbnet & cdc-ether: Autosuspend for online devices") +Fixes: 638c5115a794 ("USBNET: support DMA SG") +Signed-off-by: Peilin Ye +Link: https://lore.kernel.org/r/20220923042551.2745-1-yepeilin.cs@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/usb/usbnet.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c +index 1316f5b0c0d7..2263a66f6314 100644 +--- a/drivers/net/usb/usbnet.c ++++ b/drivers/net/usb/usbnet.c +@@ -1596,6 +1596,7 @@ void usbnet_disconnect (struct usb_interface *intf) + struct usbnet *dev; + struct usb_device *xdev; + struct net_device *net; ++ struct urb *urb; + + dev = usb_get_intfdata(intf); + usb_set_intfdata(intf, NULL); +@@ -1612,7 +1613,11 @@ void usbnet_disconnect (struct usb_interface *intf) + net = dev->net; + unregister_netdev (net); + +- usb_scuttle_anchored_urbs(&dev->deferred); ++ while ((urb = usb_get_from_anchor(&dev->deferred))) { ++ dev_kfree_skb(urb->context); ++ kfree(urb->sg); ++ usb_free_urb(urb); ++ } + + if (dev->driver_info->unbind) + dev->driver_info->unbind (dev, intf); +-- +2.35.1 +