From: Chen Pei <cp0613@linux.alibaba.com>
To: alison.schofield@intel.com, nvdimm@lists.linux.dev
Cc: linux-cxl@vger.kernel.org, guoren@kernel.org,
Chen Pei <cp0613@linux.alibaba.com>
Subject: [ndctl PATCH 1/2] daxctl: fix kmod reference leak on probe-insert failure
Date: Thu, 14 May 2026 14:32:33 +0800 [thread overview]
Message-ID: <20260514063234.86439-2-cp0613@linux.alibaba.com> (raw)
In-Reply-To: <20260514063234.86439-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.
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 02ae7e5..ffc81eb 100644
--- a/daxctl/lib/libdaxctl.c
+++ b/daxctl/lib/libdaxctl.c
@@ -927,6 +927,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-05-14 6:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-14 6:32 [ndctl PATCH 0/2] daxctl, util/sysfs: fix builtin-driver false failure on enable Chen Pei
2026-05-14 6:32 ` Chen Pei [this message]
2026-05-14 17:16 ` [ndctl PATCH 1/2] daxctl: fix kmod reference leak on probe-insert failure Dave Jiang
2026-05-14 22:14 ` Alison Schofield
2026-05-15 2:27 ` Guo Ren
2026-05-14 6:32 ` [ndctl PATCH 2/2] daxctl, util/sysfs: skip module probe-insert when driver is builtin or live Chen Pei
2026-05-14 17:17 ` Dave Jiang
2026-05-14 18:37 ` Jonathan Cameron
2026-05-14 22:13 ` Alison Schofield
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=20260514063234.86439-2-cp0613@linux.alibaba.com \
--to=cp0613@linux.alibaba.com \
--cc=alison.schofield@intel.com \
--cc=guoren@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.