From: Frank Li <Frank.li@oss.nxp.com>
To: SeungUk Nam <tmddnr49449@gmail.com>
Cc: Vinicius Costa Gomes <vinicius.gomes@intel.com>,
Vinod Koul <vkoul@kernel.org>, Dave Jiang <dave.jiang@intel.com>,
Frank Li <Frank.Li@kernel.org>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dmaengine: idxd: Free the minor number when cdev setup fails
Date: Thu, 1 Oct 2026 16:56:11 -0400 [thread overview]
Message-ID: <ar7I66RYnxUokeNS@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260910074832.15729-1-tmddnr49449@gmail.com>
On Thu, Sep 10, 2026 at 04:48:32PM +0900, SeungUk Nam wrote:
> idxd_wq_add_cdev() allocates a minor number from cdev_ctx->minor_ida for
> the new struct idxd_cdev. When dev_set_name() or cdev_device_add()
> fails, the error path calls put_device(), and the release callback
> idxd_cdev_dev_release() only frees idxd_cdev, so the minor number is
> never returned to the ida. Leaked numbers accumulate across bind/unbind
> cycles, up to MINORMASK, for as long as the module stays loaded.
>
> Free the minor number before put_device() drops the last reference on
> that path.
>
> Fixes: c311f5e92484 ("dmaengine: idxd: Fix freeing the allocated ida too late")
> Signed-off-by: SeungUk Nam <tmddnr49449@gmail.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
> Found by code inspection; the error path was not exercised at runtime.
>
> drivers/dma/idxd/cdev.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/dma/idxd/cdev.c b/drivers/dma/idxd/cdev.c
> index 82b07cf942ef..f1af7f0d25d3 100644
> --- a/drivers/dma/idxd/cdev.c
> +++ b/drivers/dma/idxd/cdev.c
> @@ -573,6 +573,7 @@ int idxd_wq_add_cdev(struct idxd_wq *wq)
> return 0;
>
> err:
> + ida_free(&cdev_ctx->minor_ida, minor);
> put_device(dev);
> wq->idxd_cdev = NULL;
> return rc;
> --
> 2.34.1
>
next prev parent reply other threads:[~2026-10-01 20:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 7:48 SeungUk Nam
2026-10-01 20:56 ` Frank Li [this message]
2026-11-20 10:04 ` Vinod Koul
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=ar7I66RYnxUokeNS@lizhi-Precision-Tower-5810 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@kernel.org \
--cc=dave.jiang@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tmddnr49449@gmail.com \
--cc=vinicius.gomes@intel.com \
--cc=vkoul@kernel.org \
/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
all inboxes | Powered by JetHome®