From patchwork Wed Nov 29 14:53:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Krowiak X-Patchwork-Id: 171409 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp391384vqn; Wed, 29 Nov 2023 06:54:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGDHesedQElsmlCyIbk8Z/YrD+OhgyQKPSoT8F7/6FadaOmODqqplGR9WqOkfURfk3W5ef5 X-Received: by 2002:a05:6808:8e8:b0:3ab:38b0:8b84 with SMTP id d8-20020a05680808e800b003ab38b08b84mr18998756oic.17.1701269664351; Wed, 29 Nov 2023 06:54:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701269664; cv=none; d=google.com; s=arc-20160816; b=JM4JtY8FtLaGIQa98ZKdai7t049hzB49phnuYgTiNpl7M07EmwwxqNy3SKM7jbchxH rbNOUcbLaoXd1HE93usb9jHYnbGLa5CfD4o490TQ0mI/cT6hGIFlyp7sylDjUdKRAXw3 wnfJRd5x9olMTOiFOP3uT7Om8PZ+7q8PwFQKrIEGt1/8taHEvInUbjfmOJKkXqLeRLvz NEeFYYrNaO0dufY9G/Xkl/8xeGL3ragU2Bd0rZ8DfP8MUHRaFL4fAWedD5J25wKmIDh+ vyD0PPZz4Q6D+TKaLJs3zS9R/tJwIQe/iJ1A9zwDKjW2Z7DNEzR6IplXk2TorHRgOu97 WHtA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nrvFh2fd1vzzeix+pUFKXs76rwQENYotxEwliyOjHjs=; fh=Q0aZh5A0NyCCYrXoGbdbH6+NKiZKArINP/Zla+a0XpA=; b=w1oow2XjV3U//4ZRMpFb5i68qqAgPHSIDSulVAzhbNaEa3AJ+eCpzSeWhRB9ODdFVA 71gbbW6HCIxhbENbNV8o9fKK0SOq35X4hxoqkt9XhIpg5cl0UUZL5Pf/ZyFYNTuPmjbY R1fm0ljGhwVqmrcsNLxl4ZetWHmu1orYyLGxKliU8XT62eaHpCwQMhpCEXZMnQ5YxWJh huLa8g/nCB/SUm3lxwRDUxBljr02SnHWErHntElU5Qxep3mS6Reay4nyfO8+YaNSVU8f RGv7q06bm/L8aZptrHSvkmMDnYxBjByg1qk8NoazCpLF7sSGh72KE+A9aYq9EhRL3XDy 5cMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=W0h44zok; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id k8-20020a634b48000000b005c603ab4578si1870918pgl.173.2023.11.29.06.54.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 06:54:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=W0h44zok; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id EBBAE8038B6A; Wed, 29 Nov 2023 06:54:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234722AbjK2OyJ (ORCPT + 99 others); Wed, 29 Nov 2023 09:54:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234712AbjK2OyG (ORCPT ); Wed, 29 Nov 2023 09:54:06 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06BFEDD; Wed, 29 Nov 2023 06:54:13 -0800 (PST) Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ATEqbdj016394; Wed, 29 Nov 2023 14:54:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=nrvFh2fd1vzzeix+pUFKXs76rwQENYotxEwliyOjHjs=; b=W0h44zok4PUOY/xdj3QBN8uCKt3+Pxubg5vAGEl2Pd3GBP1n2UaGNxAquZSSBoY0qgQv uI2+gEkLQhUwzDqP6S76sLulWB+6aHKrhYGZtoSfw6JmNM64zaZDW4Sh2D5sOmXcPtUW /W0IBiuGVR1bLUNce8FDN2FvMxmfhO+mVwHPWOPy4WRTs32Tt1FpCXbiCfFG9Db/8zXp rjMSjRtwA5FMGe0i8EihWwNOnnVQ+9pIiLwWczllq0G1RMsFFExHSdiww77rpR/0A5ww U1cXkXmZ+HGLhlKHezD8Vo91wo/xmVcMCPj+8CCKBlEXxONeyXh6QDdurJl9HoTvT3uq Ig== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3up7ekr30h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Nov 2023 14:54:11 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3ATErSgf020936; Wed, 29 Nov 2023 14:54:10 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3up7ekr2yr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Nov 2023 14:54:10 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3ATEDjWZ004747; Wed, 29 Nov 2023 14:54:09 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([172.16.1.4]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3ukwy1ya5m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Nov 2023 14:54:09 +0000 Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3ATEs8vw18547410 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Nov 2023 14:54:09 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B35285805B; Wed, 29 Nov 2023 14:54:08 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 25C4658058; Wed, 29 Nov 2023 14:54:07 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.ibm.com.com (unknown [9.61.149.198]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 29 Nov 2023 14:54:07 +0000 (GMT) From: Tony Krowiak To: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: jjherne@linux.ibm.com, pasic@linux.ibm.com, alex.williamson@redhat.com, borntraeger@linux.ibm.com, kwankhede@nvidia.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, david@redhat.com, Anthony Krowiak , Matthew Rosato , stable@vger.kernel.org Subject: [PATCH v4 1/3] s390/vfio-ap: unpin pages on gisc registration failure Date: Wed, 29 Nov 2023 09:53:59 -0500 Message-ID: <20231129145404.263764-2-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231129145404.263764-1-akrowiak@linux.ibm.com> References: <20231129145404.263764-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: LXohugi0gGmcJIUTLIeUKt2Bnf8iFKtC X-Proofpoint-ORIG-GUID: 7IyvGerT-WH3X_U5MnTHXr5RtDrmZJCk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-29_12,2023-11-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 phishscore=0 spamscore=0 malwarescore=0 clxscore=1011 priorityscore=1501 adultscore=0 mlxscore=0 mlxlogscore=999 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311290113 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 29 Nov 2023 06:54:20 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783910539939358558 X-GMAIL-MSGID: 1783910539939358558 From: Anthony Krowiak In the vfio_ap_irq_enable function, after the page containing the notification indicator byte (NIB) is pinned, the function attempts to register the guest ISC. If registration fails, the function sets the status response code and returns without unpinning the page containing the NIB. In order to avoid a memory leak, the NIB should be unpinned before returning from the vfio_ap_irq_enable function. Co-developed-by: Janosch Frank Signed-off-by: Janosch Frank Signed-off-by: Anthony Krowiak Reviewed-by: Matthew Rosato Fixes: 783f0a3ccd79 ("s390/vfio-ap: add s390dbf logging to the vfio_ap_irq_enable function") Cc: Acked-by: Christian Borntraeger --- drivers/s390/crypto/vfio_ap_ops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index 4db538a55192..9cb28978c186 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -457,6 +457,7 @@ static struct ap_queue_status vfio_ap_irq_enable(struct vfio_ap_queue *q, VFIO_AP_DBF_WARN("%s: gisc registration failed: nisc=%d, isc=%d, apqn=%#04x\n", __func__, nisc, isc, q->apqn); + vfio_unpin_pages(&q->matrix_mdev->vdev, nib, 1); status.response_code = AP_RESPONSE_INVALID_GISA; return status; }