From: Tony Krowiak <akrowiak@linux.ibm.com>
To: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: borntraeger@de.ibm.com, cohuck@redhat.com,
pasic@linux.vnet.ibm.com, jjherne@linux.ibm.com, jgg@nvidia.com,
alex.williamson@redhat.com, kwankhede@nvidia.com,
Tony Krowiak <akrowiak@linux.ibm.com>
Subject: [PATCH v3 0/2] s390/vfio-ap: fix memory leak in mdev remove callback
Date: Wed, 19 May 2021 11:39:19 -0400 [thread overview]
Message-ID: <20210519153921.804887-1-akrowiak@linux.ibm.com> (raw)
Fixes a memory leak in the mdev remove callback when invoked while the
mdev is in use by a KVM guest. Instead of returning -EBUSY from the
callback, a full cleanup of the resources allocated to the mdev is
performed because regardless of the value returned from the function, the
mdev is removed from sysfs.
The cleanup of resources allocated to the mdev may coincide with the
interception of the PQAP(AQIC) instruction in which case data needed to
handle the interception may get removed. A patch is included in this series
to synchronize access to resources needed by the interception handler to
protect against invalid memory accesses.
Change log:
v2 -> v3:
--------
* Added a patch to control access to the PQAP(AQIC) hook using RCU
v1 -> v2:
--------
* Call vfio_ap_mdev_unset_kvm() function from the remove callback instead
of merely clearing the guest's APCB.
Tony Krowiak (2):
s390/vfio-ap: fix memory leak in mdev remove callback
s390/vfio-ap: control access to PQAP(AQIC) interception handler
arch/s390/include/asm/kvm_host.h | 1 +
arch/s390/kvm/priv.c | 47 +++++++++++++---------
drivers/s390/crypto/vfio_ap_ops.c | 67 +++++++++++++++++++++----------
3 files changed, 75 insertions(+), 40 deletions(-)
--
2.30.2
next reply other threads:[~2021-05-19 16:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-19 15:39 Tony Krowiak [this message]
2021-05-19 15:39 ` [PATCH v3 1/2] s390/vfio-ap: fix memory leak in mdev remove callback Tony Krowiak
2021-05-19 15:39 ` [PATCH v3 2/2] s390/vfio-ap: control access to PQAP(AQIC) interception handler Tony Krowiak
2021-05-19 16:16 ` Jason Gunthorpe
2021-05-19 23:04 ` Tony Krowiak
2021-05-19 23:22 ` Jason Gunthorpe
2021-05-20 1:08 ` Tony Krowiak
2021-05-20 8:48 ` Halil Pasic
2021-05-20 12:26 ` Jason Gunthorpe
2021-05-20 8:38 ` Halil Pasic
2021-05-20 12:51 ` Jason Gunthorpe
2021-05-21 18:24 ` Tony Krowiak
2021-05-21 18:30 ` Jason Gunthorpe
2021-05-19 17:21 ` Halil Pasic
2021-05-19 23:14 ` Tony Krowiak
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=20210519153921.804887-1-akrowiak@linux.ibm.com \
--to=akrowiak@linux.ibm.com \
--cc=alex.williamson@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=jgg@nvidia.com \
--cc=jjherne@linux.ibm.com \
--cc=kwankhede@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pasic@linux.vnet.ibm.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