From: Greg Kroah-Hartman Date: Tue, 15 Sep 2020 08:13:24 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v4.19.146~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c223d33171a478363b622485b174ac174ff6f410;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: rdma-mlx4-read-pkey-table-length-instead-of-hardcoded-value.patch rdma-rxe-fix-the-parent-sysfs-read-when-the-interface-has-15-chars.patch --- diff --git a/queue-5.4/rdma-mlx4-read-pkey-table-length-instead-of-hardcoded-value.patch b/queue-5.4/rdma-mlx4-read-pkey-table-length-instead-of-hardcoded-value.patch new file mode 100644 index 00000000000..cc4e947446d --- /dev/null +++ b/queue-5.4/rdma-mlx4-read-pkey-table-length-instead-of-hardcoded-value.patch @@ -0,0 +1,43 @@ +From ec78b3bd66bc9a015505df0ef0eb153d9e64b03b Mon Sep 17 00:00:00 2001 +From: Mark Bloch +Date: Mon, 24 Aug 2020 14:02:29 +0300 +Subject: RDMA/mlx4: Read pkey table length instead of hardcoded value + +From: Mark Bloch + +commit ec78b3bd66bc9a015505df0ef0eb153d9e64b03b upstream. + +If the pkey_table is not available (which is the case when RoCE is not +supported), the cited commit caused a regression where mlx4_devices +without RoCE are not created. + +Fix this by returning a pkey table length of zero in procedure +eth_link_query_port() if the pkey-table length reported by the device is +zero. + +Link: https://lore.kernel.org/r/20200824110229.1094376-1-leon@kernel.org +Cc: +Fixes: 1901b91f9982 ("IB/core: Fix potential NULL pointer dereference in pkey cache") +Fixes: fa417f7b520e ("IB/mlx4: Add support for IBoE") +Signed-off-by: Mark Bloch +Reviewed-by: Maor Gottlieb +Signed-off-by: Leon Romanovsky +Signed-off-by: Jason Gunthorpe +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/infiniband/hw/mlx4/main.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/infiniband/hw/mlx4/main.c ++++ b/drivers/infiniband/hw/mlx4/main.c +@@ -781,7 +781,8 @@ static int eth_link_query_port(struct ib + props->ip_gids = true; + props->gid_tbl_len = mdev->dev->caps.gid_table_len[port]; + props->max_msg_sz = mdev->dev->caps.max_msg_sz; +- props->pkey_tbl_len = 1; ++ if (mdev->dev->caps.pkey_table_len[port]) ++ props->pkey_tbl_len = 1; + props->max_mtu = IB_MTU_4096; + props->max_vl_num = 2; + props->state = IB_PORT_DOWN; diff --git a/queue-5.4/rdma-rxe-fix-the-parent-sysfs-read-when-the-interface-has-15-chars.patch b/queue-5.4/rdma-rxe-fix-the-parent-sysfs-read-when-the-interface-has-15-chars.patch new file mode 100644 index 00000000000..e2ad5812006 --- /dev/null +++ b/queue-5.4/rdma-rxe-fix-the-parent-sysfs-read-when-the-interface-has-15-chars.patch @@ -0,0 +1,54 @@ +From 60b1af64eb35074a4f2d41cc1e503a7671e68963 Mon Sep 17 00:00:00 2001 +From: Yi Zhang +Date: Thu, 20 Aug 2020 23:36:46 +0800 +Subject: RDMA/rxe: Fix the parent sysfs read when the interface has 15 chars + +From: Yi Zhang + +commit 60b1af64eb35074a4f2d41cc1e503a7671e68963 upstream. + +'parent' sysfs reads will yield '\0' bytes when the interface name has 15 +chars, and there will no "\n" output. + +To reproduce, create one interface with 15 chars: + + [root@test ~]# ip a s enp0s29u1u7u3c2 + 2: enp0s29u1u7u3c2: mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000 + link/ether 02:21:28:57:47:17 brd ff:ff:ff:ff:ff:ff + inet6 fe80::ac41:338f:5bcd:c222/64 scope link noprefixroute + valid_lft forever preferred_lft forever + [root@test ~]# modprobe rdma_rxe + [root@test ~]# echo enp0s29u1u7u3c2 > /sys/module/rdma_rxe/parameters/add + [root@test ~]# cat /sys/class/infiniband/rxe0/parent + enp0s29u1u7u3c2[root@test ~]# + [root@test ~]# f="/sys/class/infiniband/rxe0/parent" + [root@test ~]# echo "$(<"$f")" + -bash: warning: command substitution: ignored null byte in input + enp0s29u1u7u3c2 + +Use scnprintf and PAGE_SIZE to fill the sysfs output buffer. + +Cc: stable@vger.kernel.org +Fixes: 8700e3e7c485 ("Soft RoCE driver") +Link: https://lore.kernel.org/r/20200820153646.31316-1-yi.zhang@redhat.com +Suggested-by: Jason Gunthorpe +Signed-off-by: Yi Zhang +Reviewed-by: Bart Van Assche +Signed-off-by: Jason Gunthorpe +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/infiniband/sw/rxe/rxe_verbs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/infiniband/sw/rxe/rxe_verbs.c ++++ b/drivers/infiniband/sw/rxe/rxe_verbs.c +@@ -1078,7 +1078,7 @@ static ssize_t parent_show(struct device + struct rxe_dev *rxe = + rdma_device_to_drv_device(device, struct rxe_dev, ib_dev); + +- return snprintf(buf, 16, "%s\n", rxe_parent_name(rxe, 1)); ++ return scnprintf(buf, PAGE_SIZE, "%s\n", rxe_parent_name(rxe, 1)); + } + + static DEVICE_ATTR_RO(parent); diff --git a/queue-5.4/series b/queue-5.4/series index 601d065e126..726e2364310 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -107,3 +107,5 @@ drm-msm-disable-preemption-on-all-5xx-targets.patch mmc-sdio-use-mmc_pre_req-mmc_post_req.patch mmc-sdhci-of-esdhc-don-t-walk-device-tree-on-every-interrupt.patch rbd-require-global-cap_sys_admin-for-mapping-and-unmapping.patch +rdma-rxe-fix-the-parent-sysfs-read-when-the-interface-has-15-chars.patch +rdma-mlx4-read-pkey-table-length-instead-of-hardcoded-value.patch