From: Markus Elfring <Markus.Elfring@web.de>
To: Shuai Xue <xueshuai@linux.alibaba.com>,
dmaengine@vger.kernel.org, Dave Jiang <dave.jiang@intel.com>,
Vinicius Costa Gomes <vinicius.gomes@intel.com>,
Vinod Koul <vkoul@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Fenghua Yu <fenghua.yu@intel.com>,
Nikhil Rao <nikhil.rao@intel.com>
Subject: Re: [PATCH v2 1/7] dmaengine: idxd: fix memory leak in error handling path of idxd_setup_wqs()
Date: Sat, 15 Feb 2025 12:00:34 +0100 [thread overview]
Message-ID: <98327a4d-7684-4908-9d67-5dfcaa229ae1@web.de> (raw)
In-Reply-To: <20250215054431.55747-2-xueshuai@linux.alibaba.com>
> Memory allocated for wqs is not freed if an error occurs during
> idxd_setup_wqs(). To fix it, free the allocated memory in the reverse
> order of allocation before exiting the function in case of an error.
>
> Fixes: a8563a33a5e2 ("dmanegine: idxd: reformat opcap output to match bitmap_parse() input")
…
Will a “stable tag” become relevant also for this patch series?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/stable-kernel-rules.rst?h=v6.14-rc2#n3
> +++ b/drivers/dma/idxd/init.c
> @@ -169,8 +169,8 @@ static int idxd_setup_wqs(struct idxd_device *idxd)
…
> @@ -204,6 +205,7 @@ static int idxd_setup_wqs(struct idxd_device *idxd)
> wq->wqcfg = kzalloc_node(idxd->wqcfg_size, GFP_KERNEL, dev_to_node(dev));
> if (!wq->wqcfg) {
> put_device(conf_dev);
> + kfree(wq);
> rc = -ENOMEM;
> goto err;
> }
…
I got the impression that more common exception handling code could be moved
to additional jump targets at the end of such function implementations.
Will further adjustment opportunities be taken into account for
the affected resource management?
Regards,
Markus
next prev parent reply other threads:[~2025-02-15 11:01 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-15 5:44 [PATCH v2 0/7] dmaengine: idxd: fix memory leak in error handling path Shuai Xue
2025-02-15 5:44 ` [PATCH v2 1/7] dmaengine: idxd: fix memory leak in error handling path of idxd_setup_wqs Shuai Xue
2025-02-15 11:00 ` Markus Elfring [this message]
2025-02-16 9:24 ` [PATCH v2 1/7] dmaengine: idxd: fix memory leak in error handling path of idxd_setup_wqs() Shuai Xue
2025-02-16 9:34 ` [v2 " Markus Elfring
2025-02-16 11:04 ` Shuai Xue
2025-02-15 13:34 ` [PATCH v2 1/7] dmaengine: idxd: fix memory leak in error handling path of idxd_setup_wqs Markus Elfring
2025-02-16 9:25 ` Shuai Xue
2025-02-18 16:32 ` Fenghua Yu
2025-02-19 9:08 ` Shuai Xue
2025-02-15 5:44 ` [PATCH v2 2/7] dmaengine: idxd: fix memory leak in error handling path of idxd_setup_engines Shuai Xue
2025-02-18 20:24 ` Fenghua Yu
2025-02-15 5:44 ` [PATCH v2 3/7] dmaengine: idxd: fix memory leak in error handling path of idxd_setup_groups Shuai Xue
2025-02-18 20:20 ` Fenghua Yu
2025-02-19 11:06 ` Shuai Xue
2025-02-15 5:44 ` [PATCH v2 4/7] dmaengine: idxd: fix memory leak in error handling path of idxd_alloc Shuai Xue
2025-02-15 5:44 ` [PATCH v2 5/7] dmaengine: idxd: fix memory leak in error handling path of idxd_pci_probe Shuai Xue
2025-02-18 20:21 ` Fenghua Yu
2025-02-19 12:28 ` Shuai Xue
2025-02-19 13:05 ` Shuai Xue
2025-02-15 5:44 ` [PATCH v2 6/7] dmaengine: idxd: Add missing idxd cleanup to fix memory leak in remove call Shuai Xue
2025-02-15 5:44 ` [PATCH v2 7/7] dmaengine: idxd: Refactor remove call with idxd_cleanup() helper Shuai Xue
2025-02-18 21:01 ` Fenghua Yu
2025-02-19 13:28 ` Shuai Xue
2025-03-03 2:01 ` Shuai Xue
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=98327a4d-7684-4908-9d67-5dfcaa229ae1@web.de \
--to=markus.elfring@web.de \
--cc=dave.jiang@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=fenghua.yu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nikhil.rao@intel.com \
--cc=vinicius.gomes@intel.com \
--cc=vkoul@kernel.org \
--cc=xueshuai@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox