From: Bjorn Helgaas <helgaas@kernel.org>
To: Seunggyun Lee <sglee97@dankook.ac.kr>
Cc: bhelgaas@google.com, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org,
Alex Williamson <alex.williamson@redhat.com>,
Cornelia Huck <cohuck@redhat.com>,
kvm@vger.kernel.org, Leon Romanovsky <leon@kernel.org>
Subject: Re: [PATCH] pci/mmap: add pci device EBUSY check
Date: Wed, 8 Feb 2023 16:10:10 -0600 [thread overview]
Message-ID: <20230208221010.GA2489371@bhelgaas> (raw)
In-Reply-To: <20230207113949.17943-1-sglee97@dankook.ac.kr>
[+cc VFIO folks, Leon]
On Tue, Feb 07, 2023 at 08:39:49PM +0900, Seunggyun Lee wrote:
> When using a pci device through the vfio-pci driver, other software was
> also able to access the pci device memory through sysfs.
>
> To prevent this, when mmap is performed through sysfs, a process of
> checking whether the device is in use is added.
>
> Signed-off-by: Seunggyun Lee <sglee97@dankook.ac.kr>
> ---
> drivers/pci/mmap.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/pci/mmap.c b/drivers/pci/mmap.c
> index 4504039056d1..4c9df2e23e03 100644
> --- a/drivers/pci/mmap.c
> +++ b/drivers/pci/mmap.c
> @@ -25,6 +25,8 @@ int pci_mmap_resource_range(struct pci_dev *pdev, int bar,
> {
> unsigned long size;
> int ret;
> + if (pdev->driver)
> + return -1;
>
> size = ((pci_resource_len(pdev, bar) - 1) >> PAGE_SHIFT) + 1;
> if (vma->vm_pgoff + vma_pages(vma) > size)
> --
> 2.25.1
>
next prev parent reply other threads:[~2023-02-08 22:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-07 11:39 [PATCH] pci/mmap: add pci device EBUSY check Seunggyun Lee
2023-02-08 8:09 ` Leon Romanovsky
2023-02-08 22:10 ` Bjorn Helgaas [this message]
2023-02-08 22:43 ` Alex Williamson
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=20230208221010.GA2489371@bhelgaas \
--to=helgaas@kernel.org \
--cc=alex.williamson@redhat.com \
--cc=bhelgaas@google.com \
--cc=cohuck@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sglee97@dankook.ac.kr \
/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