FAILED: patch "[PATCH] dmaengine: idxd: Add missing cleanup for early error out in" failed to apply to 5.15-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x 61259fb96e023f7299c442c48b13e72c441fc0f2
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025051921-smother-limpness-650a@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 61259fb96e023f7299c442c48b13e72c441fc0f2 Mon Sep 17 00:00:00 2001
From: Shuai Xue <[email protected]>
Date: Fri, 4 Apr 2025 20:02:12 +0800
Subject: [PATCH] dmaengine: idxd: Add missing cleanup for early error out in
idxd_setup_internals
The idxd_setup_internals() is missing some cleanup when things fail in the middle.
Add the appropriate cleanup routines:
- cleanup groups
- cleanup enginces
- cleanup wqs
to make sure it exits gracefully.
drivers/dma/idxd/init.c +51 -7
@@ -155,6 +155,25 @@ static void idxd_cleanup_interrupts(struct idxd_device *idxd)pci_free_irq_vectors (pdev); } +static void idxd_clean_wqs (struct idxd_device *idxd) +{ +struct idxd_wq *wq; +struct device *conf_dev; +int i; + +for (i =0 ; i < idxd->max_wqs; i++) { + wq = idxd->wqs[i]; +if (idxd->hw.wq_cap.op_config) +bitmap_free (wq->opcap_bmap); +kfree (wq->wqcfg); + conf_dev =wq_confdev (wq); +put_device (conf_dev); +kfree (wq); + } +bitmap_free (idxd->wq_enable_map); +kfree (idxd->wqs); +} +static int idxd_setup_wqs (struct idxd_device *idxd) {struct device *dev = &idxd->pdev->dev;
@@ -245,6 +264,21 @@ static int idxd_setup_wqs(struct idxd_device *idxd)return rc; } +static void idxd_clean_engines (struct idxd_device *idxd) +{ +struct idxd_engine *engine; +struct device *conf_dev; +int i; + +for (i =0 ; i < idxd->max_engines; i++) { + engine = idxd->engines[i]; + conf_dev =engine_confdev (engine); +put_device (conf_dev); +kfree (engine); + } +kfree (idxd->engines); +} +static int idxd_setup_engines (struct idxd_device *idxd) {struct idxd_engine *engine;
@@ -296,6 +330,19 @@ static int idxd_setup_engines(struct idxd_device *idxd)return rc; } +static void idxd_clean_groups (struct idxd_device *idxd) +{ +struct idxd_group *group; +int i; + +for (i =0 ; i < idxd->max_groups; i++) { + group = idxd->groups[i]; +put_device (group_confdev (group)); +kfree (group); + } +kfree (idxd->groups); +} +static int idxd_setup_groups (struct idxd_device *idxd) {struct device *dev = &idxd->pdev->dev;
@@ -410,7 +457,7 @@ static int idxd_init_evl(struct idxd_device *idxd)static int idxd_setup_internals (struct idxd_device *idxd) {struct device *dev = &idxd->pdev->dev; -int rc, i; +int rc;init_waitqueue_head (&idxd->cmd_waitq);
@@ -441,14 +488,11 @@ static int idxd_setup_internals(struct idxd_device *idxd) err_evl:destroy_workqueue (idxd->wq); err_wkq_create: -for (i =0 ; i < idxd->max_groups; i++) -put_device (group_confdev (idxd->groups[i])); +idxd_clean_groups (idxd); err_group: -for (i =0 ; i < idxd->max_engines; i++) -put_device (engine_confdev (idxd->engines[i])); +idxd_clean_engines (idxd); err_engine: -for (i =0 ; i < idxd->max_wqs; i++) -put_device (wq_confdev (idxd->wqs[i])); +idxd_clean_wqs (idxd); err_wqs:return rc; }