From: Sasha Levin Date: Wed, 18 Jan 2023 20:22:23 +0000 (-0500) Subject: Fixes for 5.4 X-Git-Tag: v4.14.304~59 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dd0549ca01b40629c78381779e2985f23737ed1f;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/f2fs-let-s-avoid-panic-if-extent_tree-is-not-created.patch b/queue-5.4/f2fs-let-s-avoid-panic-if-extent_tree-is-not-created.patch new file mode 100644 index 00000000000..324839b1a2d --- /dev/null +++ b/queue-5.4/f2fs-let-s-avoid-panic-if-extent_tree-is-not-created.patch @@ -0,0 +1,70 @@ +From b792b39a941bc95f2ef08ad0438dd24a27e0feae Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 21 Dec 2022 16:14:10 -0800 +Subject: f2fs: let's avoid panic if extent_tree is not created + +From: Jaegeuk Kim + +[ Upstream commit df9d44b645b83fffccfb4e28c1f93376585fdec8 ] + +This patch avoids the below panic. + +pc : __lookup_extent_tree+0xd8/0x760 +lr : f2fs_do_write_data_page+0x104/0x87c +sp : ffffffc010cbb3c0 +x29: ffffffc010cbb3e0 x28: 0000000000000000 +x27: ffffff8803e7f020 x26: ffffff8803e7ed40 +x25: ffffff8803e7f020 x24: ffffffc010cbb460 +x23: ffffffc010cbb480 x22: 0000000000000000 +x21: 0000000000000000 x20: ffffffff22e90900 +x19: 0000000000000000 x18: ffffffc010c5d080 +x17: 0000000000000000 x16: 0000000000000020 +x15: ffffffdb1acdbb88 x14: ffffff888759e2b0 +x13: 0000000000000000 x12: ffffff802da49000 +x11: 000000000a001200 x10: ffffff8803e7ed40 +x9 : ffffff8023195800 x8 : ffffff802da49078 +x7 : 0000000000000001 x6 : 0000000000000000 +x5 : 0000000000000006 x4 : ffffffc010cbba28 +x3 : 0000000000000000 x2 : ffffffc010cbb480 +x1 : 0000000000000000 x0 : ffffff8803e7ed40 +Call trace: + __lookup_extent_tree+0xd8/0x760 + f2fs_do_write_data_page+0x104/0x87c + f2fs_write_single_data_page+0x420/0xb60 + f2fs_write_cache_pages+0x418/0xb1c + __f2fs_write_data_pages+0x428/0x58c + f2fs_write_data_pages+0x30/0x40 + do_writepages+0x88/0x190 + __writeback_single_inode+0x48/0x448 + writeback_sb_inodes+0x468/0x9e8 + __writeback_inodes_wb+0xb8/0x2a4 + wb_writeback+0x33c/0x740 + wb_do_writeback+0x2b4/0x400 + wb_workfn+0xe4/0x34c + process_one_work+0x24c/0x5bc + worker_thread+0x3e8/0xa50 + kthread+0x150/0x1b4 + +Signed-off-by: Jaegeuk Kim +Signed-off-by: Sasha Levin +--- + fs/f2fs/extent_cache.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/fs/f2fs/extent_cache.c b/fs/f2fs/extent_cache.c +index 05b17a741ccc..dd53c9294ad9 100644 +--- a/fs/f2fs/extent_cache.c ++++ b/fs/f2fs/extent_cache.c +@@ -381,7 +381,8 @@ static bool f2fs_lookup_extent_tree(struct inode *inode, pgoff_t pgofs, + struct extent_node *en; + bool ret = false; + +- f2fs_bug_on(sbi, !et); ++ if (!et) ++ return false; + + trace_f2fs_lookup_extent_tree_start(inode, pgofs); + +-- +2.35.1 + diff --git a/queue-5.4/net-ethtool-ioctl-return-eopnotsupp-if-we-have-no-ph.patch b/queue-5.4/net-ethtool-ioctl-return-eopnotsupp-if-we-have-no-ph.patch new file mode 100644 index 00000000000..75ee2f3adf9 --- /dev/null +++ b/queue-5.4/net-ethtool-ioctl-return-eopnotsupp-if-we-have-no-ph.patch @@ -0,0 +1,38 @@ +From 936780cd9cdf1d57bbd5cd5b8d83a2199dca43e0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 26 Dec 2022 14:48:23 +0300 +Subject: net/ethtool/ioctl: return -EOPNOTSUPP if we have no phy stats + +From: Daniil Tatianin + +[ Upstream commit 9deb1e9fb88b1120a908676fa33bdf9e2eeaefce ] + +It's not very useful to copy back an empty ethtool_stats struct and +return 0 if we didn't actually have any stats. This also allows for +further simplification of this function in the future commits. + +Signed-off-by: Daniil Tatianin +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/core/ethtool.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/core/ethtool.c b/net/core/ethtool.c +index cbd1885f2459..9ae38c3e2bf0 100644 +--- a/net/core/ethtool.c ++++ b/net/core/ethtool.c +@@ -1947,7 +1947,8 @@ static int ethtool_get_phy_stats(struct net_device *dev, void __user *useraddr) + return n_stats; + if (n_stats > S32_MAX / sizeof(u64)) + return -ENOMEM; +- WARN_ON_ONCE(!n_stats); ++ if (WARN_ON_ONCE(!n_stats)) ++ return -EOPNOTSUPP; + + if (copy_from_user(&stats, useraddr, sizeof(stats))) + return -EFAULT; +-- +2.35.1 + diff --git a/queue-5.4/pnfs-filelayout-fix-coalescing-test-for-single-ds.patch b/queue-5.4/pnfs-filelayout-fix-coalescing-test-for-single-ds.patch new file mode 100644 index 00000000000..2612dc9558d --- /dev/null +++ b/queue-5.4/pnfs-filelayout-fix-coalescing-test-for-single-ds.patch @@ -0,0 +1,49 @@ +From 320a22540a469d636293816bd93f4d8d076e2082 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 20 Dec 2022 12:31:29 -0500 +Subject: pNFS/filelayout: Fix coalescing test for single DS + +From: Olga Kornievskaia + +[ Upstream commit a6b9d2fa0024e7e399c26facd0fb466b7396e2b9 ] + +When there is a single DS no striping constraints need to be placed on +the IO. When such constraint is applied then buffered reads don't +coalesce to the DS's rsize. + +Signed-off-by: Olga Kornievskaia +Signed-off-by: Trond Myklebust +Signed-off-by: Sasha Levin +--- + fs/nfs/filelayout/filelayout.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c +index 98b74cdabb99..8c72718d9fe0 100644 +--- a/fs/nfs/filelayout/filelayout.c ++++ b/fs/nfs/filelayout/filelayout.c +@@ -837,6 +837,12 @@ filelayout_alloc_lseg(struct pnfs_layout_hdr *layoutid, + return &fl->generic_hdr; + } + ++static bool ++filelayout_lseg_is_striped(const struct nfs4_filelayout_segment *flseg) ++{ ++ return flseg->num_fh > 1; ++} ++ + /* + * filelayout_pg_test(). Called by nfs_can_coalesce_requests() + * +@@ -857,6 +863,8 @@ filelayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, + size = pnfs_generic_pg_test(pgio, prev, req); + if (!size) + return 0; ++ else if (!filelayout_lseg_is_striped(FILELAYOUT_LSEG(pgio->pg_lseg))) ++ return size; + + /* see if req and prev are in the same stripe */ + if (prev) { +-- +2.35.1 + diff --git a/queue-5.4/rdma-srp-move-large-values-to-a-new-enum-for-gcc13.patch b/queue-5.4/rdma-srp-move-large-values-to-a-new-enum-for-gcc13.patch new file mode 100644 index 00000000000..4aa210404cd --- /dev/null +++ b/queue-5.4/rdma-srp-move-large-values-to-a-new-enum-for-gcc13.patch @@ -0,0 +1,66 @@ +From 781cf02541f2155312d9e1dacf7ae84e965144aa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 12 Dec 2022 13:04:11 +0100 +Subject: RDMA/srp: Move large values to a new enum for gcc13 + +From: Jiri Slaby (SUSE) + +[ Upstream commit 56c5dab20a6391604df9521f812c01d1e3fe1bd0 ] + +Since gcc13, each member of an enum has the same type as the enum [1]. And +that is inherited from its members. Provided these two: + SRP_TAG_NO_REQ = ~0U, + SRP_TAG_TSK_MGMT = 1U << 31 +all other members are unsigned ints. + +Esp. with SRP_MAX_SGE and SRP_TSK_MGMT_SQ_SIZE and their use in min(), +this results in the following warnings: + include/linux/minmax.h:20:35: error: comparison of distinct pointer types lacks a cast + drivers/infiniband/ulp/srp/ib_srp.c:563:42: note: in expansion of macro 'min' + + include/linux/minmax.h:20:35: error: comparison of distinct pointer types lacks a cast + drivers/infiniband/ulp/srp/ib_srp.c:2369:27: note: in expansion of macro 'min' + +So move the large values away to a separate enum, so that they don't +affect other members. + +[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36113 + +Link: https://lore.kernel.org/r/20221212120411.13750-1-jirislaby@kernel.org +Signed-off-by: Jiri Slaby (SUSE) +Reviewed-by: Bart Van Assche +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/ulp/srp/ib_srp.h | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h +index b2861cd2087a..3f17bfd33eb5 100644 +--- a/drivers/infiniband/ulp/srp/ib_srp.h ++++ b/drivers/infiniband/ulp/srp/ib_srp.h +@@ -63,9 +63,6 @@ enum { + SRP_DEFAULT_CMD_SQ_SIZE = SRP_DEFAULT_QUEUE_SIZE - SRP_RSP_SQ_SIZE - + SRP_TSK_MGMT_SQ_SIZE, + +- SRP_TAG_NO_REQ = ~0U, +- SRP_TAG_TSK_MGMT = 1U << 31, +- + SRP_MAX_PAGES_PER_MR = 512, + + SRP_MAX_ADD_CDB_LEN = 16, +@@ -80,6 +77,11 @@ enum { + sizeof(struct srp_imm_buf), + }; + ++enum { ++ SRP_TAG_NO_REQ = ~0U, ++ SRP_TAG_TSK_MGMT = BIT(31), ++}; ++ + enum srp_target_state { + SRP_TARGET_SCANNING, + SRP_TARGET_LIVE, +-- +2.35.1 + diff --git a/queue-5.4/selftests-bpf-check-null-propagation-only-neither-re.patch b/queue-5.4/selftests-bpf-check-null-propagation-only-neither-re.patch new file mode 100644 index 00000000000..0544e07c6e9 --- /dev/null +++ b/queue-5.4/selftests-bpf-check-null-propagation-only-neither-re.patch @@ -0,0 +1,92 @@ +From c6f8474847d8dbde24b2ac6106989e0e35524308 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 22 Dec 2022 10:44:14 +0800 +Subject: selftests/bpf: check null propagation only neither reg is + PTR_TO_BTF_ID + +From: Hao Sun + +[ Upstream commit cedebd74cf3883f0384af9ec26b4e6f8f1964dd4 ] + +Verify that nullness information is not porpagated in the branches +of register to register JEQ and JNE operations if one of them is +PTR_TO_BTF_ID. Implement this in C level so we can use CO-RE. + +Signed-off-by: Hao Sun +Suggested-by: Martin KaFai Lau +Link: https://lore.kernel.org/r/20221222024414.29539-2-sunhao.th@gmail.com +Signed-off-by: Martin KaFai Lau +Signed-off-by: Sasha Levin +--- + .../bpf/prog_tests/jeq_infer_not_null.c | 9 ++++ + .../bpf/progs/jeq_infer_not_null_fail.c | 42 +++++++++++++++++++ + 2 files changed, 51 insertions(+) + create mode 100644 tools/testing/selftests/bpf/prog_tests/jeq_infer_not_null.c + create mode 100644 tools/testing/selftests/bpf/progs/jeq_infer_not_null_fail.c + +diff --git a/tools/testing/selftests/bpf/prog_tests/jeq_infer_not_null.c b/tools/testing/selftests/bpf/prog_tests/jeq_infer_not_null.c +new file mode 100644 +index 000000000000..3add34df5767 +--- /dev/null ++++ b/tools/testing/selftests/bpf/prog_tests/jeq_infer_not_null.c +@@ -0,0 +1,9 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++#include ++#include "jeq_infer_not_null_fail.skel.h" ++ ++void test_jeq_infer_not_null(void) ++{ ++ RUN_TESTS(jeq_infer_not_null_fail); ++} +diff --git a/tools/testing/selftests/bpf/progs/jeq_infer_not_null_fail.c b/tools/testing/selftests/bpf/progs/jeq_infer_not_null_fail.c +new file mode 100644 +index 000000000000..f46965053acb +--- /dev/null ++++ b/tools/testing/selftests/bpf/progs/jeq_infer_not_null_fail.c +@@ -0,0 +1,42 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++#include "vmlinux.h" ++#include ++#include "bpf_misc.h" ++ ++char _license[] SEC("license") = "GPL"; ++ ++struct { ++ __uint(type, BPF_MAP_TYPE_HASH); ++ __uint(max_entries, 1); ++ __type(key, u64); ++ __type(value, u64); ++} m_hash SEC(".maps"); ++ ++SEC("?raw_tp") ++__failure __msg("R8 invalid mem access 'map_value_or_null") ++int jeq_infer_not_null_ptr_to_btfid(void *ctx) ++{ ++ struct bpf_map *map = (struct bpf_map *)&m_hash; ++ struct bpf_map *inner_map = map->inner_map_meta; ++ u64 key = 0, ret = 0, *val; ++ ++ val = bpf_map_lookup_elem(map, &key); ++ /* Do not mark ptr as non-null if one of them is ++ * PTR_TO_BTF_ID (R9), reject because of invalid ++ * access to map value (R8). ++ * ++ * Here, we need to inline those insns to access ++ * R8 directly, since compiler may use other reg ++ * once it figures out val==inner_map. ++ */ ++ asm volatile("r8 = %[val];\n" ++ "r9 = %[inner_map];\n" ++ "if r8 != r9 goto +1;\n" ++ "%[ret] = *(u64 *)(r8 +0);\n" ++ : [ret] "+r"(ret) ++ : [inner_map] "r"(inner_map), [val] "r"(val) ++ : "r8", "r9"); ++ ++ return ret; ++} +-- +2.35.1 + diff --git a/queue-5.4/series b/queue-5.4/series new file mode 100644 index 00000000000..dad3496c711 --- /dev/null +++ b/queue-5.4/series @@ -0,0 +1,5 @@ +pnfs-filelayout-fix-coalescing-test-for-single-ds.patch +selftests-bpf-check-null-propagation-only-neither-re.patch +net-ethtool-ioctl-return-eopnotsupp-if-we-have-no-ph.patch +rdma-srp-move-large-values-to-a-new-enum-for-gcc13.patch +f2fs-let-s-avoid-panic-if-extent_tree-is-not-created.patch