All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Krzysztof Wilczyński" <kwilczynski@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH 1/2] PCI/sysfs: Fix out-of-bounds read in pci_write_legacy_io()
Date: Wed, 17 Jun 2026 01:47:53 +0900	[thread overview]
Message-ID: <20260616164648.GA320708@rocinante> (raw)
In-Reply-To: <20260616164230.81F281F000E9@smtp.kernel.org>

Hello,

> [Severity: High]
> This is a pre-existing issue, but the claim that no changes are needed for
> Alpha doesn't seem quite right.
> 
> Looking at pci_legacy_write() in arch/alpha/kernel/pci-sysfs.c, it calls the
> I/O port functions with the port and value reversed:
> 
> arch/alpha/kernel/pci-sysfs.c:pci_legacy_write() {
>     ...
> 	switch(size) {
> 	case 1:
> 		outb(port, val);
> 		return 1;
> 	case 2:
> 		if (port & 1)
> 			return -EINVAL;
> 		outw(port, val);
> 		return 2;
> 	case 4:
> 		if (port & 3)
> 			return -EINVAL;
> 		outl(port, val);
> 		return 4;
> 	}
>     ...
> }
> 
> Since Alpha's outb(), outw(), and outl() expect arguments in the order
> (value, port), doesn't passing port as the value and val as the port
> address incorrectly use user-supplied data as the target I/O port address?

A known issue for which a fix has been sent:

  https://lore.kernel.org/linux-pci/20260612232400.585195-1-kwilczynski@kernel.org/

Thank you!

	Krzysztof

      reply	other threads:[~2026-06-16 16:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16 16:31 [PATCH 1/2] PCI/sysfs: Fix out-of-bounds read in pci_write_legacy_io() Krzysztof Wilczyński
2026-06-16 16:31 ` [PATCH 2/2] PCI/sysfs: Fix read byte order in pci_read_legacy_io() Krzysztof Wilczyński
2026-06-16 16:36   ` sashiko-bot
2026-06-16 16:42 ` [PATCH 1/2] PCI/sysfs: Fix out-of-bounds read in pci_write_legacy_io() sashiko-bot
2026-06-16 16:47   ` Krzysztof Wilczyński [this message]

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=20260616164648.GA320708@rocinante \
    --to=kwilczynski@kernel.org \
    --cc=linux-pci@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 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.