From: John Audia Date: Sat, 25 Feb 2023 21:20:28 +0000 (-0500) Subject: kernel: bump 5.10 to 5.10.169 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b88955aa2294c61f21bdf7014e10d8ea29d0c346;p=openwrt%2Fstaging%2Fneocturne.git kernel: bump 5.10 to 5.10.169 Manually rebased: backport-5.10/811-v6.1-0001-nvmem-core-Fix-memleak-in-nvmem_register.patch Removed upstreamed: backport-5.10/811-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch[1] patches-5.10/070-net-bgmac-fix-BCM5358-support-by-setting-correct-fla.patch[2] Add fix: target/linux/generic/backport-5.10/804-0001-net-Remove-WARN_ON_ONCE-sk-sk_forward_alloc-from-sk_.patch[3] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.169&id=a19a0f67dbb89ad2bfc466f2003841acba645884 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.169&id=a5c51e0c3202820192db3f3809e072f3ca2b1177 3. https://lore.kernel.org/stable/20230227211548.13923-1-kuniyu@amazon.com Signed-off-by: John Audia --- diff --git a/include/kernel-5.10 b/include/kernel-5.10 index e0bdccaf43..b2548dac88 100644 --- a/include/kernel-5.10 +++ b/include/kernel-5.10 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.10 = .168 -LINUX_KERNEL_HASH-5.10.168 = b67d2596ba8d30510f743f31899c94c43eaf006a254ff44d7fc6ea26e7ab359c +LINUX_VERSION-5.10 = .169 +LINUX_KERNEL_HASH-5.10.169 = d9754f6eb55e88214c7aaa7c4831c215f88b48da1d9b40f871b055ff56ebafcf diff --git a/target/linux/ath79/patches-5.10/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.10/910-unaligned_access_hacks.patch index 0de433914d..e1c5c59c14 100644 --- a/target/linux/ath79/patches-5.10/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.10/910-unaligned_access_hacks.patch @@ -258,7 +258,7 @@ SVN-Revision: 35130 #include #include #include -@@ -926,10 +927,10 @@ static void tcp_v6_send_response(const s +@@ -927,10 +928,10 @@ static void tcp_v6_send_response(const s topt = (__be32 *)(t1 + 1); if (tsecr) { diff --git a/target/linux/bcm47xx/patches-5.10/070-net-bgmac-fix-BCM5358-support-by-setting-correct-fla.patch b/target/linux/bcm47xx/patches-5.10/070-net-bgmac-fix-BCM5358-support-by-setting-correct-fla.patch deleted file mode 100644 index f93fc0cd8d..0000000000 --- a/target/linux/bcm47xx/patches-5.10/070-net-bgmac-fix-BCM5358-support-by-setting-correct-fla.patch +++ /dev/null @@ -1,46 +0,0 @@ -From d61615c366a489646a1bfe5b33455f916762d5f4 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 8 Feb 2023 10:16:37 +0100 -Subject: [PATCH] net: bgmac: fix BCM5358 support by setting correct flags -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Code blocks handling BCMA_CHIP_ID_BCM5357 and BCMA_CHIP_ID_BCM53572 were -incorrectly unified. Chip package values are not unique and cannot be -checked independently. They are meaningful only in a context of a given -chip. - -Packages BCM5358 and BCM47188 share the same value but then belong to -different chips. Code unification resulted in treating BCM5358 as -BCM47188 and broke its initialization. - -Link: https://github.com/openwrt/openwrt/issues/8278 -Fixes: cb1b0f90acfe ("net: ethernet: bgmac: unify code of the same family") -Cc: Jon Mason -Signed-off-by: Rafał Miłecki -Reviewed-by: Florian Fainelli -Link: https://lore.kernel.org/r/20230208091637.16291-1-zajec5@gmail.com -Signed-off-by: Jakub Kicinski ---- - drivers/net/ethernet/broadcom/bgmac-bcma.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c -+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c -@@ -240,12 +240,12 @@ static int bgmac_probe(struct bcma_devic - bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST; - bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1; - bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY; -- if (ci->pkg == BCMA_PKG_ID_BCM47188 || -- ci->pkg == BCMA_PKG_ID_BCM47186) { -+ if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == BCMA_PKG_ID_BCM47186) || -+ (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == BCMA_PKG_ID_BCM47188)) { - bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII; - bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED; - } -- if (ci->pkg == BCMA_PKG_ID_BCM5358) -+ if (ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == BCMA_PKG_ID_BCM5358) - bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_EPHYRMII; - break; - case BCMA_CHIP_ID_BCM53573: diff --git a/target/linux/generic/backport-5.10/732-v5.13-0008-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch b/target/linux/generic/backport-5.10/732-v5.13-0008-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch index 787d2cdf72..47abbd0f18 100644 --- a/target/linux/generic/backport-5.10/732-v5.13-0008-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch +++ b/target/linux/generic/backport-5.10/732-v5.13-0008-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch @@ -1360,7 +1360,7 @@ Signed-off-by: David S. Miller int irq; --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -5013,7 +5013,7 @@ int stmmac_dvr_probe(struct device *devi +@@ -5014,7 +5014,7 @@ int stmmac_dvr_probe(struct device *devi priv->wol_irq = res->wol_irq; priv->lpi_irq = res->lpi_irq; diff --git a/target/linux/generic/backport-5.10/801-v5.11-0001-nvmem-core-Add-support-for-keepout-regions.patch b/target/linux/generic/backport-5.10/801-v5.11-0001-nvmem-core-Add-support-for-keepout-regions.patch index 23879d40af..a0f8c4715e 100644 --- a/target/linux/generic/backport-5.10/801-v5.11-0001-nvmem-core-Add-support-for-keepout-regions.patch +++ b/target/linux/generic/backport-5.10/801-v5.11-0001-nvmem-core-Add-support-for-keepout-regions.patch @@ -212,9 +212,9 @@ Signed-off-by: Greg Kroah-Hartman if (!config->no_of_node) nvmem->dev.of_node = config->dev->of_node; -@@ -680,6 +819,12 @@ struct nvmem_device *nvmem_register(cons - nvmem->dev.groups = nvmem_dev_groups; - #endif +@@ -703,6 +842,12 @@ struct nvmem_device *nvmem_register(cons + if (rval) + goto err_remove_cells; + if (nvmem->nkeepout) { + rval = nvmem_validate_keepouts(nvmem); @@ -224,7 +224,7 @@ Signed-off-by: Greg Kroah-Hartman + dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); - rval = device_register(&nvmem->dev); + rval = device_add(&nvmem->dev); --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -31,6 +31,19 @@ enum nvmem_type { @@ -256,8 +256,8 @@ Signed-off-by: Greg Kroah-Hartman * @type: Type of the nvmem storage * @read_only: Device is read-only. * @root_only: Device is accessibly to root only. -@@ -67,6 +82,8 @@ struct nvmem_config { - struct gpio_desc *wp_gpio; +@@ -65,6 +80,8 @@ struct nvmem_config { + struct module *owner; const struct nvmem_cell_info *cells; int ncells; + const struct nvmem_keepout *keepout; diff --git a/target/linux/generic/backport-5.10/803-v5.13-0004-nvmem-core-Add-functions-to-make-number-reading-easy.patch b/target/linux/generic/backport-5.10/803-v5.13-0004-nvmem-core-Add-functions-to-make-number-reading-easy.patch index ff2456722f..f791aea8ae 100644 --- a/target/linux/generic/backport-5.10/803-v5.13-0004-nvmem-core-Add-functions-to-make-number-reading-easy.patch +++ b/target/linux/generic/backport-5.10/803-v5.13-0004-nvmem-core-Add-functions-to-make-number-reading-easy.patch @@ -57,7 +57,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -1612,6 +1612,101 @@ int nvmem_cell_read_u64(struct device *d +@@ -1613,6 +1613,101 @@ int nvmem_cell_read_u64(struct device *d } EXPORT_SYMBOL_GPL(nvmem_cell_read_u64); diff --git a/target/linux/generic/backport-5.10/803-v5.13-0005-nvmem-core-Fix-unintentional-sign-extension-issue.patch b/target/linux/generic/backport-5.10/803-v5.13-0005-nvmem-core-Fix-unintentional-sign-extension-issue.patch index 72133d3a35..958dc65073 100644 --- a/target/linux/generic/backport-5.10/803-v5.13-0005-nvmem-core-Fix-unintentional-sign-extension-issue.patch +++ b/target/linux/generic/backport-5.10/803-v5.13-0005-nvmem-core-Fix-unintentional-sign-extension-issue.patch @@ -23,7 +23,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -1699,7 +1699,7 @@ int nvmem_cell_read_variable_le_u64(stru +@@ -1700,7 +1700,7 @@ int nvmem_cell_read_variable_le_u64(stru /* Copy w/ implicit endian conversion */ *val = 0; for (i = 0; i < len; i++) diff --git a/target/linux/generic/backport-5.10/804-0001-net-Remove-WARN_ON_ONCE-sk-sk_forward_alloc-from-sk_.patch b/target/linux/generic/backport-5.10/804-0001-net-Remove-WARN_ON_ONCE-sk-sk_forward_alloc-from-sk_.patch new file mode 100644 index 0000000000..74c01ec5a5 --- /dev/null +++ b/target/linux/generic/backport-5.10/804-0001-net-Remove-WARN_ON_ONCE-sk-sk_forward_alloc-from-sk_.patch @@ -0,0 +1,98 @@ +From 35cd2598c910ad6a1cc8bd3f731429b1901abc63 Mon Sep 17 00:00:00 2001 +From: Kuniyuki Iwashima +Date: Mon, 27 Feb 2023 13:15:48 -0800 +Subject: [PATCH] net: Remove WARN_ON_ONCE(sk->sk_forward_alloc) from + sk_stream_kill_queues(). + +commit 62ec33b44e0f7168ff2886520fec6fb62d03b5a3 upstream. + +Christoph Paasch reported that commit b5fc29233d28 ("inet6: Remove +inet6_destroy_sock() in sk->sk_prot->destroy().") started triggering +WARN_ON_ONCE(sk->sk_forward_alloc) in sk_stream_kill_queues(). [0 - 2] +Also, we can reproduce it by a program in [3]. + +In the commit, we delay freeing ipv6_pinfo.pktoptions from sk->destroy() +to sk->sk_destruct(), so sk->sk_forward_alloc is no longer zero in +inet_csk_destroy_sock(). + +The same check has been in inet_sock_destruct() from at least v2.6, +we can just remove the WARN_ON_ONCE(). However, among the users of +sk_stream_kill_queues(), only CAIF is not calling inet_sock_destruct(). +Thus, we add the same WARN_ON_ONCE() to caif_sock_destructor(). + +[0]: https://lore.kernel.org/netdev/39725AB4-88F1-41B3-B07F-949C5CAEFF4F@icloud.com/ +[1]: https://github.com/multipath-tcp/mptcp_net-next/issues/341 +[2]: +WARNING: CPU: 0 PID: 3232 at net/core/stream.c:212 sk_stream_kill_queues+0x2f9/0x3e0 +Modules linked in: +CPU: 0 PID: 3232 Comm: syz-executor.0 Not tainted 6.2.0-rc5ab24eb4698afbe147b424149c529e2a43ec24eb5 #2 +Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 +RIP: 0010:sk_stream_kill_queues+0x2f9/0x3e0 +Code: 03 0f b6 04 02 84 c0 74 08 3c 03 0f 8e ec 00 00 00 8b ab 08 01 00 00 e9 60 ff ff ff e8 d0 5f b6 fe 0f 0b eb 97 e8 c7 5f b6 fe <0f> 0b eb a0 e8 be 5f b6 fe 0f 0b e9 6a fe ff ff e8 02 07 e3 fe e9 +RSP: 0018:ffff88810570fc68 EFLAGS: 00010293 +RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 +RDX: ffff888101f38f40 RSI: ffffffff8285e529 RDI: 0000000000000005 +RBP: 0000000000000ce0 R08: 0000000000000005 R09: 0000000000000000 +R10: 0000000000000ce0 R11: 0000000000000001 R12: ffff8881009e9488 +R13: ffffffff84af2cc0 R14: 0000000000000000 R15: ffff8881009e9458 +FS: 00007f7fdfbd5800(0000) GS:ffff88811b600000(0000) knlGS:0000000000000000 +CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +CR2: 0000001b32923000 CR3: 00000001062fc006 CR4: 0000000000170ef0 +Call Trace: + + inet_csk_destroy_sock+0x1a1/0x320 + __tcp_close+0xab6/0xe90 + tcp_close+0x30/0xc0 + inet_release+0xe9/0x1f0 + inet6_release+0x4c/0x70 + __sock_release+0xd2/0x280 + sock_close+0x15/0x20 + __fput+0x252/0xa20 + task_work_run+0x169/0x250 + exit_to_user_mode_prepare+0x113/0x120 + syscall_exit_to_user_mode+0x1d/0x40 + do_syscall_64+0x48/0x90 + entry_SYSCALL_64_after_hwframe+0x72/0xdc +RIP: 0033:0x7f7fdf7ae28d +Code: c1 20 00 00 75 10 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 ee fb ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 37 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01 +RSP: 002b:00000000007dfbb0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 +RAX: 0000000000000000 RBX: 0000000000000004 RCX: 00007f7fdf7ae28d +RDX: 0000000000000000 RSI: ffffffffffffffff RDI: 0000000000000003 +RBP: 0000000000000000 R08: 000000007f338e0f R09: 0000000000000e0f +R10: 000000007f338e13 R11: 0000000000000293 R12: 00007f7fdefff000 +R13: 00007f7fdefffcd8 R14: 00007f7fdefffce0 R15: 00007f7fdefffcd8 + + +[3]: https://lore.kernel.org/netdev/20230208004245.83497-1-kuniyu@amazon.com/ + +Fixes: b5fc29233d28 ("inet6: Remove inet6_destroy_sock() in sk->sk_prot->destroy().") +Reported-by: syzbot +Reported-by: Christoph Paasch +Signed-off-by: Kuniyuki Iwashima +Reviewed-by: Eric Dumazet +Signed-off-by: Jakub Kicinski +--- + net/caif/caif_socket.c | 1 + + net/core/stream.c | 1 - + 2 files changed, 1 insertion(+), 1 deletion(-) + +--- a/net/caif/caif_socket.c ++++ b/net/caif/caif_socket.c +@@ -1020,6 +1020,7 @@ static void caif_sock_destructor(struct + return; + } + sk_stream_kill_queues(&cf_sk->sk); ++ WARN_ON(sk->sk_forward_alloc); + caif_free_client(&cf_sk->layer); + } + +--- a/net/core/stream.c ++++ b/net/core/stream.c +@@ -209,7 +209,6 @@ void sk_stream_kill_queues(struct sock * + sk_mem_reclaim(sk); + + WARN_ON(sk->sk_wmem_queued); +- WARN_ON(sk->sk_forward_alloc); + + /* It is _impossible_ for the backlog to contain anything + * when we get here. All user references to this socket diff --git a/target/linux/generic/backport-5.10/804-v5.14-0001-nvmem-core-allow-specifying-of_node.patch b/target/linux/generic/backport-5.10/804-v5.14-0001-nvmem-core-allow-specifying-of_node.patch index 5889e61910..f3debe84f3 100644 --- a/target/linux/generic/backport-5.10/804-v5.14-0001-nvmem-core-allow-specifying-of_node.patch +++ b/target/linux/generic/backport-5.10/804-v5.14-0001-nvmem-core-allow-specifying-of_node.patch @@ -70,7 +70,7 @@ Link: https://lore.kernel.org/linux-mtd/20210424110608.15748-2-michael@walle.cc * @no_of_node: Device should not use the parent's of_node even if it's !NULL. * @reg_read: Callback to read data. * @reg_write: Callback to write data. -@@ -87,6 +88,7 @@ struct nvmem_config { +@@ -85,6 +86,7 @@ struct nvmem_config { enum nvmem_type type; bool read_only; bool root_only; diff --git a/target/linux/generic/backport-5.10/804-v5.14-0005-nvmem-core-constify-nvmem_cell_read_variable_common-.patch b/target/linux/generic/backport-5.10/804-v5.14-0005-nvmem-core-constify-nvmem_cell_read_variable_common-.patch index 55c3c5d6fe..3162a5362e 100644 --- a/target/linux/generic/backport-5.10/804-v5.14-0005-nvmem-core-constify-nvmem_cell_read_variable_common-.patch +++ b/target/linux/generic/backport-5.10/804-v5.14-0005-nvmem-core-constify-nvmem_cell_read_variable_common-.patch @@ -19,7 +19,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -1614,9 +1614,9 @@ int nvmem_cell_read_u64(struct device *d +@@ -1615,9 +1615,9 @@ int nvmem_cell_read_u64(struct device *d } EXPORT_SYMBOL_GPL(nvmem_cell_read_u64); @@ -32,7 +32,7 @@ Signed-off-by: Greg Kroah-Hartman { struct nvmem_cell *cell; int nbits; -@@ -1660,7 +1660,7 @@ int nvmem_cell_read_variable_le_u32(stru +@@ -1661,7 +1661,7 @@ int nvmem_cell_read_variable_le_u32(stru u32 *val) { size_t len; @@ -41,7 +41,7 @@ Signed-off-by: Greg Kroah-Hartman int i; buf = nvmem_cell_read_variable_common(dev, cell_id, sizeof(*val), &len); -@@ -1691,7 +1691,7 @@ int nvmem_cell_read_variable_le_u64(stru +@@ -1692,7 +1692,7 @@ int nvmem_cell_read_variable_le_u64(stru u64 *val) { size_t len; diff --git a/target/linux/generic/backport-5.10/805-v5.15-0003-nvmem-core-fix-error-handling-while-validating-keepo.patch b/target/linux/generic/backport-5.10/805-v5.15-0003-nvmem-core-fix-error-handling-while-validating-keepo.patch index e5342e79d3..7951cc7300 100644 --- a/target/linux/generic/backport-5.10/805-v5.15-0003-nvmem-core-fix-error-handling-while-validating-keepo.patch +++ b/target/linux/generic/backport-5.10/805-v5.15-0003-nvmem-core-fix-error-handling-while-validating-keepo.patch @@ -20,7 +20,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -827,8 +827,11 @@ struct nvmem_device *nvmem_register(cons +@@ -850,8 +850,11 @@ struct nvmem_device *nvmem_register(cons if (nvmem->nkeepout) { rval = nvmem_validate_keepouts(nvmem); diff --git a/target/linux/generic/backport-5.10/806-v5.16-0001-nvmem-core-rework-nvmem-cell-instance-creation.patch b/target/linux/generic/backport-5.10/806-v5.16-0001-nvmem-core-rework-nvmem-cell-instance-creation.patch index fca7c5f848..0b87172b2d 100644 --- a/target/linux/generic/backport-5.10/806-v5.16-0001-nvmem-core-rework-nvmem-cell-instance-creation.patch +++ b/target/linux/generic/backport-5.10/806-v5.16-0001-nvmem-core-rework-nvmem-cell-instance-creation.patch @@ -206,7 +206,7 @@ Signed-off-by: Greg Kroah-Hartman } return 0; -@@ -1144,9 +1146,33 @@ struct nvmem_device *devm_nvmem_device_g +@@ -1145,9 +1147,33 @@ struct nvmem_device *devm_nvmem_device_g } EXPORT_SYMBOL_GPL(devm_nvmem_device_get); @@ -240,7 +240,7 @@ Signed-off-by: Greg Kroah-Hartman struct nvmem_cell *cell = ERR_PTR(-ENOENT); struct nvmem_cell_lookup *lookup; struct nvmem_device *nvmem; -@@ -1171,11 +1197,15 @@ nvmem_cell_get_from_lookup(struct device +@@ -1172,11 +1198,15 @@ nvmem_cell_get_from_lookup(struct device break; } @@ -259,7 +259,7 @@ Signed-off-by: Greg Kroah-Hartman } break; } -@@ -1186,10 +1216,10 @@ nvmem_cell_get_from_lookup(struct device +@@ -1187,10 +1217,10 @@ nvmem_cell_get_from_lookup(struct device } #if IS_ENABLED(CONFIG_OF) @@ -273,7 +273,7 @@ Signed-off-by: Greg Kroah-Hartman mutex_lock(&nvmem_mutex); list_for_each_entry(iter, &nvmem->cells, node) { -@@ -1219,6 +1249,7 @@ struct nvmem_cell *of_nvmem_cell_get(str +@@ -1220,6 +1250,7 @@ struct nvmem_cell *of_nvmem_cell_get(str { struct device_node *cell_np, *nvmem_np; struct nvmem_device *nvmem; @@ -281,7 +281,7 @@ Signed-off-by: Greg Kroah-Hartman struct nvmem_cell *cell; int index = 0; -@@ -1239,12 +1270,16 @@ struct nvmem_cell *of_nvmem_cell_get(str +@@ -1240,12 +1271,16 @@ struct nvmem_cell *of_nvmem_cell_get(str if (IS_ERR(nvmem)) return ERR_CAST(nvmem); @@ -300,7 +300,7 @@ Signed-off-by: Greg Kroah-Hartman return cell; } EXPORT_SYMBOL_GPL(of_nvmem_cell_get); -@@ -1350,13 +1385,17 @@ EXPORT_SYMBOL(devm_nvmem_cell_put); +@@ -1351,13 +1386,17 @@ EXPORT_SYMBOL(devm_nvmem_cell_put); */ void nvmem_cell_put(struct nvmem_cell *cell) { @@ -320,7 +320,7 @@ Signed-off-by: Greg Kroah-Hartman { u8 *p, *b; int i, extra, bit_offset = cell->bit_offset; -@@ -1390,8 +1429,8 @@ static void nvmem_shift_read_buffer_in_p +@@ -1391,8 +1430,8 @@ static void nvmem_shift_read_buffer_in_p } static int __nvmem_cell_read(struct nvmem_device *nvmem, @@ -331,7 +331,7 @@ Signed-off-by: Greg Kroah-Hartman { int rc; -@@ -1422,18 +1461,18 @@ static int __nvmem_cell_read(struct nvme +@@ -1423,18 +1462,18 @@ static int __nvmem_cell_read(struct nvme */ void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len) { @@ -353,7 +353,7 @@ Signed-off-by: Greg Kroah-Hartman if (rc) { kfree(buf); return ERR_PTR(rc); -@@ -1443,7 +1482,7 @@ void *nvmem_cell_read(struct nvmem_cell +@@ -1444,7 +1483,7 @@ void *nvmem_cell_read(struct nvmem_cell } EXPORT_SYMBOL_GPL(nvmem_cell_read); @@ -362,7 +362,7 @@ Signed-off-by: Greg Kroah-Hartman u8 *_buf, int len) { struct nvmem_device *nvmem = cell->nvmem; -@@ -1496,16 +1535,7 @@ err: +@@ -1497,16 +1536,7 @@ err: return ERR_PTR(rc); } @@ -380,7 +380,7 @@ Signed-off-by: Greg Kroah-Hartman { struct nvmem_device *nvmem = cell->nvmem; int rc; -@@ -1531,6 +1561,21 @@ int nvmem_cell_write(struct nvmem_cell * +@@ -1532,6 +1562,21 @@ int nvmem_cell_write(struct nvmem_cell * return len; } @@ -402,7 +402,7 @@ Signed-off-by: Greg Kroah-Hartman EXPORT_SYMBOL_GPL(nvmem_cell_write); static int nvmem_cell_read_common(struct device *dev, const char *cell_id, -@@ -1633,7 +1678,7 @@ static const void *nvmem_cell_read_varia +@@ -1634,7 +1679,7 @@ static const void *nvmem_cell_read_varia if (IS_ERR(cell)) return cell; @@ -411,7 +411,7 @@ Signed-off-by: Greg Kroah-Hartman buf = nvmem_cell_read(cell, len); nvmem_cell_put(cell); if (IS_ERR(buf)) -@@ -1729,18 +1774,18 @@ EXPORT_SYMBOL_GPL(nvmem_cell_read_variab +@@ -1730,18 +1775,18 @@ EXPORT_SYMBOL_GPL(nvmem_cell_read_variab ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem, struct nvmem_cell_info *info, void *buf) { @@ -433,7 +433,7 @@ Signed-off-by: Greg Kroah-Hartman if (rc) return rc; -@@ -1760,17 +1805,17 @@ EXPORT_SYMBOL_GPL(nvmem_device_cell_read +@@ -1761,17 +1806,17 @@ EXPORT_SYMBOL_GPL(nvmem_device_cell_read int nvmem_device_cell_write(struct nvmem_device *nvmem, struct nvmem_cell_info *info, void *buf) { diff --git a/target/linux/generic/backport-5.10/806-v5.16-0002-nvmem-core-add-nvmem-cell-post-processing-callback.patch b/target/linux/generic/backport-5.10/806-v5.16-0002-nvmem-core-add-nvmem-cell-post-processing-callback.patch index a5d4ace4e5..16eb07147e 100644 --- a/target/linux/generic/backport-5.10/806-v5.16-0002-nvmem-core-add-nvmem-cell-post-processing-callback.patch +++ b/target/linux/generic/backport-5.10/806-v5.16-0002-nvmem-core-add-nvmem-cell-post-processing-callback.patch @@ -38,7 +38,7 @@ Signed-off-by: Greg Kroah-Hartman nvmem->keepout = config->keepout; nvmem->nkeepout = config->nkeepout; if (config->of_node) -@@ -1443,6 +1445,13 @@ static int __nvmem_cell_read(struct nvme +@@ -1444,6 +1446,13 @@ static int __nvmem_cell_read(struct nvme if (cell->bit_offset || cell->nbits) nvmem_shift_read_buffer_in_place(cell, buf); @@ -72,7 +72,7 @@ Signed-off-by: Greg Kroah-Hartman * @size: Device size. * @word_size: Minimum read/write access granularity. * @stride: Minimum read/write access stride. -@@ -94,6 +98,7 @@ struct nvmem_config { +@@ -92,6 +96,7 @@ struct nvmem_config { bool no_of_node; nvmem_reg_read_t reg_read; nvmem_reg_write_t reg_write; diff --git a/target/linux/generic/backport-5.10/808-v5.18-0001-nvmem-core-Remove-unused-devm_nvmem_unregister.patch b/target/linux/generic/backport-5.10/808-v5.18-0001-nvmem-core-Remove-unused-devm_nvmem_unregister.patch index 2005493dc0..3fc5393fa9 100644 --- a/target/linux/generic/backport-5.10/808-v5.18-0001-nvmem-core-Remove-unused-devm_nvmem_unregister.patch +++ b/target/linux/generic/backport-5.10/808-v5.18-0001-nvmem-core-Remove-unused-devm_nvmem_unregister.patch @@ -17,7 +17,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -945,28 +945,6 @@ struct nvmem_device *devm_nvmem_register +@@ -946,28 +946,6 @@ struct nvmem_device *devm_nvmem_register } EXPORT_SYMBOL_GPL(devm_nvmem_register); @@ -48,7 +48,7 @@ Signed-off-by: Greg Kroah-Hartman { --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h -@@ -135,8 +135,6 @@ void nvmem_unregister(struct nvmem_devic +@@ -133,8 +133,6 @@ void nvmem_unregister(struct nvmem_devic struct nvmem_device *devm_nvmem_register(struct device *dev, const struct nvmem_config *cfg); @@ -57,7 +57,7 @@ Signed-off-by: Greg Kroah-Hartman void nvmem_add_cell_table(struct nvmem_cell_table *table); void nvmem_del_cell_table(struct nvmem_cell_table *table); -@@ -155,12 +153,6 @@ devm_nvmem_register(struct device *dev, +@@ -153,12 +151,6 @@ devm_nvmem_register(struct device *dev, return nvmem_register(c); } diff --git a/target/linux/generic/backport-5.10/808-v5.18-0002-nvmem-core-Use-devm_add_action_or_reset.patch b/target/linux/generic/backport-5.10/808-v5.18-0002-nvmem-core-Use-devm_add_action_or_reset.patch index 01a1cdb2b3..39c0525832 100644 --- a/target/linux/generic/backport-5.10/808-v5.18-0002-nvmem-core-Use-devm_add_action_or_reset.patch +++ b/target/linux/generic/backport-5.10/808-v5.18-0002-nvmem-core-Use-devm_add_action_or_reset.patch @@ -16,7 +16,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -907,9 +907,9 @@ void nvmem_unregister(struct nvmem_devic +@@ -908,9 +908,9 @@ void nvmem_unregister(struct nvmem_devic } EXPORT_SYMBOL_GPL(nvmem_unregister); @@ -28,7 +28,7 @@ Signed-off-by: Greg Kroah-Hartman } /** -@@ -926,20 +926,16 @@ static void devm_nvmem_release(struct de +@@ -927,20 +927,16 @@ static void devm_nvmem_release(struct de struct nvmem_device *devm_nvmem_register(struct device *dev, const struct nvmem_config *config) { diff --git a/target/linux/generic/backport-5.10/808-v5.18-0003-nvmem-core-Check-input-parameter-for-NULL-in-nvmem_u.patch b/target/linux/generic/backport-5.10/808-v5.18-0003-nvmem-core-Check-input-parameter-for-NULL-in-nvmem_u.patch index 3a806fe622..01170d3d09 100644 --- a/target/linux/generic/backport-5.10/808-v5.18-0003-nvmem-core-Check-input-parameter-for-NULL-in-nvmem_u.patch +++ b/target/linux/generic/backport-5.10/808-v5.18-0003-nvmem-core-Check-input-parameter-for-NULL-in-nvmem_u.patch @@ -18,7 +18,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -903,7 +903,8 @@ static void nvmem_device_release(struct +@@ -904,7 +904,8 @@ static void nvmem_device_release(struct */ void nvmem_unregister(struct nvmem_device *nvmem) { diff --git a/target/linux/generic/backport-5.10/811-v6.1-0001-nvmem-core-Fix-memleak-in-nvmem_register.patch b/target/linux/generic/backport-5.10/811-v6.1-0001-nvmem-core-Fix-memleak-in-nvmem_register.patch index 698e737973..561af91893 100644 --- a/target/linux/generic/backport-5.10/811-v6.1-0001-nvmem-core-Fix-memleak-in-nvmem_register.patch +++ b/target/linux/generic/backport-5.10/811-v6.1-0001-nvmem-core-Fix-memleak-in-nvmem_register.patch @@ -22,10 +22,23 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -830,21 +830,18 @@ struct nvmem_device *nvmem_register(cons +@@ -833,6 +833,12 @@ struct nvmem_device *nvmem_register(cons nvmem->dev.groups = nvmem_dev_groups; #endif ++ if (nvmem->nkeepout) { ++ rval = nvmem_validate_keepouts(nvmem); ++ if (rval) ++ goto err_put_device; ++ } ++ + if (config->compat) { + rval = nvmem_sysfs_setup_compat(nvmem, config); + if (rval) +@@ -853,15 +859,6 @@ struct nvmem_device *nvmem_register(cons + if (rval) + goto err_remove_cells; + - if (nvmem->nkeepout) { - rval = nvmem_validate_keepouts(nvmem); - if (rval) { @@ -37,16 +50,4 @@ Signed-off-by: Greg Kroah-Hartman - dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); - rval = device_register(&nvmem->dev); - if (rval) - goto err_put_device; - -+ if (nvmem->nkeepout) { -+ rval = nvmem_validate_keepouts(nvmem); -+ if (rval) -+ goto err_device_del; -+ } -+ - if (config->compat) { - rval = nvmem_sysfs_setup_compat(nvmem, config); - if (rval) + rval = device_add(&nvmem->dev); diff --git a/target/linux/generic/backport-5.10/811-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch b/target/linux/generic/backport-5.10/811-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch deleted file mode 100644 index 322a1f6b55..0000000000 --- a/target/linux/generic/backport-5.10/811-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 5544e90c81261e82e02bbf7c6015a4b9c8c825ef Mon Sep 17 00:00:00 2001 -From: Gaosheng Cui -Date: Fri, 16 Sep 2022 13:20:50 +0100 -Subject: [PATCH] nvmem: core: add error handling for dev_set_name - -The type of return value of dev_set_name is int, which may return -wrong result, so we add error handling for it to reclaim memory -of nvmem resource, and return early when an error occurs. - -Signed-off-by: Gaosheng Cui -Signed-off-by: Srinivas Kandagatla -Link: https://lore.kernel.org/r/20220916122100.170016-4-srinivas.kandagatla@linaro.org -Signed-off-by: Greg Kroah-Hartman ---- - drivers/nvmem/core.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - ---- a/drivers/nvmem/core.c -+++ b/drivers/nvmem/core.c -@@ -811,18 +811,24 @@ struct nvmem_device *nvmem_register(cons - - switch (config->id) { - case NVMEM_DEVID_NONE: -- dev_set_name(&nvmem->dev, "%s", config->name); -+ rval = dev_set_name(&nvmem->dev, "%s", config->name); - break; - case NVMEM_DEVID_AUTO: -- dev_set_name(&nvmem->dev, "%s%d", config->name, nvmem->id); -+ rval = dev_set_name(&nvmem->dev, "%s%d", config->name, nvmem->id); - break; - default: -- dev_set_name(&nvmem->dev, "%s%d", -+ rval = dev_set_name(&nvmem->dev, "%s%d", - config->name ? : "nvmem", - config->name ? config->id : nvmem->id); - break; - } - -+ if (rval) { -+ ida_free(&nvmem_ida, nvmem->id); -+ kfree(nvmem); -+ return ERR_PTR(rval); -+ } -+ - nvmem->read_only = device_property_present(config->dev, "read-only") || - config->read_only || !nvmem->reg_write; - diff --git a/target/linux/generic/backport-5.10/812-v6.2-0013-nvmem-core-fix-device-node-refcounting.patch b/target/linux/generic/backport-5.10/812-v6.2-0013-nvmem-core-fix-device-node-refcounting.patch index 53a8fed7ad..a229c303ad 100644 --- a/target/linux/generic/backport-5.10/812-v6.2-0013-nvmem-core-fix-device-node-refcounting.patch +++ b/target/linux/generic/backport-5.10/812-v6.2-0013-nvmem-core-fix-device-node-refcounting.patch @@ -21,7 +21,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -1242,16 +1242,21 @@ struct nvmem_cell *of_nvmem_cell_get(str +@@ -1237,16 +1237,21 @@ struct nvmem_cell *of_nvmem_cell_get(str if (!cell_np) return ERR_PTR(-ENOENT); diff --git a/target/linux/generic/backport-5.10/813-v6.3-0002-nvmem-core-add-an-index-parameter-to-the-cell.patch b/target/linux/generic/backport-5.10/813-v6.3-0002-nvmem-core-add-an-index-parameter-to-the-cell.patch index b512085598..454d3bf0ed 100644 --- a/target/linux/generic/backport-5.10/813-v6.3-0002-nvmem-core-add-an-index-parameter-to-the-cell.patch +++ b/target/linux/generic/backport-5.10/813-v6.3-0002-nvmem-core-add-an-index-parameter-to-the-cell.patch @@ -47,7 +47,7 @@ Signed-off-by: Greg Kroah-Hartman }; static DEFINE_MUTEX(nvmem_mutex); -@@ -1127,7 +1128,8 @@ struct nvmem_device *devm_nvmem_device_g +@@ -1122,7 +1123,8 @@ struct nvmem_device *devm_nvmem_device_g } EXPORT_SYMBOL_GPL(devm_nvmem_device_get); @@ -57,7 +57,7 @@ Signed-off-by: Greg Kroah-Hartman { struct nvmem_cell *cell; const char *name = NULL; -@@ -1146,6 +1148,7 @@ static struct nvmem_cell *nvmem_create_c +@@ -1141,6 +1143,7 @@ static struct nvmem_cell *nvmem_create_c cell->id = name; cell->entry = entry; @@ -65,7 +65,7 @@ Signed-off-by: Greg Kroah-Hartman return cell; } -@@ -1184,7 +1187,7 @@ nvmem_cell_get_from_lookup(struct device +@@ -1179,7 +1182,7 @@ nvmem_cell_get_from_lookup(struct device __nvmem_device_put(nvmem); cell = ERR_PTR(-ENOENT); } else { @@ -74,7 +74,7 @@ Signed-off-by: Greg Kroah-Hartman if (IS_ERR(cell)) __nvmem_device_put(nvmem); } -@@ -1232,15 +1235,27 @@ struct nvmem_cell *of_nvmem_cell_get(str +@@ -1227,15 +1230,27 @@ struct nvmem_cell *of_nvmem_cell_get(str struct nvmem_device *nvmem; struct nvmem_cell_entry *cell_entry; struct nvmem_cell *cell; @@ -105,7 +105,7 @@ Signed-off-by: Greg Kroah-Hartman nvmem_np = of_get_parent(cell_np); if (!nvmem_np) { -@@ -1262,7 +1277,7 @@ struct nvmem_cell *of_nvmem_cell_get(str +@@ -1257,7 +1272,7 @@ struct nvmem_cell *of_nvmem_cell_get(str return ERR_PTR(-ENOENT); } @@ -114,7 +114,7 @@ Signed-off-by: Greg Kroah-Hartman if (IS_ERR(cell)) __nvmem_device_put(nvmem); -@@ -1415,8 +1430,8 @@ static void nvmem_shift_read_buffer_in_p +@@ -1410,8 +1425,8 @@ static void nvmem_shift_read_buffer_in_p } static int __nvmem_cell_read(struct nvmem_device *nvmem, @@ -125,7 +125,7 @@ Signed-off-by: Greg Kroah-Hartman { int rc; -@@ -1430,7 +1445,7 @@ static int __nvmem_cell_read(struct nvme +@@ -1425,7 +1440,7 @@ static int __nvmem_cell_read(struct nvme nvmem_shift_read_buffer_in_place(cell, buf); if (nvmem->cell_post_process) { @@ -134,7 +134,7 @@ Signed-off-by: Greg Kroah-Hartman cell->offset, buf, cell->bytes); if (rc) return rc; -@@ -1465,7 +1480,7 @@ void *nvmem_cell_read(struct nvmem_cell +@@ -1460,7 +1475,7 @@ void *nvmem_cell_read(struct nvmem_cell if (!buf) return ERR_PTR(-ENOMEM); @@ -143,7 +143,7 @@ Signed-off-by: Greg Kroah-Hartman if (rc) { kfree(buf); return ERR_PTR(rc); -@@ -1778,7 +1793,7 @@ ssize_t nvmem_device_cell_read(struct nv +@@ -1773,7 +1788,7 @@ ssize_t nvmem_device_cell_read(struct nv if (rc) return rc; diff --git a/target/linux/generic/backport-5.10/813-v6.3-0005-nvmem-core-add-nvmem_add_one_cell.patch b/target/linux/generic/backport-5.10/813-v6.3-0005-nvmem-core-add-nvmem_add_one_cell.patch index 2f3d5bb1f2..711ce229b2 100644 --- a/target/linux/generic/backport-5.10/813-v6.3-0005-nvmem-core-add-nvmem_add_one_cell.patch +++ b/target/linux/generic/backport-5.10/813-v6.3-0005-nvmem-core-add-nvmem_add_one_cell.patch @@ -98,7 +98,7 @@ Signed-off-by: Greg Kroah-Hartman /** --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h -@@ -155,6 +155,9 @@ struct nvmem_device *devm_nvmem_register +@@ -153,6 +153,9 @@ struct nvmem_device *devm_nvmem_register void nvmem_add_cell_table(struct nvmem_cell_table *table); void nvmem_del_cell_table(struct nvmem_cell_table *table); @@ -108,7 +108,7 @@ Signed-off-by: Greg Kroah-Hartman #else static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c) -@@ -172,6 +175,11 @@ devm_nvmem_register(struct device *dev, +@@ -170,6 +173,11 @@ devm_nvmem_register(struct device *dev, static inline void nvmem_add_cell_table(struct nvmem_cell_table *table) {} static inline void nvmem_del_cell_table(struct nvmem_cell_table *table) {} diff --git a/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch b/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch index 907fcf832b..896dddc14b 100644 --- a/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch +++ b/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch @@ -29,7 +29,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -5046,6 +5046,10 @@ int stmmac_dvr_probe(struct device *devi +@@ -5047,6 +5047,10 @@ int stmmac_dvr_probe(struct device *devi reset_control_reset(priv->plat->stmmac_rst); } @@ -40,7 +40,7 @@ Signed-off-by: David S. Miller /* Init MAC and get the capabilities */ ret = stmmac_hw_init(priv); if (ret) -@@ -5260,6 +5264,7 @@ int stmmac_dvr_remove(struct device *dev +@@ -5261,6 +5265,7 @@ int stmmac_dvr_remove(struct device *dev phylink_destroy(priv->phylink); if (priv->plat->stmmac_rst) reset_control_assert(priv->plat->stmmac_rst);