From: sashiko-bot@kernel.org
To: alucerop@amd.com
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH v2 1/4] driver core: Check for supplier requiring PM at link creation
Date: Fri, 02 Oct 2026 12:02:13 +0000 [thread overview]
Message-ID: <20261002120213.BA6D41F00893@smtp.kernel.org> (raw)
In-Reply-To: <20261001132023.17032-2-alucerop@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] core: missing registration check in device_link_add() for no_pm devices
--
commit b2ba746c71946921fa9666578a3ca843070e29f1
Author: Alejandro Lucero <alucerop@amd.com>
driver core: Check for supplier requiring PM at link creation
This commit updates device_link_add() to skip the PM initialization
check for devices that do not require PM, allowing links to be
established for such devices.
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 4c0c373998a19..bf0513beafad4 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
[ ... ]
> @@ -840,7 +840,7 @@ struct device_link *device_link_add(struct device *consumer,
> * SYNC_STATE_ONLY link, we don't check for reverse dependencies
> * because it only affects sync_state() callbacks.
> */
> - if (!device_pm_initialized(supplier)
> + if ((!device_pm_not_required(supplier) && !device_pm_initialized(supplier))
[Severity: Medium]
Does this inadvertently bypass the registration check for devices where
device_pm_not_required() is true?
The comment immediately above states: "If the supplier has not been fully
registered yet ... return NULL". Previously, device_pm_initialized()
implicitly enforced this because it wraps device_is_registered().
If a caller invokes device_link_add() with a supplier device that has
no_pm set to true but has not been successfully registered, bypassing this
check entirely means the unregistered supplier is allowed through. Since an
unregistered device will never go through device_del(), device_links_purge()
will never run to clean up the link. Can this result in a permanent leak
of the struct device_link and device refcounts?
Would it make sense to explicitly add a !device_is_registered(supplier)
fallback check here to ensure the core API contract is maintained?
> || (!(flags & DL_FLAG_SYNC_STATE_ONLY) &&
> device_is_dependent(consumer, supplier))) {
> link = NULL;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261001132023.17032-1-alucerop@amd.com?part=1
next prev parent reply other threads:[~2026-10-02 12:02 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 13:20 [PATCH v2 0/4] Type2 multipf support alucerop
2026-10-01 13:20 ` [PATCH v2 1/4] driver core: Check for supplier requiring PM at link creation alucerop
2026-10-01 20:31 ` Dave Jiang
2026-10-02 4:32 ` Lucero Palau, Alejandro
2026-10-02 15:31 ` Dave Jiang
2026-10-02 12:02 ` sashiko-bot [this message]
2026-10-01 13:20 ` [PATCH v2 2/4] cxl/region: Add region reference in memdev attach alucerop
2026-10-01 21:38 ` Dave Jiang
2026-10-02 4:41 ` Lucero Palau, Alejandro
2026-10-02 15:52 ` Dave Jiang
2026-10-08 13:50 ` Lucero Palau, Alejandro
2026-10-08 16:18 ` Dave Jiang
2026-10-08 18:07 ` Lucero Palau, Alejandro
2026-10-08 21:05 ` Dave Jiang
2026-10-09 6:58 ` Lucero Palau, Alejandro
2026-10-09 16:57 ` Dave Jiang
2026-10-02 12:02 ` sashiko-bot
2026-10-01 13:20 ` [PATCH v2 3/4] cxl/memdev: Add support for multi PF devices alucerop
2026-10-01 22:11 ` Dave Jiang
2026-10-01 22:41 ` Dave Jiang
2026-10-02 4:50 ` Lucero Palau, Alejandro
2026-10-02 15:55 ` Dave Jiang
2026-10-02 12:02 ` sashiko-bot
2026-10-01 13:20 ` [PATCH v2 4/4] sfc: add multipf support alucerop
2026-10-01 22:32 ` Dave Jiang
2026-10-02 5:33 ` Lucero Palau, Alejandro
2026-10-02 12:02 ` sashiko-bot
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=20261002120213.BA6D41F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alucerop@amd.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