Thread (34 messages) 34 messages, 5 authors, 2021-05-19

Re: [PATCH v2] s390/vfio-ap: fix memory leak in mdev remove callback

From: Jason Gunthorpe <jgg@nvidia.com>
Date: 2021-05-13 17:25:26
Also in: linux-s390, lkml

On Thu, May 13, 2021 at 10:18:44AM -0400, Tony Krowiak wrote:

On 5/12/21 8:41 AM, Jason Gunthorpe wrote:
quoted
On Mon, May 10, 2021 at 05:48:37PM -0400, Tony Krowiak wrote:
quoted
The mdev remove callback for the vfio_ap device driver bails out with
-EBUSY if the mdev is in use by a KVM guest. The intended purpose was
to prevent the mdev from being removed while in use; however, returning a
non-zero rc does not prevent removal. This could result in a memory leak
of the resources allocated when the mdev was created. In addition, the
KVM guest will still have access to the AP devices assigned to the mdev
even though the mdev no longer exists.

To prevent this scenario, cleanup will be done - including unplugging the
AP adapters, domains and control domains - regardless of whether the mdev
is in use by a KVM guest or not.

Fixes: 258287c994de ("s390: vfio-ap: implement mediated device open callback")
Cc: stable@vger.kernel.org
Signed-off-by: Tony Krowiak <redacted>
  drivers/s390/crypto/vfio_ap_ops.c | 13 ++-----------
  1 file changed, 2 insertions(+), 11 deletions(-)
Can you please ensure this goes to a -rc branch or through Alex's
tree?
I'm sorry, I don't know what a -rc branch is nor how to push this
to Alex's tree, but I'd be happy to do so if you tell me now:)
If Christian takes it for 5.13-rc then that is OK

Otherwise please ask AlexW to take it

Thanks,
Jason
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help