From: Sasha Levin Date: Sun, 18 Jun 2023 14:10:52 +0000 (-0400) Subject: Fixes for 4.19 X-Git-Tag: v4.14.319~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c5046193f7ffe858291c878139c35d6a6ed33c2c;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.19 Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/drm-nouveau-add-nv_encoder-pointer-check-for-null.patch b/queue-4.19/drm-nouveau-add-nv_encoder-pointer-check-for-null.patch new file mode 100644 index 00000000000..5aafe73f888 --- /dev/null +++ b/queue-4.19/drm-nouveau-add-nv_encoder-pointer-check-for-null.patch @@ -0,0 +1,43 @@ +From ee83d5251cf314661d526d018a4731fe3720aedd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 12 May 2023 13:33:20 +0300 +Subject: drm/nouveau: add nv_encoder pointer check for NULL + +From: Natalia Petrova + +[ Upstream commit 55b94bb8c42464bad3d2217f6874aa1a85664eac ] + +Pointer nv_encoder could be dereferenced at nouveau_connector.c +in case it's equal to NULL by jumping to goto label. +This patch adds a NULL-check to avoid it. + +Found by Linux Verification Center (linuxtesting.org) with SVACE. + +Fixes: 3195c5f9784a ("drm/nouveau: set encoder for lvds") +Signed-off-by: Natalia Petrova +Reviewed-by: Lyude Paul +[Fixed patch title] +Signed-off-by: Lyude Paul +Link: https://patchwork.freedesktop.org/patch/msgid/20230512103320.82234-1-n.petrova@fintech.ru +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/nouveau/nouveau_connector.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c +index c6d6ce9af2565..5783ffc6e5ebe 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_connector.c ++++ b/drivers/gpu/drm/nouveau/nouveau_connector.c +@@ -712,7 +712,8 @@ nouveau_connector_detect_lvds(struct drm_connector *connector, bool force) + #endif + + nouveau_connector_set_edid(nv_connector, edid); +- nouveau_connector_set_encoder(connector, nv_encoder); ++ if (nv_encoder) ++ nouveau_connector_set_encoder(connector, nv_encoder); + return status; + } + +-- +2.39.2 + diff --git a/queue-4.19/drm-nouveau-dp-check-for-null-nv_connector-native_mo.patch b/queue-4.19/drm-nouveau-dp-check-for-null-nv_connector-native_mo.patch new file mode 100644 index 00000000000..7f7cb3f8280 --- /dev/null +++ b/queue-4.19/drm-nouveau-dp-check-for-null-nv_connector-native_mo.patch @@ -0,0 +1,53 @@ +From 2aac207464d20bd6c07872b847040fe29057c1f5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 12 May 2023 14:15:26 +0300 +Subject: drm/nouveau/dp: check for NULL nv_connector->native_mode + +From: Natalia Petrova + +[ Upstream commit 20a2ce87fbaf81e4c3dcb631d738e423959eb320 ] + +Add checking for NULL before calling nouveau_connector_detect_depth() in +nouveau_connector_get_modes() function because nv_connector->native_mode +could be dereferenced there since connector pointer passed to +nouveau_connector_detect_depth() and the same value of +nv_connector->native_mode is used there. + +Found by Linux Verification Center (linuxtesting.org) with SVACE. + +Fixes: d4c2c99bdc83 ("drm/nouveau/dp: remove broken display depth function, use the improved one") + +Signed-off-by: Natalia Petrova +Reviewed-by: Lyude Paul +Signed-off-by: Lyude Paul +Link: https://patchwork.freedesktop.org/patch/msgid/20230512111526.82408-1-n.petrova@fintech.ru +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/nouveau/nouveau_connector.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c +index b71afde8f115a..0327456913e11 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_connector.c ++++ b/drivers/gpu/drm/nouveau/nouveau_connector.c +@@ -916,7 +916,7 @@ nouveau_connector_get_modes(struct drm_connector *connector) + /* Determine display colour depth for everything except LVDS now, + * DP requires this before mode_valid() is called. + */ +- if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS) ++ if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS && nv_connector->native_mode) + nouveau_connector_detect_depth(connector); + + /* Find the native mode if this is a digital panel, if we didn't +@@ -937,7 +937,7 @@ nouveau_connector_get_modes(struct drm_connector *connector) + * "native" mode as some VBIOS tables require us to use the + * pixel clock as part of the lookup... + */ +- if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS) ++ if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS && nv_connector->native_mode) + nouveau_connector_detect_depth(connector); + + if (nv_encoder->dcb->type == DCB_OUTPUT_TV) +-- +2.39.2 + diff --git a/queue-4.19/drm-nouveau-kms-don-t-change-edid-when-it-hasn-t-act.patch b/queue-4.19/drm-nouveau-kms-don-t-change-edid-when-it-hasn-t-act.patch new file mode 100644 index 00000000000..ba0b5591331 --- /dev/null +++ b/queue-4.19/drm-nouveau-kms-don-t-change-edid-when-it-hasn-t-act.patch @@ -0,0 +1,168 @@ +From 17ad16482ddffb9c4100af98c225b20baf496bae Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Aug 2020 14:24:54 -0400 +Subject: drm/nouveau/kms: Don't change EDID when it hasn't actually changed + +From: Lyude Paul + +[ Upstream commit f28e32d3906eac2e1cb3291b448f0d528ec93996 ] + +Currently in nouveau_connector_ddc_detect() and +nouveau_connector_detect_lvds(), we start the connector probing process +by releasing the previous EDID and informing DRM of the change. However, +since commit 5186421cbfe2 ("drm: Introduce epoch counter to +drm_connector") drm_connector_update_edid_property() actually checks +whether the new EDID we've specified is different from the previous one, +and updates the connector's epoch accordingly if it is. But, because we +always set the EDID to NULL first in nouveau_connector_ddc_detect() and +nouveau_connector_detect_lvds() we end up making DRM think that the EDID +changes every single time we do a connector probe - which isn't needed. + +So, let's fix this by not clearing the EDID at the start of the +connector probing process, and instead simply changing or removing it +once near the end of the probing process. This will help prevent us from +sending unneeded hotplug events to userspace when nothing has actually +changed. + +Signed-off-by: Lyude Paul +Reviewed-by: Ben Skeggs +Link: https://patchwork.freedesktop.org/patch/msgid/20200826182456.322681-19-lyude@redhat.com +Stable-dep-of: 55b94bb8c424 ("drm/nouveau: add nv_encoder pointer check for NULL") +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/nouveau/nouveau_connector.c | 54 ++++++++++----------- + 1 file changed, 27 insertions(+), 27 deletions(-) + +diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c +index 0327456913e11..c6d6ce9af2565 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_connector.c ++++ b/drivers/gpu/drm/nouveau/nouveau_connector.c +@@ -521,6 +521,17 @@ nouveau_connector_set_encoder(struct drm_connector *connector, + } + } + ++static void ++nouveau_connector_set_edid(struct nouveau_connector *nv_connector, ++ struct edid *edid) ++{ ++ struct edid *old_edid = nv_connector->edid; ++ ++ drm_connector_update_edid_property(&nv_connector->base, edid); ++ kfree(old_edid); ++ nv_connector->edid = edid; ++} ++ + static enum drm_connector_status + nouveau_connector_detect(struct drm_connector *connector, bool force) + { +@@ -534,13 +545,6 @@ nouveau_connector_detect(struct drm_connector *connector, bool force) + int ret; + enum drm_connector_status conn_status = connector_status_disconnected; + +- /* Cleanup the previous EDID block. */ +- if (nv_connector->edid) { +- drm_connector_update_edid_property(connector, NULL); +- kfree(nv_connector->edid); +- nv_connector->edid = NULL; +- } +- + /* Outputs are only polled while runtime active, so resuming the + * device here is unnecessary (and would deadlock upon runtime suspend + * because it waits for polling to finish). We do however, want to +@@ -553,22 +557,23 @@ nouveau_connector_detect(struct drm_connector *connector, bool force) + ret = pm_runtime_get_sync(dev->dev); + if (ret < 0 && ret != -EACCES) { + pm_runtime_put_autosuspend(dev->dev); ++ nouveau_connector_set_edid(nv_connector, NULL); + return conn_status; + } + } + + nv_encoder = nouveau_connector_ddc_detect(connector); + if (nv_encoder && (i2c = nv_encoder->i2c) != NULL) { ++ struct edid *new_edid; ++ + if ((vga_switcheroo_handler_flags() & + VGA_SWITCHEROO_CAN_SWITCH_DDC) && + nv_connector->type == DCB_CONNECTOR_LVDS) +- nv_connector->edid = drm_get_edid_switcheroo(connector, +- i2c); ++ new_edid = drm_get_edid_switcheroo(connector, i2c); + else +- nv_connector->edid = drm_get_edid(connector, i2c); ++ new_edid = drm_get_edid(connector, i2c); + +- drm_connector_update_edid_property(connector, +- nv_connector->edid); ++ nouveau_connector_set_edid(nv_connector, new_edid); + if (!nv_connector->edid) { + NV_ERROR(drm, "DDC responded, but no EDID for %s\n", + connector->name); +@@ -601,6 +606,8 @@ nouveau_connector_detect(struct drm_connector *connector, bool force) + nouveau_connector_set_encoder(connector, nv_encoder); + conn_status = connector_status_connected; + goto out; ++ } else { ++ nouveau_connector_set_edid(nv_connector, NULL); + } + + nv_encoder = nouveau_connector_of_detect(connector); +@@ -643,18 +650,12 @@ nouveau_connector_detect_lvds(struct drm_connector *connector, bool force) + struct nouveau_drm *drm = nouveau_drm(dev); + struct nouveau_connector *nv_connector = nouveau_connector(connector); + struct nouveau_encoder *nv_encoder = NULL; ++ struct edid *edid = NULL; + enum drm_connector_status status = connector_status_disconnected; + +- /* Cleanup the previous EDID block. */ +- if (nv_connector->edid) { +- drm_connector_update_edid_property(connector, NULL); +- kfree(nv_connector->edid); +- nv_connector->edid = NULL; +- } +- + nv_encoder = find_encoder(connector, DCB_OUTPUT_LVDS); + if (!nv_encoder) +- return connector_status_disconnected; ++ goto out; + + /* Try retrieving EDID via DDC */ + if (!drm->vbios.fp_no_ddc) { +@@ -673,7 +674,8 @@ nouveau_connector_detect_lvds(struct drm_connector *connector, bool force) + * valid - it's not (rh#613284) + */ + if (nv_encoder->dcb->lvdsconf.use_acpi_for_edid) { +- if ((nv_connector->edid = nouveau_acpi_edid(dev, connector))) { ++ edid = nouveau_acpi_edid(dev, connector); ++ if (edid) { + status = connector_status_connected; + goto out; + } +@@ -693,12 +695,10 @@ nouveau_connector_detect_lvds(struct drm_connector *connector, bool force) + * stored for the panel stored in them. + */ + if (!drm->vbios.fp_no_ddc) { +- struct edid *edid = +- (struct edid *)nouveau_bios_embedded_edid(dev); ++ edid = (struct edid *)nouveau_bios_embedded_edid(dev); + if (edid) { +- nv_connector->edid = +- kmemdup(edid, EDID_LENGTH, GFP_KERNEL); +- if (nv_connector->edid) ++ edid = kmemdup(edid, EDID_LENGTH, GFP_KERNEL); ++ if (edid) + status = connector_status_connected; + } + } +@@ -711,7 +711,7 @@ nouveau_connector_detect_lvds(struct drm_connector *connector, bool force) + status = connector_status_unknown; + #endif + +- drm_connector_update_edid_property(connector, nv_connector->edid); ++ nouveau_connector_set_edid(nv_connector, edid); + nouveau_connector_set_encoder(connector, nv_encoder); + return status; + } +-- +2.39.2 + diff --git a/queue-4.19/ib-isert-fix-dead-lock-in-ib_isert.patch b/queue-4.19/ib-isert-fix-dead-lock-in-ib_isert.patch new file mode 100644 index 00000000000..ee99ba45239 --- /dev/null +++ b/queue-4.19/ib-isert-fix-dead-lock-in-ib_isert.patch @@ -0,0 +1,121 @@ +From 0c615c149f35e7a36832e40c0c8da3756c8bbace Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 6 Jun 2023 03:25:29 -0700 +Subject: IB/isert: Fix dead lock in ib_isert + +From: Saravanan Vajravel + +[ Upstream commit 691b0480933f0ce88a81ed1d1a0aff340ff6293a ] + +- When a iSER session is released, ib_isert module is taking a mutex + lock and releasing all pending connections. As part of this, ib_isert + is destroying rdma cm_id. To destroy cm_id, rdma_cm module is sending + CM events to CMA handler of ib_isert. This handler is taking same + mutex lock. Hence it leads to deadlock between ib_isert & rdma_cm + modules. + +- For fix, created local list of pending connections and release the + connection outside of mutex lock. + +Calltrace: +--------- +[ 1229.791410] INFO: task kworker/10:1:642 blocked for more than 120 seconds. +[ 1229.791416] Tainted: G OE --------- - - 4.18.0-372.9.1.el8.x86_64 #1 +[ 1229.791418] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. +[ 1229.791419] task:kworker/10:1 state:D stack: 0 pid: 642 ppid: 2 flags:0x80004000 +[ 1229.791424] Workqueue: ib_cm cm_work_handler [ib_cm] +[ 1229.791436] Call Trace: +[ 1229.791438] __schedule+0x2d1/0x830 +[ 1229.791445] ? select_idle_sibling+0x23/0x6f0 +[ 1229.791449] schedule+0x35/0xa0 +[ 1229.791451] schedule_preempt_disabled+0xa/0x10 +[ 1229.791453] __mutex_lock.isra.7+0x310/0x420 +[ 1229.791456] ? select_task_rq_fair+0x351/0x990 +[ 1229.791459] isert_cma_handler+0x224/0x330 [ib_isert] +[ 1229.791463] ? ttwu_queue_wakelist+0x159/0x170 +[ 1229.791466] cma_cm_event_handler+0x25/0xd0 [rdma_cm] +[ 1229.791474] cma_ib_handler+0xa7/0x2e0 [rdma_cm] +[ 1229.791478] cm_process_work+0x22/0xf0 [ib_cm] +[ 1229.791483] cm_work_handler+0xf4/0xf30 [ib_cm] +[ 1229.791487] ? move_linked_works+0x6e/0xa0 +[ 1229.791490] process_one_work+0x1a7/0x360 +[ 1229.791491] ? create_worker+0x1a0/0x1a0 +[ 1229.791493] worker_thread+0x30/0x390 +[ 1229.791494] ? create_worker+0x1a0/0x1a0 +[ 1229.791495] kthread+0x10a/0x120 +[ 1229.791497] ? set_kthread_struct+0x40/0x40 +[ 1229.791499] ret_from_fork+0x1f/0x40 + +[ 1229.791739] INFO: task targetcli:28666 blocked for more than 120 seconds. +[ 1229.791740] Tainted: G OE --------- - - 4.18.0-372.9.1.el8.x86_64 #1 +[ 1229.791741] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. +[ 1229.791742] task:targetcli state:D stack: 0 pid:28666 ppid: 5510 flags:0x00004080 +[ 1229.791743] Call Trace: +[ 1229.791744] __schedule+0x2d1/0x830 +[ 1229.791746] schedule+0x35/0xa0 +[ 1229.791748] schedule_preempt_disabled+0xa/0x10 +[ 1229.791749] __mutex_lock.isra.7+0x310/0x420 +[ 1229.791751] rdma_destroy_id+0x15/0x20 [rdma_cm] +[ 1229.791755] isert_connect_release+0x115/0x130 [ib_isert] +[ 1229.791757] isert_free_np+0x87/0x140 [ib_isert] +[ 1229.791761] iscsit_del_np+0x74/0x120 [iscsi_target_mod] +[ 1229.791776] lio_target_np_driver_store+0xe9/0x140 [iscsi_target_mod] +[ 1229.791784] configfs_write_file+0xb2/0x110 +[ 1229.791788] vfs_write+0xa5/0x1a0 +[ 1229.791792] ksys_write+0x4f/0xb0 +[ 1229.791794] do_syscall_64+0x5b/0x1a0 +[ 1229.791798] entry_SYSCALL_64_after_hwframe+0x65/0xca + +Fixes: bd3792205aae ("iser-target: Fix pending connections handling in target stack shutdown sequnce") +Reviewed-by: Sagi Grimberg +Signed-off-by: Selvin Xavier +Signed-off-by: Saravanan Vajravel +Link: https://lore.kernel.org/r/20230606102531.162967-2-saravanan.vajravel@broadcom.com +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/ulp/isert/ib_isert.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c +index f39670c5c25c5..51e4f4e112841 100644 +--- a/drivers/infiniband/ulp/isert/ib_isert.c ++++ b/drivers/infiniband/ulp/isert/ib_isert.c +@@ -2515,6 +2515,7 @@ isert_free_np(struct iscsi_np *np) + { + struct isert_np *isert_np = np->np_context; + struct isert_conn *isert_conn, *n; ++ LIST_HEAD(drop_conn_list); + + if (isert_np->cm_id) + rdma_destroy_id(isert_np->cm_id); +@@ -2534,7 +2535,7 @@ isert_free_np(struct iscsi_np *np) + node) { + isert_info("cleaning isert_conn %p state (%d)\n", + isert_conn, isert_conn->state); +- isert_connect_release(isert_conn); ++ list_move_tail(&isert_conn->node, &drop_conn_list); + } + } + +@@ -2545,11 +2546,16 @@ isert_free_np(struct iscsi_np *np) + node) { + isert_info("cleaning isert_conn %p state (%d)\n", + isert_conn, isert_conn->state); +- isert_connect_release(isert_conn); ++ list_move_tail(&isert_conn->node, &drop_conn_list); + } + } + mutex_unlock(&isert_np->mutex); + ++ list_for_each_entry_safe(isert_conn, n, &drop_conn_list, node) { ++ list_del_init(&isert_conn->node); ++ isert_connect_release(isert_conn); ++ } ++ + np->np_context = NULL; + kfree(isert_np); + } +-- +2.39.2 + diff --git a/queue-4.19/ib-isert-fix-incorrect-release-of-isert-connection.patch b/queue-4.19/ib-isert-fix-incorrect-release-of-isert-connection.patch new file mode 100644 index 00000000000..8cf36ed2ad1 --- /dev/null +++ b/queue-4.19/ib-isert-fix-incorrect-release-of-isert-connection.patch @@ -0,0 +1,45 @@ +From 28e342fcaee06672033a47c5a0e1ef8c79514da7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 6 Jun 2023 03:25:31 -0700 +Subject: IB/isert: Fix incorrect release of isert connection + +From: Saravanan Vajravel + +[ Upstream commit 699826f4e30ab76a62c238c86fbef7e826639c8d ] + +The ib_isert module is releasing the isert connection both in +isert_wait_conn() handler as well as isert_free_conn() handler. +In isert_wait_conn() handler, it is expected to wait for iSCSI +session logout operation to complete. It should free the isert +connection only in isert_free_conn() handler. + +When a bunch of iSER target is cleared, this issue can lead to +use-after-free memory issue as isert conn is twice released + +Fixes: b02efbfc9a05 ("iser-target: Fix implicit termination of connections") +Reviewed-by: Sagi Grimberg +Signed-off-by: Saravanan Vajravel +Signed-off-by: Selvin Xavier +Link: https://lore.kernel.org/r/20230606102531.162967-4-saravanan.vajravel@broadcom.com +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/ulp/isert/ib_isert.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c +index 60594dad55455..de6fc8887c4a4 100644 +--- a/drivers/infiniband/ulp/isert/ib_isert.c ++++ b/drivers/infiniband/ulp/isert/ib_isert.c +@@ -2654,8 +2654,6 @@ static void isert_wait_conn(struct iscsi_conn *conn) + isert_put_unsol_pending_cmds(conn); + isert_wait4cmds(conn); + isert_wait4logout(isert_conn); +- +- queue_work(isert_release_wq, &isert_conn->release_work); + } + + static void isert_free_conn(struct iscsi_conn *conn) +-- +2.39.2 + diff --git a/queue-4.19/ib-isert-fix-possible-list-corruption-in-cma-handler.patch b/queue-4.19/ib-isert-fix-possible-list-corruption-in-cma-handler.patch new file mode 100644 index 00000000000..39cdc6fa904 --- /dev/null +++ b/queue-4.19/ib-isert-fix-possible-list-corruption-in-cma-handler.patch @@ -0,0 +1,45 @@ +From 5a6053a29205e4ab96a2fc0a2015dc112e7f18f8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 6 Jun 2023 03:25:30 -0700 +Subject: IB/isert: Fix possible list corruption in CMA handler + +From: Saravanan Vajravel + +[ Upstream commit 7651e2d6c5b359a28c2d4c904fec6608d1021ca8 ] + +When ib_isert module receives connection error event, it is +releasing the isert session and removes corresponding list +node but it doesn't take appropriate mutex lock to remove +the list node. This can lead to linked list corruption + +Fixes: bd3792205aae ("iser-target: Fix pending connections handling in target stack shutdown sequnce") +Signed-off-by: Selvin Xavier +Signed-off-by: Saravanan Vajravel +Link: https://lore.kernel.org/r/20230606102531.162967-3-saravanan.vajravel@broadcom.com +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/ulp/isert/ib_isert.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c +index 51e4f4e112841..60594dad55455 100644 +--- a/drivers/infiniband/ulp/isert/ib_isert.c ++++ b/drivers/infiniband/ulp/isert/ib_isert.c +@@ -742,9 +742,13 @@ static int + isert_connect_error(struct rdma_cm_id *cma_id) + { + struct isert_conn *isert_conn = cma_id->qp->qp_context; ++ struct isert_np *isert_np = cma_id->context; + + ib_drain_qp(isert_conn->qp); ++ ++ mutex_lock(&isert_np->mutex); + list_del_init(&isert_conn->node); ++ mutex_unlock(&isert_np->mutex); + isert_conn->cm_id = NULL; + isert_put_conn(isert_conn); + +-- +2.39.2 + diff --git a/queue-4.19/ib-uverbs-fix-to-consider-event-queue-closing-also-u.patch b/queue-4.19/ib-uverbs-fix-to-consider-event-queue-closing-also-u.patch new file mode 100644 index 00000000000..bb2486850d9 --- /dev/null +++ b/queue-4.19/ib-uverbs-fix-to-consider-event-queue-closing-also-u.patch @@ -0,0 +1,69 @@ +From 14cfb7e668566fd85b712455e6fccc1039e41cbe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 5 Jun 2023 13:33:25 +0300 +Subject: IB/uverbs: Fix to consider event queue closing also upon non-blocking + mode + +From: Yishai Hadas + +[ Upstream commit 62fab312fa1683e812e605db20d4f22de3e3fb2f ] + +Fix ib_uverbs_event_read() to consider event queue closing also upon +non-blocking mode. + +Once the queue is closed (e.g. hot-plug flow) all the existing events +are cleaned-up as part of ib_uverbs_free_event_queue(). + +An application that uses the non-blocking FD mode should get -EIO in +that case to let it knows that the device was removed already. + +Otherwise, it can loose the indication that the device was removed and +won't recover. + +As part of that, refactor the code to have a single flow with regards to +'is_closed' for both blocking and non-blocking modes. + +Fixes: 14e23bd6d221 ("RDMA/core: Fix locking in ib_uverbs_event_read") +Reviewed-by: Maor Gottlieb +Signed-off-by: Yishai Hadas +Link: https://lore.kernel.org/r/97b00116a1e1e13f8dc4ec38a5ea81cf8c030210.1685960567.git.leon@kernel.org +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/core/uverbs_main.c | 12 +++++------- + 1 file changed, 5 insertions(+), 7 deletions(-) + +diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c +index fc4b46258c756..6d8925432d6a7 100644 +--- a/drivers/infiniband/core/uverbs_main.c ++++ b/drivers/infiniband/core/uverbs_main.c +@@ -283,8 +283,12 @@ static ssize_t ib_uverbs_event_read(struct ib_uverbs_event_queue *ev_queue, + spin_lock_irq(&ev_queue->lock); + + while (list_empty(&ev_queue->event_list)) { +- spin_unlock_irq(&ev_queue->lock); ++ if (ev_queue->is_closed) { ++ spin_unlock_irq(&ev_queue->lock); ++ return -EIO; ++ } + ++ spin_unlock_irq(&ev_queue->lock); + if (filp->f_flags & O_NONBLOCK) + return -EAGAIN; + +@@ -294,12 +298,6 @@ static ssize_t ib_uverbs_event_read(struct ib_uverbs_event_queue *ev_queue, + return -ERESTARTSYS; + + spin_lock_irq(&ev_queue->lock); +- +- /* If device was disassociated and no event exists set an error */ +- if (list_empty(&ev_queue->event_list) && ev_queue->is_closed) { +- spin_unlock_irq(&ev_queue->lock); +- return -EIO; +- } + } + + event = list_entry(ev_queue->event_list.next, struct ib_uverbs_event, list); +-- +2.39.2 + diff --git a/queue-4.19/igb-fix-nvm.ops.read-error-handling.patch b/queue-4.19/igb-fix-nvm.ops.read-error-handling.patch new file mode 100644 index 00000000000..b3553366d76 --- /dev/null +++ b/queue-4.19/igb-fix-nvm.ops.read-error-handling.patch @@ -0,0 +1,44 @@ +From 74a3570b441b05f2c735eeb0512dc4c55a15cc23 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Apr 2023 17:44:14 +0200 +Subject: igb: fix nvm.ops.read() error handling + +From: Aleksandr Loktionov + +[ Upstream commit 48a821fd58837800750ec1b3962f0f799630a844 ] + +Add error handling into igb_set_eeprom() function, in case +nvm.ops.read() fails just quit with error code asap. + +Fixes: 9d5c824399de ("igb: PCI-Express 82575 Gigabit Ethernet driver") +Signed-off-by: Aleksandr Loktionov +Signed-off-by: Tony Nguyen +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/igb/igb_ethtool.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c +index d0f5b92bead73..e19fbdf2ff304 100644 +--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c ++++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c +@@ -811,6 +811,8 @@ static int igb_set_eeprom(struct net_device *netdev, + */ + ret_val = hw->nvm.ops.read(hw, last_word, 1, + &eeprom_buff[last_word - first_word]); ++ if (ret_val) ++ goto out; + } + + /* Device's eeprom is always little-endian, word addressable */ +@@ -830,6 +832,7 @@ static int igb_set_eeprom(struct net_device *netdev, + hw->nvm.ops.update(hw); + + igb_set_fw_version(adapter); ++out: + kfree(eeprom_buff); + return ret_val; + } +-- +2.39.2 + diff --git a/queue-4.19/net-lapbether-only-support-ethernet-devices.patch b/queue-4.19/net-lapbether-only-support-ethernet-devices.patch new file mode 100644 index 00000000000..9e02f7f7520 --- /dev/null +++ b/queue-4.19/net-lapbether-only-support-ethernet-devices.patch @@ -0,0 +1,96 @@ +From a77c0bdb8e8c80a71c983bf292007fbfed92beac Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 14 Jun 2023 16:18:02 +0000 +Subject: net: lapbether: only support ethernet devices + +From: Eric Dumazet + +[ Upstream commit 9eed321cde22fc1afd76eac563ce19d899e0d6b2 ] + +It probbaly makes no sense to support arbitrary network devices +for lapbether. + +syzbot reported: + +skbuff: skb_under_panic: text:ffff80008934c100 len:44 put:40 head:ffff0000d18dd200 data:ffff0000d18dd1ea tail:0x16 end:0x140 dev:bond1 +kernel BUG at net/core/skbuff.c:200 ! +Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP +Modules linked in: +CPU: 0 PID: 5643 Comm: dhcpcd Not tainted 6.4.0-rc5-syzkaller-g4641cff8e810 #0 +Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023 +pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) +pc : skb_panic net/core/skbuff.c:196 [inline] +pc : skb_under_panic+0x13c/0x140 net/core/skbuff.c:210 +lr : skb_panic net/core/skbuff.c:196 [inline] +lr : skb_under_panic+0x13c/0x140 net/core/skbuff.c:210 +sp : ffff8000973b7260 +x29: ffff8000973b7270 x28: ffff8000973b7360 x27: dfff800000000000 +x26: ffff0000d85d8150 x25: 0000000000000016 x24: ffff0000d18dd1ea +x23: ffff0000d18dd200 x22: 000000000000002c x21: 0000000000000140 +x20: 0000000000000028 x19: ffff80008934c100 x18: ffff8000973b68a0 +x17: 0000000000000000 x16: ffff80008a43bfbc x15: 0000000000000202 +x14: 0000000000000000 x13: 0000000000000001 x12: 0000000000000001 +x11: 0000000000000201 x10: 0000000000000000 x9 : f22f7eb937cced00 +x8 : f22f7eb937cced00 x7 : 0000000000000001 x6 : 0000000000000001 +x5 : ffff8000973b6b78 x4 : ffff80008df9ee80 x3 : ffff8000805974f4 +x2 : 0000000000000001 x1 : 0000000100000201 x0 : 0000000000000086 +Call trace: +skb_panic net/core/skbuff.c:196 [inline] +skb_under_panic+0x13c/0x140 net/core/skbuff.c:210 +skb_push+0xf0/0x108 net/core/skbuff.c:2409 +ip6gre_header+0xbc/0x738 net/ipv6/ip6_gre.c:1383 +dev_hard_header include/linux/netdevice.h:3137 [inline] +lapbeth_data_transmit+0x1c4/0x298 drivers/net/wan/lapbether.c:257 +lapb_data_transmit+0x8c/0xb0 net/lapb/lapb_iface.c:447 +lapb_transmit_buffer+0x178/0x204 net/lapb/lapb_out.c:149 +lapb_send_control+0x220/0x320 net/lapb/lapb_subr.c:251 +lapb_establish_data_link+0x94/0xec +lapb_device_event+0x348/0x4e0 +notifier_call_chain+0x1a4/0x510 kernel/notifier.c:93 +raw_notifier_call_chain+0x3c/0x50 kernel/notifier.c:461 +__dev_notify_flags+0x2bc/0x544 +dev_change_flags+0xd0/0x15c net/core/dev.c:8643 +devinet_ioctl+0x858/0x17e4 net/ipv4/devinet.c:1150 +inet_ioctl+0x2ac/0x4d8 net/ipv4/af_inet.c:979 +sock_do_ioctl+0x134/0x2dc net/socket.c:1201 +sock_ioctl+0x4ec/0x858 net/socket.c:1318 +vfs_ioctl fs/ioctl.c:51 [inline] +__do_sys_ioctl fs/ioctl.c:870 [inline] +__se_sys_ioctl fs/ioctl.c:856 [inline] +__arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:856 +__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] +invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 +el0_svc_common+0x138/0x244 arch/arm64/kernel/syscall.c:142 +do_el0_svc+0x64/0x198 arch/arm64/kernel/syscall.c:191 +el0_svc+0x4c/0x160 arch/arm64/kernel/entry-common.c:647 +el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:665 +el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 +Code: aa1803e6 aa1903e7 a90023f5 947730f5 (d4210000) + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Reported-by: syzbot +Signed-off-by: Eric Dumazet +Cc: Martin Schiller +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/wan/lapbether.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c +index 6233805fc032c..b2ede9acb4bcf 100644 +--- a/drivers/net/wan/lapbether.c ++++ b/drivers/net/wan/lapbether.c +@@ -344,6 +344,9 @@ static int lapbeth_new_device(struct net_device *dev) + + ASSERT_RTNL(); + ++ if (dev->type != ARPHRD_ETHER) ++ return -EINVAL; ++ + ndev = alloc_netdev(sizeof(*lapbeth), "lapb%d", NET_NAME_UNKNOWN, + lapbeth_setup); + if (!ndev) +-- +2.39.2 + diff --git a/queue-4.19/net-tipc-resize-nlattr-array-to-correct-size.patch b/queue-4.19/net-tipc-resize-nlattr-array-to-correct-size.patch new file mode 100644 index 00000000000..b6bc44b4f2c --- /dev/null +++ b/queue-4.19/net-tipc-resize-nlattr-array-to-correct-size.patch @@ -0,0 +1,51 @@ +From 2fa5add4a060fae918d48345700db73aebc4be11 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 14 Jun 2023 20:06:04 +0800 +Subject: net: tipc: resize nlattr array to correct size + +From: Lin Ma + +[ Upstream commit 44194cb1b6045dea33ae9a0d54fb7e7cd93a2e09 ] + +According to nla_parse_nested_deprecated(), the tb[] is supposed to the +destination array with maxtype+1 elements. In current +tipc_nl_media_get() and __tipc_nl_media_set(), a larger array is used +which is unnecessary. This patch resize them to a proper size. + +Fixes: 1e55417d8fc6 ("tipc: add media set to new netlink api") +Fixes: 46f15c6794fb ("tipc: add media get/dump to new netlink api") +Signed-off-by: Lin Ma +Reviewed-by: Florian Westphal +Reviewed-by: Tung Nguyen +Link: https://lore.kernel.org/r/20230614120604.1196377-1-linma@zju.edu.cn +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/tipc/bearer.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c +index 0f970259d0d5a..4353968bc5a5c 100644 +--- a/net/tipc/bearer.c ++++ b/net/tipc/bearer.c +@@ -1128,7 +1128,7 @@ int tipc_nl_media_get(struct sk_buff *skb, struct genl_info *info) + struct tipc_nl_msg msg; + struct tipc_media *media; + struct sk_buff *rep; +- struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1]; ++ struct nlattr *attrs[TIPC_NLA_MEDIA_MAX + 1]; + + if (!info->attrs[TIPC_NLA_MEDIA]) + return -EINVAL; +@@ -1177,7 +1177,7 @@ int __tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info) + int err; + char *name; + struct tipc_media *m; +- struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1]; ++ struct nlattr *attrs[TIPC_NLA_MEDIA_MAX + 1]; + + if (!info->attrs[TIPC_NLA_MEDIA]) + return -EINVAL; +-- +2.39.2 + diff --git a/queue-4.19/netfilter-nfnetlink-skip-error-delivery-on-batch-in-.patch b/queue-4.19/netfilter-nfnetlink-skip-error-delivery-on-batch-in-.patch new file mode 100644 index 00000000000..3df7c668bd9 --- /dev/null +++ b/queue-4.19/netfilter-nfnetlink-skip-error-delivery-on-batch-in-.patch @@ -0,0 +1,36 @@ +From 4c7faeb82c3c4a3ddc80bc05f178f217b90264e0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 8 Jun 2023 00:19:12 +0200 +Subject: netfilter: nfnetlink: skip error delivery on batch in case of ENOMEM + +From: Pablo Neira Ayuso + +[ Upstream commit a1a64a151dae8ac3581c1cbde44b672045cb658b ] + +If caller reports ENOMEM, then stop iterating over the batch and send a +single netlink message to userspace to report OOM. + +Fixes: cbb8125eb40b ("netfilter: nfnetlink: deliver netlink errors on batch completion") +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + net/netfilter/nfnetlink.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c +index 39e369e18cb87..0267be2e9cfe8 100644 +--- a/net/netfilter/nfnetlink.c ++++ b/net/netfilter/nfnetlink.c +@@ -452,7 +452,8 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, + * processed, this avoids that the same error is + * reported several times when replaying the batch. + */ +- if (nfnl_err_add(&err_list, nlh, err, &extack) < 0) { ++ if (err == -ENOMEM || ++ nfnl_err_add(&err_list, nlh, err, &extack) < 0) { + /* We failed to enqueue an error, reset the + * list of errors and send OOM to userspace + * pointing to the batch header. +-- +2.39.2 + diff --git a/queue-4.19/ping6-fix-send-to-link-local-addresses-with-vrf.patch b/queue-4.19/ping6-fix-send-to-link-local-addresses-with-vrf.patch new file mode 100644 index 00000000000..cd0e5600d07 --- /dev/null +++ b/queue-4.19/ping6-fix-send-to-link-local-addresses-with-vrf.patch @@ -0,0 +1,58 @@ +From 8f5df26e54468fbad5da8246769cc7b48f90247f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 7 Jun 2023 18:05:02 +0200 +Subject: ping6: Fix send to link-local addresses with VRF. + +From: Guillaume Nault + +[ Upstream commit 91ffd1bae1dafbb9e34b46813f5b058581d9144d ] + +Ping sockets can't send packets when they're bound to a VRF master +device and the output interface is set to a slave device. + +For example, when net.ipv4.ping_group_range is properly set, so that +ping6 can use ping sockets, the following kind of commands fails: + $ ip vrf exec red ping6 fe80::854:e7ff:fe88:4bf1%eth1 + +What happens is that sk->sk_bound_dev_if is set to the VRF master +device, but 'oif' is set to the real output device. Since both are set +but different, ping_v6_sendmsg() sees their value as inconsistent and +fails. + +Fix this by allowing 'oif' to be a slave device of ->sk_bound_dev_if. + +This fixes the following kselftest failure: + $ ./fcnal-test.sh -t ipv6_ping + [...] + TEST: ping out, vrf device+address bind - ns-B IPv6 LLA [FAIL] + +Reported-by: Mirsad Todorovac +Closes: https://lore.kernel.org/netdev/b6191f90-ffca-dbca-7d06-88a9788def9c@alu.unizg.hr/ +Tested-by: Mirsad Todorovac +Fixes: 5e457896986e ("net: ipv6: Fix ping to link-local addresses.") +Signed-off-by: Guillaume Nault +Reviewed-by: David Ahern +Link: https://lore.kernel.org/r/6c8b53108816a8d0d5705ae37bdc5a8322b5e3d9.1686153846.git.gnault@redhat.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/ipv6/ping.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c +index 5c9be8594483f..e065f49a4ae38 100644 +--- a/net/ipv6/ping.c ++++ b/net/ipv6/ping.c +@@ -101,7 +101,8 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) + addr_type = ipv6_addr_type(daddr); + if ((__ipv6_addr_needs_scope_id(addr_type) && !oif) || + (addr_type & IPV6_ADDR_MAPPED) || +- (oif && sk->sk_bound_dev_if && oif != sk->sk_bound_dev_if)) ++ (oif && sk->sk_bound_dev_if && oif != sk->sk_bound_dev_if && ++ l3mdev_master_ifindex_by_index(sock_net(sk), oif) != sk->sk_bound_dev_if)) + return -EINVAL; + + /* TODO: use ip6_datagram_send_ctl to get options from cmsg */ +-- +2.39.2 + diff --git a/queue-4.19/rdma-rxe-fix-the-use-before-initialization-error-of-.patch b/queue-4.19/rdma-rxe-fix-the-use-before-initialization-error-of-.patch new file mode 100644 index 00000000000..ca90bb758c1 --- /dev/null +++ b/queue-4.19/rdma-rxe-fix-the-use-before-initialization-error-of-.patch @@ -0,0 +1,82 @@ +From a50fa15304430657eb4194fcce5796775a8b73f3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 2 Jun 2023 11:54:08 +0800 +Subject: RDMA/rxe: Fix the use-before-initialization error of resp_pkts + +From: Zhu Yanjun + +[ Upstream commit 2a62b6210ce876c596086ab8fd4c8a0c3d10611a ] + +In the following: + + Call Trace: + + __dump_stack lib/dump_stack.c:88 [inline] + dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 + assign_lock_key kernel/locking/lockdep.c:982 [inline] + register_lock_class+0xdb6/0x1120 kernel/locking/lockdep.c:1295 + __lock_acquire+0x10a/0x5df0 kernel/locking/lockdep.c:4951 + lock_acquire kernel/locking/lockdep.c:5691 [inline] + lock_acquire+0x1b1/0x520 kernel/locking/lockdep.c:5656 + __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] + _raw_spin_lock_irqsave+0x3d/0x60 kernel/locking/spinlock.c:162 + skb_dequeue+0x20/0x180 net/core/skbuff.c:3639 + drain_resp_pkts drivers/infiniband/sw/rxe/rxe_comp.c:555 [inline] + rxe_completer+0x250d/0x3cc0 drivers/infiniband/sw/rxe/rxe_comp.c:652 + rxe_qp_do_cleanup+0x1be/0x820 drivers/infiniband/sw/rxe/rxe_qp.c:761 + execute_in_process_context+0x3b/0x150 kernel/workqueue.c:3473 + __rxe_cleanup+0x21e/0x370 drivers/infiniband/sw/rxe/rxe_pool.c:233 + rxe_create_qp+0x3f6/0x5f0 drivers/infiniband/sw/rxe/rxe_verbs.c:583 + +This is a use-before-initialization problem. + +It happens because rxe_qp_do_cleanup is called during error unwind before +the struct has been fully initialized. + +Move the initialization of the skb earlier. + +Fixes: 8700e3e7c485 ("Soft RoCE driver") +Link: https://lore.kernel.org/r/20230602035408.741534-1-yanjun.zhu@intel.com +Reported-by: syzbot+eba589d8f49c73d356da@syzkaller.appspotmail.com +Signed-off-by: Zhu Yanjun +Signed-off-by: Jason Gunthorpe +Signed-off-by: Sasha Levin +--- + drivers/infiniband/sw/rxe/rxe_qp.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c +index b137ed1c74af1..73009bf8a9c0b 100644 +--- a/drivers/infiniband/sw/rxe/rxe_qp.c ++++ b/drivers/infiniband/sw/rxe/rxe_qp.c +@@ -218,6 +218,9 @@ static void rxe_qp_init_misc(struct rxe_dev *rxe, struct rxe_qp *qp, + spin_lock_init(&qp->rq.producer_lock); + spin_lock_init(&qp->rq.consumer_lock); + ++ skb_queue_head_init(&qp->req_pkts); ++ skb_queue_head_init(&qp->resp_pkts); ++ + atomic_set(&qp->ssn, 0); + atomic_set(&qp->skb_out, 0); + } +@@ -266,8 +269,6 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp, + qp->req.opcode = -1; + qp->comp.opcode = -1; + +- skb_queue_head_init(&qp->req_pkts); +- + rxe_init_task(&qp->req.task, qp, rxe_requester); + rxe_init_task(&qp->comp.task, qp, rxe_completer); + +@@ -313,8 +314,6 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp, + } + } + +- skb_queue_head_init(&qp->resp_pkts); +- + rxe_init_task(&qp->resp.task, qp, rxe_responder); + + qp->resp.opcode = OPCODE_NONE; +-- +2.39.2 + diff --git a/queue-4.19/rdma-rxe-remove-the-unused-variable-obj.patch b/queue-4.19/rdma-rxe-remove-the-unused-variable-obj.patch new file mode 100644 index 00000000000..0fc101f25cf --- /dev/null +++ b/queue-4.19/rdma-rxe-remove-the-unused-variable-obj.patch @@ -0,0 +1,90 @@ +From 26afb87c9be401cb49f331bfd457812fcdc77227 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 21 Aug 2022 21:16:15 -0400 +Subject: RDMA/rxe: Remove the unused variable obj + +From: Zhu Yanjun + +[ Upstream commit f07853582d1f6ed282f8d9a0b1209a87dd761f58 ] + +The member variable obj in struct rxe_task is not needed. +So remove it to save memory. + +Link: https://lore.kernel.org/r/20220822011615.805603-4-yanjun.zhu@linux.dev +Signed-off-by: Zhu Yanjun +Reviewed-by: Li Zhijian +Reviewed-by: Bob Pearson +Signed-off-by: Leon Romanovsky +Stable-dep-of: 2a62b6210ce8 ("RDMA/rxe: Fix the use-before-initialization error of resp_pkts") +Signed-off-by: Sasha Levin +--- + drivers/infiniband/sw/rxe/rxe_qp.c | 6 +++--- + drivers/infiniband/sw/rxe/rxe_task.c | 3 +-- + drivers/infiniband/sw/rxe/rxe_task.h | 3 +-- + 3 files changed, 5 insertions(+), 7 deletions(-) + +diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c +index 2cae62ae6c64a..a797b5d23f507 100644 +--- a/drivers/infiniband/sw/rxe/rxe_qp.c ++++ b/drivers/infiniband/sw/rxe/rxe_qp.c +@@ -268,9 +268,9 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp, + + skb_queue_head_init(&qp->req_pkts); + +- rxe_init_task(rxe, &qp->req.task, qp, ++ rxe_init_task(&qp->req.task, qp, + rxe_requester, "req"); +- rxe_init_task(rxe, &qp->comp.task, qp, ++ rxe_init_task(&qp->comp.task, qp, + rxe_completer, "comp"); + + qp->qp_timeout_jiffies = 0; /* Can't be set for UD/UC in modify_qp */ +@@ -317,7 +317,7 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp, + + skb_queue_head_init(&qp->resp_pkts); + +- rxe_init_task(rxe, &qp->resp.task, qp, ++ rxe_init_task(&qp->resp.task, qp, + rxe_responder, "resp"); + + qp->resp.opcode = OPCODE_NONE; +diff --git a/drivers/infiniband/sw/rxe/rxe_task.c b/drivers/infiniband/sw/rxe/rxe_task.c +index 08f05ac5f5d52..ea7d5a69eb2a3 100644 +--- a/drivers/infiniband/sw/rxe/rxe_task.c ++++ b/drivers/infiniband/sw/rxe/rxe_task.c +@@ -114,10 +114,9 @@ void rxe_do_task(unsigned long data) + task->ret = ret; + } + +-int rxe_init_task(void *obj, struct rxe_task *task, ++int rxe_init_task(struct rxe_task *task, + void *arg, int (*func)(void *), char *name) + { +- task->obj = obj; + task->arg = arg; + task->func = func; + snprintf(task->name, sizeof(task->name), "%s", name); +diff --git a/drivers/infiniband/sw/rxe/rxe_task.h b/drivers/infiniband/sw/rxe/rxe_task.h +index 08ff42d451c62..e87ee072e3179 100644 +--- a/drivers/infiniband/sw/rxe/rxe_task.h ++++ b/drivers/infiniband/sw/rxe/rxe_task.h +@@ -46,7 +46,6 @@ enum { + * called again. + */ + struct rxe_task { +- void *obj; + struct tasklet_struct tasklet; + int state; + spinlock_t state_lock; /* spinlock for task state */ +@@ -62,7 +61,7 @@ struct rxe_task { + * arg => parameter to pass to fcn + * fcn => function to call until it returns != 0 + */ +-int rxe_init_task(void *obj, struct rxe_task *task, ++int rxe_init_task(struct rxe_task *task, + void *arg, int (*func)(void *), char *name); + + /* cleanup task */ +-- +2.39.2 + diff --git a/queue-4.19/rdma-rxe-removed-unused-name-from-rxe_task-struct.patch b/queue-4.19/rdma-rxe-removed-unused-name-from-rxe_task-struct.patch new file mode 100644 index 00000000000..05db52bc2d1 --- /dev/null +++ b/queue-4.19/rdma-rxe-removed-unused-name-from-rxe_task-struct.patch @@ -0,0 +1,93 @@ +From bc77122e4cc55d9029215906fc116a1d4ac929ac Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Oct 2022 15:01:04 -0500 +Subject: RDMA/rxe: Removed unused name from rxe_task struct + +From: Bob Pearson + +[ Upstream commit de669ae8af49ceed0eed44f5b3d51dc62affc5e4 ] + +The name field in struct rxe_task is never used. This patch removes it. + +Link: https://lore.kernel.org/r/20221021200118.2163-4-rpearsonhpe@gmail.com +Signed-off-by: Ian Ziemba +Signed-off-by: Bob Pearson +Signed-off-by: Jason Gunthorpe +Stable-dep-of: 2a62b6210ce8 ("RDMA/rxe: Fix the use-before-initialization error of resp_pkts") +Signed-off-by: Sasha Levin +--- + drivers/infiniband/sw/rxe/rxe_qp.c | 9 +++------ + drivers/infiniband/sw/rxe/rxe_task.c | 4 +--- + drivers/infiniband/sw/rxe/rxe_task.h | 4 +--- + 3 files changed, 5 insertions(+), 12 deletions(-) + +diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c +index a797b5d23f507..b137ed1c74af1 100644 +--- a/drivers/infiniband/sw/rxe/rxe_qp.c ++++ b/drivers/infiniband/sw/rxe/rxe_qp.c +@@ -268,10 +268,8 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp, + + skb_queue_head_init(&qp->req_pkts); + +- rxe_init_task(&qp->req.task, qp, +- rxe_requester, "req"); +- rxe_init_task(&qp->comp.task, qp, +- rxe_completer, "comp"); ++ rxe_init_task(&qp->req.task, qp, rxe_requester); ++ rxe_init_task(&qp->comp.task, qp, rxe_completer); + + qp->qp_timeout_jiffies = 0; /* Can't be set for UD/UC in modify_qp */ + if (init->qp_type == IB_QPT_RC) { +@@ -317,8 +315,7 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp, + + skb_queue_head_init(&qp->resp_pkts); + +- rxe_init_task(&qp->resp.task, qp, +- rxe_responder, "resp"); ++ rxe_init_task(&qp->resp.task, qp, rxe_responder); + + qp->resp.opcode = OPCODE_NONE; + qp->resp.msn = 0; +diff --git a/drivers/infiniband/sw/rxe/rxe_task.c b/drivers/infiniband/sw/rxe/rxe_task.c +index ea7d5a69eb2a3..39b3adda16550 100644 +--- a/drivers/infiniband/sw/rxe/rxe_task.c ++++ b/drivers/infiniband/sw/rxe/rxe_task.c +@@ -114,12 +114,10 @@ void rxe_do_task(unsigned long data) + task->ret = ret; + } + +-int rxe_init_task(struct rxe_task *task, +- void *arg, int (*func)(void *), char *name) ++int rxe_init_task(struct rxe_task *task, void *arg, int (*func)(void *)) + { + task->arg = arg; + task->func = func; +- snprintf(task->name, sizeof(task->name), "%s", name); + task->destroyed = false; + + tasklet_init(&task->tasklet, rxe_do_task, (unsigned long)task); +diff --git a/drivers/infiniband/sw/rxe/rxe_task.h b/drivers/infiniband/sw/rxe/rxe_task.h +index e87ee072e3179..ecd81b1d1a8cb 100644 +--- a/drivers/infiniband/sw/rxe/rxe_task.h ++++ b/drivers/infiniband/sw/rxe/rxe_task.h +@@ -52,7 +52,6 @@ struct rxe_task { + void *arg; + int (*func)(void *arg); + int ret; +- char name[16]; + bool destroyed; + }; + +@@ -61,8 +60,7 @@ struct rxe_task { + * arg => parameter to pass to fcn + * fcn => function to call until it returns != 0 + */ +-int rxe_init_task(struct rxe_task *task, +- void *arg, int (*func)(void *), char *name); ++int rxe_init_task(struct rxe_task *task, void *arg, int (*func)(void *)); + + /* cleanup task */ + void rxe_cleanup_task(struct rxe_task *task); +-- +2.39.2 + diff --git a/queue-4.19/sctp-fix-an-error-code-in-sctp_sf_eat_auth.patch b/queue-4.19/sctp-fix-an-error-code-in-sctp_sf_eat_auth.patch new file mode 100644 index 00000000000..2f9145c9533 --- /dev/null +++ b/queue-4.19/sctp-fix-an-error-code-in-sctp_sf_eat_auth.patch @@ -0,0 +1,38 @@ +From 397231cb6c09bcbd2c6166f5f3f693eb91b57526 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 9 Jun 2023 14:05:19 +0300 +Subject: sctp: fix an error code in sctp_sf_eat_auth() + +From: Dan Carpenter + +[ Upstream commit 75e6def3b26736e7ff80639810098c9074229737 ] + +The sctp_sf_eat_auth() function is supposed to enum sctp_disposition +values and returning a kernel error code will cause issues in the +caller. Change -ENOMEM to SCTP_DISPOSITION_NOMEM. + +Fixes: 65b07e5d0d09 ("[SCTP]: API updates to suport SCTP-AUTH extensions.") +Signed-off-by: Dan Carpenter +Acked-by: Xin Long +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/sctp/sm_statefuns.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c +index 3d52431dea9bf..8298f27e8de0d 100644 +--- a/net/sctp/sm_statefuns.c ++++ b/net/sctp/sm_statefuns.c +@@ -4392,7 +4392,7 @@ enum sctp_disposition sctp_sf_eat_auth(struct net *net, + SCTP_AUTH_NEW_KEY, GFP_ATOMIC); + + if (!ev) +- return -ENOMEM; ++ return SCTP_DISPOSITION_NOMEM; + + sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, + SCTP_ULPEVENT(ev)); +-- +2.39.2 + diff --git a/queue-4.19/selftests-ptp-fix-timestamp-printf-format-for-ptp_sy.patch b/queue-4.19/selftests-ptp-fix-timestamp-printf-format-for-ptp_sy.patch new file mode 100644 index 00000000000..270eff850d8 --- /dev/null +++ b/queue-4.19/selftests-ptp-fix-timestamp-printf-format-for-ptp_sy.patch @@ -0,0 +1,50 @@ +From f705f8fac6a6c14e8596ba371b936c9155c174a8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 15 Jun 2023 09:34:04 +0100 +Subject: selftests/ptp: Fix timestamp printf format for PTP_SYS_OFFSET + +From: Alex Maftei + +[ Upstream commit 76a4c8b82938bc5020b67663db41f451684bf327 ] + +Previously, timestamps were printed using "%lld.%u" which is incorrect +for nanosecond values lower than 100,000,000 as they're fractional +digits, therefore leading zeros are meaningful. + +This patch changes the format strings to "%lld.%09u" in order to add +leading zeros to the nanosecond value. + +Fixes: 568ebc5985f5 ("ptp: add the PTP_SYS_OFFSET ioctl to the testptp program") +Fixes: 4ec54f95736f ("ptp: Fix compiler warnings in the testptp utility") +Fixes: 6ab0e475f1f3 ("Documentation: fix misc. warnings") +Signed-off-by: Alex Maftei +Acked-by: Richard Cochran +Link: https://lore.kernel.org/r/20230615083404.57112-1-alex.maftei@amd.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/ptp/testptp.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tools/testing/selftests/ptp/testptp.c b/tools/testing/selftests/ptp/testptp.c +index a5d8f0ab0da00..60f0f24cee30e 100644 +--- a/tools/testing/selftests/ptp/testptp.c ++++ b/tools/testing/selftests/ptp/testptp.c +@@ -502,11 +502,11 @@ int main(int argc, char *argv[]) + interval = t2 - t1; + offset = (t2 + t1) / 2 - tp; + +- printf("system time: %lld.%u\n", ++ printf("system time: %lld.%09u\n", + (pct+2*i)->sec, (pct+2*i)->nsec); +- printf("phc time: %lld.%u\n", ++ printf("phc time: %lld.%09u\n", + (pct+2*i+1)->sec, (pct+2*i+1)->nsec); +- printf("system time: %lld.%u\n", ++ printf("system time: %lld.%09u\n", + (pct+2*i+2)->sec, (pct+2*i+2)->nsec); + printf("system/phc clock time offset is %" PRId64 " ns\n" + "system clock time delay is %" PRId64 " ns\n", +-- +2.39.2 + diff --git a/queue-4.19/series b/queue-4.19/series index 2acab016e11..6855ab4def0 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -25,3 +25,20 @@ usb-serial-option-add-quectel-em061kgl-series.patch usb-dwc3-gadget-reset-num-trbs-before-giving-back-the-request.patch usb-gadget-f_ncm-add-os-descriptor-support.patch usb-gadget-f_ncm-fix-ntp-32-support.patch +netfilter-nfnetlink-skip-error-delivery-on-batch-in-.patch +ping6-fix-send-to-link-local-addresses-with-vrf.patch +rdma-rxe-remove-the-unused-variable-obj.patch +rdma-rxe-removed-unused-name-from-rxe_task-struct.patch +rdma-rxe-fix-the-use-before-initialization-error-of-.patch +ib-uverbs-fix-to-consider-event-queue-closing-also-u.patch +ib-isert-fix-dead-lock-in-ib_isert.patch +ib-isert-fix-possible-list-corruption-in-cma-handler.patch +ib-isert-fix-incorrect-release-of-isert-connection.patch +sctp-fix-an-error-code-in-sctp_sf_eat_auth.patch +igb-fix-nvm.ops.read-error-handling.patch +drm-nouveau-dp-check-for-null-nv_connector-native_mo.patch +drm-nouveau-kms-don-t-change-edid-when-it-hasn-t-act.patch +drm-nouveau-add-nv_encoder-pointer-check-for-null.patch +net-lapbether-only-support-ethernet-devices.patch +net-tipc-resize-nlattr-array-to-correct-size.patch +selftests-ptp-fix-timestamp-printf-format-for-ptp_sy.patch