From: sashiko-bot@kernel.org
To: "Dave Jiang" <dave.jiang@intel.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH v7 1/7] cxl/test: Add test for module parameters
Date: Mon, 29 Jun 2026 22:21:29 +0000 [thread overview]
Message-ID: <20260629222129.771D01F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260629221104.3891733-2-dave.jiang@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Pre-existing Use-After-Free due to static `struct platform_device` inside a loadable module.
--
commit 6c236a64c339f0b27ff963a194f46fc253545d89
Author: Dave Jiang <dave.jiang@intel.com>
cxl/test: Add test for module parameters
Add a test for module paraters during module init to make sure that
only one is activated.
> diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
> index ef92dd35e030c..198a128181b93 100644
> --- a/tools/testing/cxl/test/cxl.c
> +++ b/tools/testing/cxl/test/cxl.c
[ ... ]
> diff --git a/tools/testing/cxl/test/hmem_test.c b/tools/testing/cxl/test/hmem_test.c
> index 3a1a089e1721b..0fa00f7e16db5 100644
> --- a/tools/testing/cxl/test/hmem_test.c
> +++ b/tools/testing/cxl/test/hmem_test.c
> @@ -3,8 +3,9 @@
> #include <linux/moduleparam.h>
> #include <linux/workqueue.h>
> #include "../../../drivers/dax/bus.h"
> +#include "mock.h"
>
> -static bool hmem_test;
> +bool hmem_test;
[Severity: High]
This is a pre-existing issue, but could this module encounter a use-after-free
on unload due to how platform_device is managed in this file?
Looking at hmem_test_exit() and the hmem_test_device definition:
static struct hmem_platform_device hmem_test_device = {
...
};
void hmem_test_exit(void)
{
if (hmem_test)
platform_device_unregister(&hmem_test_device.pdev);
}
If the dax_hmem driver has queued work on dax_hmem_wq (which holds a reference
to the device via get_device()), platform_device_unregister() doesn't appear
to synchronously wait for those references to drop or for the work to complete
because dax_hmem_platform_driver lacks a remove() callback to cancel the work.
Since hmem_test_device is statically allocated in the module's data section,
once the module memory is freed on unload, would the kernel access unmapped
memory when the delayed work executes, or when the final reference drops and
invokes the unmapped hmem_test_release() function?
>
> static void hmem_test_work(struct work_struct *work)
> {
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260629221104.3891733-1-dave.jiang@intel.com?part=1
next prev parent reply other threads:[~2026-06-29 22:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 22:10 [PATCH v7 0/7] cxl: Add CXL type2 accelerator support for cxl_test Dave Jiang
2026-06-29 22:10 ` [PATCH v7 1/7] cxl/test: Add test for module parameters Dave Jiang
2026-06-29 22:21 ` sashiko-bot [this message]
2026-06-30 17:21 ` Alison Schofield
2026-06-30 17:28 ` Dave Jiang
2026-06-29 22:10 ` [PATCH v7 2/7] cxl/test: Add type2 support for mock CFMWS0 Dave Jiang
2026-06-29 22:11 ` [PATCH v7 3/7] cxl/test: Refactor platform device enumerations Dave Jiang
2026-06-29 22:11 ` [PATCH v7 4/7] cxl/test: Add hierarchy enumeration support for type2 device Dave Jiang
2026-07-01 7:31 ` Li Ming
2026-07-01 14:53 ` Dave Jiang
2026-06-29 22:11 ` [PATCH v7 5/7] cxl/test: Propagate -ENOMEM on platform_device_alloc() failures Dave Jiang
2026-06-29 22:11 ` [PATCH v7 6/7] cxl/test: Fixup hdm init for auto region to support type2 Dave Jiang
2026-06-29 22:11 ` [PATCH v7 7/7] cxl/test: Add cxl_test accelerator driver Dave Jiang
2026-06-29 22:23 ` sashiko-bot
2026-06-30 17:23 ` [PATCH v7 0/7] cxl: Add CXL type2 accelerator support for cxl_test Alison Schofield
2026-06-30 20:50 ` Dave Jiang
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=20260629222129.771D01F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dave.jiang@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=sashiko-reviews@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox