Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4342991pxj; Wed, 12 May 2021 03:36:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzieZPf+IikSe3ITYLtL/IZhhGGuvN72oT1XHeNtCYHaNJ/b1e5O8RzolDEFrZVhZw4R9zx X-Received: by 2002:a02:7110:: with SMTP id n16mr31344440jac.69.1620815771854; Wed, 12 May 2021 03:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620815771; cv=none; d=google.com; s=arc-20160816; b=qnBtz14xChvvYUQOKXmOOQEIcGrvufCug62KaYckRLM6kaeBswMfbodHWcDZcPgNYA Zd2SvSF1NLlvdW7cM65rgG8nthGoPHsEDSxv6JSt/bqqaS+sqzkXbAlZI7frHYpCSllw LKZdBhJgANwqDPgkyZKDYFPFwnsb11Bxsc6CLVcFZxVG0NVLtrCrM0+hpTdAFnVpMr4a WP8x6BfU2Lkm46DaVPbiZaW3btbu171jAjS3KKmpbfwB43uH+6HPDBFBEBpQiJ/NT3Jv eciZx0YWRrvNcz9OuhcubsfeU1qxhfLjxLxCOyNw1gL1FM8FdDcfd80xEJsc6Ui0cp3H 7GCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=JjvMxQTKtgVV/vw0mCHKj+DX9Iwi8frvy9yTNz/M6yk=; b=u8lkCtKmBI7YpVUE2jtBzaG0JKfplpz2ddmxwqsjVx/oeCfF0ak107sFOIL1PsYbbG 9L8bRw1+4jfc4p9D12kpqRjtQpwuTqZesiNkNqgwK5VoWQWOzz5ElfuAPymfftA3m9hD 5L9bTmRVZDh8iQyLE8FmPUpeoH0aTkUNW2GQfJlTzQUVzH4iMoiKZsLnKkuX6aQEZUUX NWd4QtltF7Cl/zSNssLFn5SrUbEOQEmDakFZV3kNRwa8sWX74GwYRrXorV7WwlOhaS2I 0pHNbbAms1YtkaxruCSJeKkdr0rKp24X19LIFeWTfda3P/BtyXGakJBvUMXhwIciX/d0 nmfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QXqySs+p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k7si9299312iok.65.2021.05.12.03.35.53; Wed, 12 May 2021 03:36:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QXqySs+p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230217AbhELKgX (ORCPT + 99 others); Wed, 12 May 2021 06:36:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52549 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230019AbhELKgW (ORCPT ); Wed, 12 May 2021 06:36:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620815714; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JjvMxQTKtgVV/vw0mCHKj+DX9Iwi8frvy9yTNz/M6yk=; b=QXqySs+p85IaueHNls/lTTCpr9vAZ7QgN1KXnzFoC1fgwghto9+2mbHTtwJoXBT/NlrbRW OiDCoQCs7aY/EDEt6Nsti5pquXGK5etfr1w8MUtEyfI9xqvAUpB3OXwEpXCCXreueaToOO Sau8S9sNeHaiMaamIJ88RCb7Z/TOcUA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-403-ighyW7aVO6GJpjTyhaPeSg-1; Wed, 12 May 2021 06:35:12 -0400 X-MC-Unique: ighyW7aVO6GJpjTyhaPeSg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B296B801B13; Wed, 12 May 2021 10:35:08 +0000 (UTC) Received: from gondolin.fritz.box (ovpn-113-78.ams2.redhat.com [10.36.113.78]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D4F95D9D7; Wed, 12 May 2021 10:35:06 +0000 (UTC) Date: Wed, 12 May 2021 12:35:03 +0200 From: Cornelia Huck To: Tony Krowiak Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, borntraeger@de.ibm.com, pasic@linux.vnet.ibm.com, jjherne@linux.ibm.com, jgg@nvidia.com, alex.williamson@redhat.com, kwankhede@nvidia.com, stable@vger.kernel.org, Tony Krowiak Subject: Re: [PATCH v2] s390/vfio-ap: fix memory leak in mdev remove callback Message-ID: <20210512123503.3177fc3d.cohuck@redhat.com> In-Reply-To: <20210510214837.359717-1-akrowiak@linux.ibm.com> References: <20210510214837.359717-1-akrowiak@linux.ibm.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 10 May 2021 17:48:37 -0400 Tony Krowiak wrote: > 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 > --- > drivers/s390/crypto/vfio_ap_ops.c | 13 ++----------- > 1 file changed, 2 insertions(+), 11 deletions(-) With the S-o-b fixed, Reviewed-by: Cornelia Huck