Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3803726rdg; Wed, 18 Oct 2023 06:39:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGWr/zC7suYhgppfhRdlV9vf4kssn9kTyk3rx55c3Rkfrh1caHZnwG93sSbF9u63hiNiKP4 X-Received: by 2002:a05:6870:1718:b0:1dd:651a:72ce with SMTP id h24-20020a056870171800b001dd651a72cemr6037635oae.33.1697636352561; Wed, 18 Oct 2023 06:39:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697636352; cv=none; d=google.com; s=arc-20160816; b=VqqPbmCt0iSz/72cK0hMtXwgsk3iedBxfBEcVBE+3W/hLn+na/MKQfdi/SWeFad6J5 gIoYDLev+Zn5Du6RTHxkYKGnvecHY7Bf0O9X3jZrZdHg3Umxc0HX6YsiwUsiqah3ko8l m7mCGPCuuTXktqZbOJTl0eoRbsbt5omonuuml/wJBTVR3VVv5pCKiZDhDqVL11uJ0iJm /XE7dyzZmh3gJTEjBjrkKmu7tP9w/mhE38ui8s4KEo8bcJw/ct30E090a+zgdbaGSmdR FANH3syuV0ed6ICAnr3F1qPWRmgHEpKzh7Yb06XTQCKO+7df+Nw7sNRWcLP/anMm0Hyj P/Dg== 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=i3WHzy2jPOq7DWRkfcZKRbraJ5RbzlX80Vmm73j18BQ=; fh=emmo3/Kfd2xUJtbqb1QTOeIGR+FQHlqOo9Khg9wlmK4=; b=eJXkVcFXZrtcfY6A+IZSWmn3uOYOMDw7AJNMmHDjIWw63RWuSdZYlPggUsFfyrOQru J7XrKOvmtQB9KcI0mXh6/0eUJz75UXugb1AlYO63OMnWnI1jIXzElcr5FVJo08Ktj9N7 u504DrwsVa1KVi/MhWE9jo+wUeGIdiYJGITKFvkfCWWcdgV22MEh5fP3/NaiHBxSucoW h2Z1HPdjZnVIvtU9iEzhfJzFvtH/bnJ8tdxf79wFrAW6WTCSY1NlffqE3dMgF5y2IxNW i2y4yQoA+RkVFaKuuEHmiWxwz5dcNKkTY8zmWKQ4wGbAQBsxhFeOVRae/TxbwaUSAYbP Ekcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=dgAMFEl9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id t28-20020a63955c000000b00582dcfe3b41si2158171pgn.374.2023.10.18.06.39.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 06:39:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=dgAMFEl9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 4561E801C9D4; Wed, 18 Oct 2023 06:39:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344727AbjJRNjA (ORCPT + 99 others); Wed, 18 Oct 2023 09:39:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344708AbjJRNiy (ORCPT ); Wed, 18 Oct 2023 09:38:54 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5526F95; Wed, 18 Oct 2023 06:38:52 -0700 (PDT) Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39IDREYT003041; Wed, 18 Oct 2023 13:38:52 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=i3WHzy2jPOq7DWRkfcZKRbraJ5RbzlX80Vmm73j18BQ=; b=dgAMFEl96Ml5b28k/WmAH40jAKvhbFF2oGE3F2kdgxxEDmXatV4GZsBne1pWoERKS0+W Ddvjuko8clPf86ATjvU18UZV4Ej9Bl1ENrvR9H1n4w0QEfsT76ayNU5S/dyPZO4VBEbB yNKKb8dKx4WTfap13pYRv+xMII7d0sxvJyB3CvrHUIprtCbLWgHfO+wUzR2eu2qYNv8V IJMoveSNoJd2OrMmj4pScOoaOlc8UAVXHF/XhYzi9xswz0cE1mn82+UCFiDKA4CaAnJk qel3fTpb3+njKmwYvIU5GjlmTmXB8cqR140aPPq/mehiTdXaQTZiDFsh+RGgHbUl8K6f nQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ttg8v0mr3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 18 Oct 2023 13:38:51 +0000 Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 39IDRpvU005406; Wed, 18 Oct 2023 13:38:42 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ttg8v0me4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 18 Oct 2023 13:38:41 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 39ICmgG3027163; Wed, 18 Oct 2023 13:38:33 GMT Received: from smtprelay05.wdc07v.mail.ibm.com ([172.16.1.72]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3tr6tkgkwc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 18 Oct 2023 13:38:33 +0000 Received: from smtpav04.wdc07v.mail.ibm.com (smtpav04.wdc07v.mail.ibm.com [10.39.53.231]) by smtprelay05.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 39IDcXZ326673760 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Oct 2023 13:38:33 GMT Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ECE3458054; Wed, 18 Oct 2023 13:38:32 +0000 (GMT) Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8AC0658052; Wed, 18 Oct 2023 13:38:31 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.ibm.com.com (unknown [9.61.47.87]) by smtpav04.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 18 Oct 2023 13:38:31 +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, borntraeger@linux.ibm.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, david@redhat.com, Anthony Krowiak , Matthew Rosato , stable@vger.kernel.org Subject: [PATCH v2 1/3] s390/vfio-ap: unpin pages on gisc registration failure Date: Wed, 18 Oct 2023 09:38:23 -0400 Message-ID: <20231018133829.147226-2-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018133829.147226-1-akrowiak@linux.ibm.com> References: <20231018133829.147226-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: vja-EVQZhzePNr7mHYSqNsT-4Xqdr32p X-Proofpoint-GUID: basFk4F_qTajL0D0pAAa1tqTqJheMIeh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-18_12,2023-10-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=999 priorityscore=1501 lowpriorityscore=0 phishscore=0 mlxscore=0 malwarescore=0 clxscore=1015 spamscore=0 adultscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310180113 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Wed, 18 Oct 2023 06:39:10 -0700 (PDT) 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. 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: --- 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; } -- 2.41.0