From: Chen Pei <cp0613@linux.alibaba.com>
To: alison.schofield@intel.com, dave.jiang@intel.com,
jic23@kernel.org, nvdimm@lists.linux.dev
Cc: guoren@kernel.org, linux-cxl@vger.kernel.org
Subject: [ndctl PATCH v3 1/2] daxctl: fix kmod reference leak on probe-insert failure
Date: Thu, 18 Jun 2026 17:06:52 +0800 [thread overview]
Message-ID: <20260618090653.8983-2-cp0613@linux.alibaba.com> (raw)
In-Reply-To: <20260618090653.8983-1-cp0613@linux.alibaba.com>
daxctl_insert_kmod_for_mode() obtains a kmod reference via
kmod_module_new_from_name() and only stores it in dev->module after a
successful kmod_module_probe_insert_module() call. On the failure path
the local reference was returned without being released, leaking one
reference per failed enable attempt.
Drop the reference before returning the error code.
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
---
daxctl/lib/libdaxctl.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/daxctl/lib/libdaxctl.c b/daxctl/lib/libdaxctl.c
index 01b1915..8c3ac47 100644
--- a/daxctl/lib/libdaxctl.c
+++ b/daxctl/lib/libdaxctl.c
@@ -975,6 +975,7 @@ static int daxctl_insert_kmod_for_mode(struct daxctl_dev *dev,
NULL, NULL, NULL, NULL);
if (rc < 0) {
err(ctx, "%s: insert failure: %d\n", devname, rc);
+ kmod_module_unref(kmod);
return rc;
}
dev->module = kmod;
--
2.43.0
next prev parent reply other threads:[~2026-06-18 9:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-18 9:06 [ndctl PATCH v3 0/2] daxctl, util/sysfs: fix builtin-driver false failure on enable Chen Pei
2026-06-18 9:06 ` Chen Pei [this message]
2026-06-18 9:06 ` [ndctl PATCH v3 2/2] daxctl, util/sysfs: skip module probe-insert when driver is builtin or live Chen Pei
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=20260618090653.8983-2-cp0613@linux.alibaba.com \
--to=cp0613@linux.alibaba.com \
--cc=alison.schofield@intel.com \
--cc=dave.jiang@intel.com \
--cc=guoren@kernel.org \
--cc=jic23@kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.