From: Greg Kroah-Hartman Date: Mon, 24 Jul 2023 06:34:00 +0000 (+0200) Subject: 6.1-stable patches X-Git-Tag: v6.1.41~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2e0136bfa4e60aed138a49faf3e9886332486906;p=thirdparty%2Fkernel%2Fstable-queue.git 6.1-stable patches added patches: drm-ttm-fix-bulk_move-corruption-when-adding-a-entry.patch tracing-histograms-return-an-error-if-we-fail-to-add-histogram-to-hist_vars-list.patch --- diff --git a/queue-6.1/drm-ttm-fix-bulk_move-corruption-when-adding-a-entry.patch b/queue-6.1/drm-ttm-fix-bulk_move-corruption-when-adding-a-entry.patch new file mode 100644 index 00000000000..af369b38cef --- /dev/null +++ b/queue-6.1/drm-ttm-fix-bulk_move-corruption-when-adding-a-entry.patch @@ -0,0 +1,49 @@ +From 4481913607e58196c48a4fef5e6f45350684ec3c Mon Sep 17 00:00:00 2001 +From: Yunxiang Li +Date: Thu, 22 Jun 2023 10:18:03 -0400 +Subject: drm/ttm: fix bulk_move corruption when adding a entry +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Yunxiang Li + +commit 4481913607e58196c48a4fef5e6f45350684ec3c upstream. + +When the resource is the first in the bulk_move range, adding it again +(thus moving it to the tail) will corrupt the list since the first +pointer is not moved. This eventually lead to null pointer deref in +ttm_lru_bulk_move_del() + +Fixes: fee2ede15542 ("drm/ttm: rework bulk move handling v5") +Signed-off-by: Yunxiang Li +Reviewed-by: Christian König +CC: stable@vger.kernel.org +Link: https://patchwork.freedesktop.org/patch/msgid/20230622141902.28718-3-Yunxiang.Li@amd.com +Signed-off-by: Christian König +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/ttm/ttm_resource.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/ttm/ttm_resource.c ++++ b/drivers/gpu/drm/ttm/ttm_resource.c +@@ -85,6 +85,8 @@ static void ttm_lru_bulk_move_pos_tail(s + struct ttm_resource *res) + { + if (pos->last != res) { ++ if (pos->first == res) ++ pos->first = list_next_entry(res, lru); + list_move(&res->lru, &pos->last->lru); + pos->last = res; + } +@@ -110,7 +112,8 @@ static void ttm_lru_bulk_move_del(struct + { + struct ttm_lru_bulk_move_pos *pos = ttm_lru_bulk_move_pos(bulk, res); + +- if (unlikely(pos->first == res && pos->last == res)) { ++ if (unlikely(WARN_ON(!pos->first || !pos->last) || ++ (pos->first == res && pos->last == res))) { + pos->first = NULL; + pos->last = NULL; + } else if (pos->first == res) { diff --git a/queue-6.1/series b/queue-6.1/series index a0865c95365..a765f856792 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -163,3 +163,5 @@ tcp-annotate-data-races-around-icsk-icsk_user_timeou.patch tcp-annotate-data-races-around-fastopenq.max_qlen.patch net-phy-prevent-stale-pointer-dereference-in-phy_ini.patch jbd2-recheck-chechpointing-non-dirty-buffer.patch +tracing-histograms-return-an-error-if-we-fail-to-add-histogram-to-hist_vars-list.patch +drm-ttm-fix-bulk_move-corruption-when-adding-a-entry.patch diff --git a/queue-6.1/tracing-histograms-return-an-error-if-we-fail-to-add-histogram-to-hist_vars-list.patch b/queue-6.1/tracing-histograms-return-an-error-if-we-fail-to-add-histogram-to-hist_vars-list.patch new file mode 100644 index 00000000000..59cc678e6f6 --- /dev/null +++ b/queue-6.1/tracing-histograms-return-an-error-if-we-fail-to-add-histogram-to-hist_vars-list.patch @@ -0,0 +1,38 @@ +From 4b8b3905165ef98386a3c06f196c85d21292d029 Mon Sep 17 00:00:00 2001 +From: Mohamed Khalfella +Date: Fri, 14 Jul 2023 20:33:41 +0000 +Subject: tracing/histograms: Return an error if we fail to add histogram to hist_vars list + +From: Mohamed Khalfella + +commit 4b8b3905165ef98386a3c06f196c85d21292d029 upstream. + +Commit 6018b585e8c6 ("tracing/histograms: Add histograms to hist_vars if +they have referenced variables") added a check to fail histogram creation +if save_hist_vars() failed to add histogram to hist_vars list. But the +commit failed to set ret to failed return code before jumping to +unregister histogram, fix it. + +Link: https://lore.kernel.org/linux-trace-kernel/20230714203341.51396-1-mkhalfella@purestorage.com + +Cc: stable@vger.kernel.org +Fixes: 6018b585e8c6 ("tracing/histograms: Add histograms to hist_vars if they have referenced variables") +Signed-off-by: Mohamed Khalfella +Signed-off-by: Steven Rostedt (Google) +Signed-off-by: Greg Kroah-Hartman +--- + kernel/trace/trace_events_hist.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/kernel/trace/trace_events_hist.c ++++ b/kernel/trace/trace_events_hist.c +@@ -6560,7 +6560,8 @@ static int event_hist_trigger_parse(stru + goto out_unreg; + + if (has_hist_vars(hist_data) || hist_data->n_var_refs) { +- if (save_hist_vars(hist_data)) ++ ret = save_hist_vars(hist_data); ++ if (ret) + goto out_unreg; + } +