public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Samiullah Khawaja" <skhawaja@google.com>
Cc: "Bjorn Helgaas" <bhelgaas@google.com>,
	"Gui-Dong Han" <hanguidong02@gmail.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Alex Williamson" <alex@shazbot.org>,
	"open list:PCI SUBSYSTEM" <linux-pci@vger.kernel.org>,
	"open list" <linux-kernel@vger.kernel.org>, <dmatlack@google.com>
Subject: Re: [PATCH] PCI: Init driver override spinlock in new_id_store()
Date: Mon, 27 Apr 2026 21:46:20 +0200	[thread overview]
Message-ID: <DI472FJ8UOG4.1JGTQK7W1RAX@kernel.org> (raw)
In-Reply-To: <20260427193139.2109938-1-skhawaja@google.com>

On Mon Apr 27, 2026 at 9:31 PM CEST, Samiullah Khawaja wrote:
> Fixes: cb3d1049f4ea ("driver core: generalize driver_override in struct device")

I don't think anything is wrong with this commit, and it seems unrelated.

> Fixes: 10a4206a2401 ("PCI: use generic driver_override infrastructure")

I'm also not sure that this one contains the root cause, despite revealing the
actual issue, more below.

> Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
> ---
>  drivers/pci/pci-driver.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> index d10ece0889f0..5f453213b8c5 100644
> --- a/drivers/pci/pci-driver.c
> +++ b/drivers/pci/pci-driver.c
> @@ -215,6 +215,11 @@ static ssize_t new_id_store(struct device_driver *driver, const char *buf,
>  		pdev->subsystem_device = subdevice;
>  		pdev->class = class;
>  
> +		/*
> +		 * Initialize the embedded struct device driver_override lock to
> +		 * avoid the lockdep errors.
> +		 */
> +		spin_lock_init(&pdev->dev.driver_override.lock);

Can't we just call device_initialize() and set pdev->dev.release to a new
function that just calls kfree()?

This way nothing of that kind can ever happen again; it is hard to predict that
a device is used without ever being initialized.

>  		if (pci_match_device(pdrv, pdev))
>  			retval = -EEXIST;
>  
>
> base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
> -- 
> 2.54.0.545.g6539524ca2-goog

  reply	other threads:[~2026-04-27 19:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27 19:31 [PATCH] PCI: Init driver override spinlock in new_id_store() Samiullah Khawaja
2026-04-27 19:46 ` Danilo Krummrich [this message]
2026-04-27 20:36   ` Samiullah Khawaja
2026-04-27 21:11     ` Danilo Krummrich

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=DI472FJ8UOG4.1JGTQK7W1RAX@kernel.org \
    --to=dakr@kernel.org \
    --cc=alex@shazbot.org \
    --cc=bhelgaas@google.com \
    --cc=dmatlack@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hanguidong02@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=skhawaja@google.com \
    /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