From 2d4dea80331fc08d3dc5f80e01fc43d3046bb975 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 12 Dec 2024 15:15:07 +0100 Subject: [PATCH] 5.4-stable patches added patches: bpf-xdp-update-devmap-comments-to-reflect-napi-rcu-usage.patch --- ...p-comments-to-reflect-napi-rcu-usage.patch | 64 +++++++++++++++++++ ...to-dc_sink-in-is_dsc_need_re_compute.patch | 59 ----------------- queue-5.4/series | 2 +- 3 files changed, 65 insertions(+), 60 deletions(-) create mode 100644 queue-5.4/bpf-xdp-update-devmap-comments-to-reflect-napi-rcu-usage.patch delete mode 100644 queue-5.4/drm-amd-display-don-t-refer-to-dc_sink-in-is_dsc_need_re_compute.patch diff --git a/queue-5.4/bpf-xdp-update-devmap-comments-to-reflect-napi-rcu-usage.patch b/queue-5.4/bpf-xdp-update-devmap-comments-to-reflect-napi-rcu-usage.patch new file mode 100644 index 00000000000..d7799d5e56a --- /dev/null +++ b/queue-5.4/bpf-xdp-update-devmap-comments-to-reflect-napi-rcu-usage.patch @@ -0,0 +1,64 @@ +From 42a84a8cd0ff0cbff5a4595e1304c4567a30267d Mon Sep 17 00:00:00 2001 +From: John Fastabend +Date: Sun, 26 Jan 2020 16:14:00 -0800 +Subject: bpf, xdp: Update devmap comments to reflect napi/rcu usage +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: John Fastabend + +commit 42a84a8cd0ff0cbff5a4595e1304c4567a30267d upstream. + +Now that we rely on synchronize_rcu and call_rcu waiting to +exit perempt-disable regions (NAPI) lets update the comments +to reflect this. + +Fixes: 0536b85239b84 ("xdp: Simplify devmap cleanup") +Signed-off-by: John Fastabend +Signed-off-by: Daniel Borkmann +Acked-by: Björn Töpel +Acked-by: Song Liu +Link: https://lore.kernel.org/bpf/1580084042-11598-2-git-send-email-john.fastabend@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + kernel/bpf/devmap.c | 21 +++++++++++---------- + 1 file changed, 11 insertions(+), 10 deletions(-) + +--- a/kernel/bpf/devmap.c ++++ b/kernel/bpf/devmap.c +@@ -210,10 +210,12 @@ static void dev_map_free(struct bpf_map + + /* At this point bpf_prog->aux->refcnt == 0 and this map->refcnt == 0, + * so the programs (can be more than one that used this map) were +- * disconnected from events. Wait for outstanding critical sections in +- * these programs to complete. The rcu critical section only guarantees +- * no further reads against netdev_map. It does __not__ ensure pending +- * flush operations (if any) are complete. ++ * disconnected from events. The following synchronize_rcu() guarantees ++ * both rcu read critical sections complete and waits for ++ * preempt-disable regions (NAPI being the relevant context here) so we ++ * are certain there will be no further reads against the netdev_map and ++ * all flush operations are complete. Flush operations can only be done ++ * from NAPI context for this reason. + */ + + spin_lock(&dev_map_lock); +@@ -518,12 +520,11 @@ static int dev_map_delete_elem(struct bp + return -EINVAL; + + /* Use call_rcu() here to ensure any rcu critical sections have +- * completed, but this does not guarantee a flush has happened +- * yet. Because driver side rcu_read_lock/unlock only protects the +- * running XDP program. However, for pending flush operations the +- * dev and ctx are stored in another per cpu map. And additionally, +- * the driver tear down ensures all soft irqs are complete before +- * removing the net device in the case of dev_put equals zero. ++ * completed as well as any flush operations because call_rcu ++ * will wait for preempt-disable region to complete, NAPI in this ++ * context. And additionally, the driver tear down ensures all ++ * soft irqs are complete before removing the net device in the ++ * case of dev_put equals zero. + */ + old_dev = xchg(&dtab->netdev_map[k], NULL); + if (old_dev) diff --git a/queue-5.4/drm-amd-display-don-t-refer-to-dc_sink-in-is_dsc_need_re_compute.patch b/queue-5.4/drm-amd-display-don-t-refer-to-dc_sink-in-is_dsc_need_re_compute.patch deleted file mode 100644 index 8c57e5d0fe6..00000000000 --- a/queue-5.4/drm-amd-display-don-t-refer-to-dc_sink-in-is_dsc_need_re_compute.patch +++ /dev/null @@ -1,59 +0,0 @@ -From jianqi.ren.cn@windriver.com Thu Dec 12 13:11:21 2024 -From: -Date: Wed, 11 Dec 2024 18:15:44 +0800 -Subject: [PATCH 6.1.y] drm/amd/display: Don't refer to dc_sink in is_dsc_need_re_compute -To: , -Cc: , , , , , , , , , , , , , , , -Message-ID: <20241211101544.2121147-1-jianqi.ren.cn@windriver.com> - - -From: Wayne Lin - -[ Upstream commit fcf6a49d79923a234844b8efe830a61f3f0584e4 ] - -[Why] -When unplug one of monitors connected after mst hub, encounter null pointer dereference. - -It's due to dc_sink get released immediately in early_unregister() or detect_ctx(). When -commit new state which directly referring to info stored in dc_sink will cause null pointer -dereference. - -[how] -Remove redundant checking condition. Relevant condition should already be covered by checking -if dsc_aux is null or not. Also reset dsc_aux to NULL when the connector is disconnected. - -Reviewed-by: Jerry Zuo -Acked-by: Zaeem Mohamed -Signed-off-by: Wayne Lin -Tested-by: Daniel Wheeler -Signed-off-by: Alex Deucher -Signed-off-by: Jianqi Ren ---- - drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c -index 1acef5f3838f..a1619f4569cf 100644 ---- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c -+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c -@@ -183,6 +183,8 @@ amdgpu_dm_mst_connector_early_unregister(struct drm_connector *connector) - dc_sink_release(dc_sink); - aconnector->dc_sink = NULL; - aconnector->edid = NULL; -+ aconnector->dsc_aux = NULL; -+ port->passthrough_aux = NULL; - } - - aconnector->mst_status = MST_STATUS_DEFAULT; -@@ -487,6 +489,8 @@ dm_dp_mst_detect(struct drm_connector *connector, - dc_sink_release(aconnector->dc_sink); - aconnector->dc_sink = NULL; - aconnector->edid = NULL; -+ aconnector->dsc_aux = NULL; -+ port->passthrough_aux = NULL; - - amdgpu_dm_set_mst_status(&aconnector->mst_status, - MST_REMOTE_EDID | MST_ALLOCATE_NEW_PAYLOAD | MST_CLEAR_ALLOCATED_PAYLOAD, --- -2.25.1 - diff --git a/queue-5.4/series b/queue-5.4/series index bb42207f2c3..dcae87856d5 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -319,4 +319,4 @@ modpost-add-.irqentry.text-to-other_sections.patch revert-drm-amdgpu-add-missing-size-check-in-amdgpu_debugfs_gprwave_read.patch pci-rockchip-ep-fix-address-translation-unit-programming.patch alsa-usb-audio-fix-out-of-bounds-reads-when-finding-clock-sources.patch -drm-amd-display-don-t-refer-to-dc_sink-in-is_dsc_need_re_compute.patch +bpf-xdp-update-devmap-comments-to-reflect-napi-rcu-usage.patch -- 2.47.2