Message ID | 20231018133829.147226-2-akrowiak@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4797732vqb; Wed, 18 Oct 2023 06:39:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEkDAwWzuNGecAJylFnQuBsKVn21zHaWIVvBKk1G2svLJlcAGIGkSc780aGECM4e85MINf4 X-Received: by 2002:a05:6602:340a:b0:7a5:cd6b:7581 with SMTP id n10-20020a056602340a00b007a5cd6b7581mr6738538ioz.2.1697636360532; Wed, 18 Oct 2023 06:39:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697636360; cv=none; d=google.com; s=arc-20160816; b=K7xemyPYN8BQHKNmLvyoUw73tquvMa0D/m2rUzBXQqtbmgdznY4ZCje63U68qQh+OR vvOP+RodYajCk33LF0JaQyAnUMrpFaNiUeIs40Ja2Q3aw/1DnOL/1DFSG8rpy1uCXmEl DP7Qz3khxgLTeKAmDZ4DmVQcCf3SYdaet9guzibPy1MA0gZdP0LbH0hvS4ffSlBIIg5J +GQnA40I+UhA6U8uqno358U5X9VXkS5vAUON5zA+eT292U+iDekaJmBmC+uK14I5Bjw1 JcHvRWRyZ2bJqAQdRc6j1JOUnpS9pYlpVSG5p5JuCmwTxq8yRY80AbF5WLKmvffsgzw0 bS+w== 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 Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id bw27-20020a056a02049b00b005775a0cd009si2590941pgb.331.2023.10.18.06.39.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 06:39:20 -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 54233801C9D1; Wed, 18 Oct 2023 06:39:18 -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 S1344728AbjJRNjB (ORCPT <rfc822;zwp10758@gmail.com> + 23 others); Wed, 18 Oct 2023 09:39:01 -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 <rfc822;linux-kernel@vger.kernel.org>); 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 <akrowiak@linux.ibm.com> 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 <akrowiak@linux.ibm.com>, Matthew Rosato <mjrosato@linux.ibm.com>, 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: <linux-kernel.vger.kernel.org> 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:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780100744446193485 X-GMAIL-MSGID: 1780100744446193485 |
Series |
a couple of corrections to the IRQ enablement function
|
|
Commit Message
Anthony Krowiak
Oct. 18, 2023, 1:38 p.m. UTC
From: Anthony Krowiak <akrowiak@linux.ibm.com> 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 <frankja@linux.ibm.com> Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Fixes: 783f0a3ccd79 ("s390/vfio-ap: add s390dbf logging to the vfio_ap_irq_enable function") Cc: <stable@vger.kernel.org> --- drivers/s390/crypto/vfio_ap_ops.c | 1 + 1 file changed, 1 insertion(+)
Comments
Am 18.10.23 um 15:38 schrieb Tony Krowiak: > From: Anthony Krowiak <akrowiak@linux.ibm.com> > > 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 <frankja@linux.ibm.com> Where is Janoschs signed off coming from here? > Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com> > Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> > Fixes: 783f0a3ccd79 ("s390/vfio-ap: add s390dbf logging to the vfio_ap_irq_enable function") > Cc: <stable@vger.kernel.org> > --- > 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; > }
On 10/26/23 08:18, Christian Borntraeger wrote: > > > Am 18.10.23 um 15:38 schrieb Tony Krowiak: >> From: Anthony Krowiak <akrowiak@linux.ibm.com> >> >> 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 <frankja@linux.ibm.com> > > Where is Janoschs signed off coming from here? Janosch found this and composed the patch originally. I just tweaked the description and posted it. > >> Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com> >> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> >> Fixes: 783f0a3ccd79 ("s390/vfio-ap: add s390dbf logging to the >> vfio_ap_irq_enable function") >> Cc: <stable@vger.kernel.org> >> --- >> 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; >> }
Am 26.10.23 um 15:16 schrieb Tony Krowiak: > > > On 10/26/23 08:18, Christian Borntraeger wrote: >> >> >> Am 18.10.23 um 15:38 schrieb Tony Krowiak: >>> From: Anthony Krowiak <akrowiak@linux.ibm.com> >>> >>> 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 <frankja@linux.ibm.com> >> >> Where is Janoschs signed off coming from here? > > Janosch found this and composed the patch originally. I just tweaked the description and posted it. So we should add Co-developed-by: Janosch Frank <frankja@linux.ibm.com> in front of Janoschs signoff. > >> >>> Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com> >>> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> >>> Fixes: 783f0a3ccd79 ("s390/vfio-ap: add s390dbf logging to the vfio_ap_irq_enable function") >>> Cc: <stable@vger.kernel.org> >>> --- >>> 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; >>> }
On 10/26/23 09:25, Christian Borntraeger wrote: > > > Am 26.10.23 um 15:16 schrieb Tony Krowiak: >> >> >> On 10/26/23 08:18, Christian Borntraeger wrote: >>> >>> >>> Am 18.10.23 um 15:38 schrieb Tony Krowiak: >>>> From: Anthony Krowiak <akrowiak@linux.ibm.com> >>>> >>>> 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 <frankja@linux.ibm.com> >>> >>> Where is Janoschs signed off coming from here? >> >> Janosch found this and composed the patch originally. I just tweaked >> the description and posted it. > > So we should add > > Co-developed-by: Janosch Frank <frankja@linux.ibm.com> > > in front of Janoschs signoff. Will do. > >> >>> >>>> Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com> >>>> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> >>>> Fixes: 783f0a3ccd79 ("s390/vfio-ap: add s390dbf logging to the >>>> vfio_ap_irq_enable function") >>>> Cc: <stable@vger.kernel.org> >>>> --- >>>> 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; >>>> }
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; }