linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: John Garry <john.garry@huawei.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Borislav Petkov <bp@suse.de>, Guenter Roeck <linux@roeck-us.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-pci@vger.kernel.org,
	Kefeng Wang <wangkefeng.wang@huawei.com>,
	Linuxarm <linuxarm@huawei.com>, Alexander Graf <agraf@suse.de>
Subject: Re: [PATCH v2 2/3] lib: logic_pio: Reject access to unregistered CPU MMIO regions
Date: Sat, 23 Mar 2019 21:15:38 +0200	[thread overview]
Message-ID: <CAHp75VfRwp+XGdE6k4KU6hvLNu=h3TRVbm5AFOAZgsp-i1Ehjg@mail.gmail.com> (raw)
In-Reply-To: <1553105650-28012-3-git-send-email-john.garry@huawei.com>

On Wed, Mar 20, 2019 at 8:14 PM John Garry <john.garry@huawei.com> wrote:
>
> Currently when accessing logical indirect PIO addresses in
> logic_{in, out}{,s}, we first ensure that the region is registered.
>
> However, no such check exists for CPU MMIO regions. The CPU MMIO regions
> would be registered by the PCI host (when PCI_IOBASE is defined) in
> pci_register_io_range().
>
> We have seen scenarios when systems which don't have a PCI host or, they
> do, and the PCI host probe fails, that certain devices attempts to still
> attempt to access PCI IO ports; examples are in [1] and [2].
>
> And even though we would protect against this by ensuring the driver call
> request_{muxed_}region(), some don't do this:
>


>  #if defined(CONFIG_INDIRECT_PIO) && defined(PCI_IOBASE)
> +#define INVALID_RANGE(range) (!range || \
> +                             (range->flags == LOGIC_PIO_CPU_MMIO && !range->ops))

It would be better to read in a form
#define foo(x) \
 (...)

> +               ret = range->ops->in(range->hostdata,                   \
> +                                    addr, sizeof(type));               \

Can it fit one line?

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2019-03-23 19:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20 18:14 [PATCH v2 0/3] Fix system crash for accessing unmapped IO port regions John Garry
2019-03-20 18:14 ` [RFC PATCH v2 1/3] resource: Request IO port regions from children of ioport_resource John Garry
2019-03-25 23:32   ` Bjorn Helgaas
2019-03-26 16:33     ` John Garry
2019-03-26 22:48       ` Bjorn Helgaas
2019-03-27 11:24         ` John Garry
2019-03-28 17:46         ` Lorenzo Pieralisi
2019-03-29 10:42           ` John Garry
2019-03-29 12:22             ` Lorenzo Pieralisi
2019-04-02  9:46               ` John Garry
2019-03-20 18:14 ` [PATCH v2 2/3] lib: logic_pio: Reject access to unregistered CPU MMIO regions John Garry
2019-03-23 19:15   ` Andy Shevchenko [this message]
2019-03-25  9:59     ` John Garry
2019-03-20 18:14 ` [PATCH v2 3/3] lib: logic_pio: Make some prints explicitly hex John Garry
2019-03-23 19:12   ` Andy Shevchenko
2019-03-25  9:48     ` John Garry
2019-03-25 15:03       ` Andy Shevchenko

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='CAHp75VfRwp+XGdE6k4KU6hvLNu=h3TRVbm5AFOAZgsp-i1Ehjg@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=agraf@suse.de \
    --cc=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=bp@suse.de \
    --cc=john.garry@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=linuxarm@huawei.com \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=rafael@kernel.org \
    --cc=wangkefeng.wang@huawei.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;
as well as URLs for NNTP newsgroup(s).