Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: "Mario Limonciello (AMD)" <superm1@kernel.org>
Cc: mario.limonciello@amd.com, bhelgaas@google.com,
	rafael@kernel.org, kengyu@lexical.tw,
	Matthew Ruffell <matthew.ruffell@canonical.com>,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI: Enable Bus Master in pci_power_up()
Date: Wed, 14 Jan 2026 10:52:26 +0100	[thread overview]
Message-ID: <aWdnWpqWQjNYKfpV@wunner.de> (raw)
In-Reply-To: <20260113205626.127337-1-superm1@kernel.org>

On Tue, Jan 13, 2026 at 02:56:14PM -0600, Mario Limonciello (AMD) wrote:
> +++ b/drivers/pci/pci.c
> @@ -1323,6 +1323,7 @@ int pci_power_up(struct pci_dev *dev)
>  		return -EIO;
>  	}
>  
> +	pci_set_master(dev);
>  	pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
>  	if (PCI_POSSIBLE_ERROR(pmcsr)) {
>  		pci_err(dev, "Unable to change power state from %s to D0, device inaccessible\n",

So any device will be allowed to write to memory from the get-go?
That sounds like a very bad idea.  For security reasons alone,
we only want to enable bus mastering when needed.  It's up to
the driver to enable it, not up to the PCI core.  We've had cases
in the past where devices corrupted memory because BIOS left
bus mastering enabled, see abb2bafd295f.  Enabling bus mastering
for everything anytime will exacerbate such problems or uncover
new ones.

Thanks,

Lukas

  parent reply	other threads:[~2026-01-14 10:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-13 20:56 [PATCH] PCI: Enable Bus Master in pci_power_up() Mario Limonciello (AMD)
2026-01-14  0:01 ` Matthew Ruffell
2026-01-14  9:52 ` Lukas Wunner [this message]
2026-01-14 14:59   ` Manivannan Sadhasivam
2026-01-14 15:08   ` Mario Limonciello

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=aWdnWpqWQjNYKfpV@wunner.de \
    --to=lukas@wunner.de \
    --cc=bhelgaas@google.com \
    --cc=kengyu@lexical.tw \
    --cc=linux-pci@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=matthew.ruffell@canonical.com \
    --cc=rafael@kernel.org \
    --cc=superm1@kernel.org \
    /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