From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796317586; b=rJH7DJhE/kFYTD7xNlN+FUpAJVUgUMvvOlRqtt0UqAQghwA6x3aet/VKNG5s81m28Kb+ aNq6BWiDRFSnTjPauWCKDbzVYVjdeDakvNeR4iqwzwKSA4iqBy4mQzhzyn9YNxc2TlZwR mTKudp9T9RTAUa9jO/qkTiGSy1pd47cVx73p811PYB//lN7ZxgXb2ZXZFhUx6yuNNoSo9 witybdblI3UUlkRAlIHc2GJc+yfo4n8dJEHyVW583xsP8qC2Sg/OgF+zO6KGrrz6nVwnZ Q0490jyMqGAbmUxyZLKzwbM4IejFOltvoO9Q8OIMQ9IF/ISSaVJm8PHh9niQS8Oa67w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796317586; h=DMARC-Filter:Received:DKIM-Signature:Received:Received:Received: Received:Received:Received:Received:Message-ID:Date:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-TM-AS-GCONF: X-Proofpoint-Reinject:X-Proofpoint-Spam-Info:X-Proofpoint-ORIG-GUID: X-Proofpoint-GUID:X-Authority-Analysis:X-Proofpoint-Spam-Details-Enc: X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details; bh=Nqbgyd0bqrJRRwQ/8XmFhph5ke7tRJ9ZlmC8ShGLpS0=; b=kKqAwO2vxUKbcl8mI397ABd46Pxg8fyTLeccSYF6G2TcM65DPVSHie2vuOMrQAuGgzFs TfowBllqfMg18e3yZu8okspJYttFYrgoluFM0n0YujipKPFjBhUBjiVMtsUE0+M5mCRpo 0q/ShYPPqwLtV26dbDGBgR/l3c0F1etxpuSxBg9ND4yAfd0YxdWzLCebU9wWPNyBn5TY3 YITTbB8ImlOWocNQhIeIJjQfDaK6BHPOm+KXS5eLMkCPpaIAk/ORRCq3lI167nmN5hwoy v8UWZ1JT5+xi7Xsv+bbMJSndjAaeDO51F3g/3UDRQ9ymWg0vlkJeJ3IgyQrSkzYuW9g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=svxPEduh; arc=none smtp.remote-ip=148.163.156.1 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 57562606A322; Thu, 3 Dec 2026 17:06:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 57562606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=svxPEduh Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B3G4Yr13981898; Thu, 3 Dec 2026 17:06:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=Nqbgyd 0bqrJRRwQ/8XmFhph5ke7tRJ9ZlmC8ShGLpS0=; b=svxPEduhfFtVjr9TMyVNyA lSSj1oEZL4fj6SgZg7e08FAKwf8e9LK1L7zO7pgCq/26Y+jAtP6OqrniI0uxbVmC 2jgxeLANnnQ1SUnW+HpkvOExkuRYoVCsnWIrsFq9P7FisXwFzZIJrjdeL7ugaeb3 EvXkrTTGV5Rb7WfNak6x/G/SOSzLPWOkoAg9llL9myz9IidTAT8NGkDpXbrxN5H/ Y3jU7ITxNIKuAYigXVZYmmXnXKNnafMSDPtNpDE//mRLw2tNoUM1MXiN+5PRS+0N FQ4ohN4jWxyypvHVxIjU9W2vMvPMwJNLtjQJT5Ab3GYQgh4FxPRPZKPJ3u/Q4HKQ == 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 4j7pf484xa-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 03 Dec 2026 17:06:24 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6B3Fp7U7771790; Thu, 3 Dec 2026 17:06:23 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4jb7h9970m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Dec 2026 17:06:23 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com [10.241.53.104]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6B3H6MNO30671520 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 3 Dec 2026 17:06:22 GMT Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 578CD5806A; Thu, 3 Dec 2026 17:06:22 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6F16158068; Thu, 3 Dec 2026 17:06:21 +0000 (GMT) Received: from [9.61.141.27] (unknown [9.61.141.27]) by smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 3 Dec 2026 17:06:21 +0000 (GMT) Message-ID: <6fcbafbb-995e-4623-9cdd-c6378039101a@linux.ibm.com> Date: Thu, 3 Dec 2026 12:06:21 -0500 X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] s390/vfio-ap: Unregister the debug area on init failure To: Haoxiang Li , pasic@linux.ibm.com, jjherne@linux.ibm.com, freude@linux.ibm.com, dengler@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, mjrosato@linux.ibm.com Cc: linux-s390@vger.kernel.org, kvm@vger.kernel.org References: <20261203161237.1025099-1-haoxiang_li2024@163.com> Content-Language: en-US From: Anthony Krowiak In-Reply-To: <20261203161237.1025099-1-haoxiang_li2024@163.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAzMDA2OCBTYWx0ZWRfX8YDpexrQIFRP cdUSQdBUiKqhRTIs0k8GzKpIQ2k6lfIcyI1xEgVTeqY+Us0OHZI1iFQ3OQ1hm+LQZKQkB3hJd9C VV9ohP0f//UimGoEgaQYiAk7wHop3jI= X-Proofpoint-ORIG-GUID: azvc5MRAQ8pwIlnsi6CD3LKxGbb9DKpe X-Proofpoint-GUID: lzucFrL1aw20ZV9ubi_LZ7CCmNOrlt-- X-Authority-Analysis: v=2.4 cv=R6eWitRX c=1 sm=1 tr=0 ts=6b11a190 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=Byx-y9mGAAAA:8 a=vzZDoVSaex-pGUTn8yUA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAzMDA2OCBTYWx0ZWRfX3z6nkUDWSGif bMqn9TuHsJYZw0j3ZRyEyTDBKUPXrk9wLeNTuRHeUej6vcjXgmZKtVcb3GGnk8WwpNWdhnrU7fy 4lFa9aRK4iIIiL2O5vJeWjUSUgaRkCiWk7dGOuCEbN5Aq/pTxfNZT/dNILTM6nQyn6Penu97Gvh C6beC/JTT6B+g6tO+DjRqn1+CAoCKsoYkfZEqQqF4Ge3WMHwsq9xNc7TVUExqtXL3RW+0Yn8fZb /6hpkTEmrgCMkFEVy2tEnGx+JUyAXD903H+gOELKfNbM3XDy8268Pt5IM6FRRfFer5MfYC+H+9+ 4peqbFTimpfe6hHzNkBmKwilQCdiQTOt5GGUEmPZDhyu8MbwzGVUPMhCbJtofJ9GbYL4Y5rJKSb M68ysIxsRUZtAkrdBzJreLTj9Rh3Q75e1HVkB8zDlYeX7cXBHuJjdpcKM/QV8swu3Gxtig0PyD+ GPUmH5mYL47VvndPWTQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-03_04,2026-12-03_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 spamscore=0 bulkscore=0 phishscore=0 suspectscore=0 malwarescore=0 clxscore=1015 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612030068 On 12/3/26 11:12 AM, Haoxiang Li wrote: > vfio_ap_dbf_info_init() registers a debug area via debug_register(). > However, vfio_ap_init() does not unregister it if any subsequent > initialization step fails, leaving the debug area registered. > > Fix this by calling debug_unregister() after unwinding the resources > acquired during initialization. Why not just move the vfio_ap_dbf_info_init() call to the end of the function? That would eliminate the need for the goto's > > Fixes: a084c44eaa6a ("s390-vfio-ap: introduces s390 kernel debug feature for vfio_ap device driver") > Signed-off-by: Haoxiang Li > --- > drivers/s390/crypto/vfio_ap_drv.c | 30 +++++++++++++++++------------- > 1 file changed, 17 insertions(+), 13 deletions(-) > > diff --git a/drivers/s390/crypto/vfio_ap_drv.c b/drivers/s390/crypto/vfio_ap_drv.c > index 8e69ed286bb9..9236c77e6a4c 100644 > --- a/drivers/s390/crypto/vfio_ap_drv.c > +++ b/drivers/s390/crypto/vfio_ap_drv.c > @@ -173,28 +173,32 @@ static int __init vfio_ap_init(void) > return ret; > > /* If there are no AP instructions, there is nothing to pass through. */ > - if (!ap_instructions_available()) > - return -ENODEV; > + if (!ap_instructions_available()) { > + ret = -ENODEV; > + goto err_debug; > + } > > ret = vfio_ap_matrix_dev_create(); > if (ret) > - return ret; > + goto err_debug; > > ret = ap_driver_register(&vfio_ap_drv, THIS_MODULE, VFIO_AP_DRV_NAME); > - if (ret) { > - vfio_ap_matrix_dev_destroy(); > - return ret; > - } > + if (ret) > + goto err_matrix; > > ret = vfio_ap_mdev_register(); > - if (ret) { > - ap_driver_unregister(&vfio_ap_drv); > - vfio_ap_matrix_dev_destroy(); > - > - return ret; > - } > + if (ret) > + goto err_ap_driver; > > return 0; > + > +err_ap_driver: > + ap_driver_unregister(&vfio_ap_drv); > +err_matrix: > + vfio_ap_matrix_dev_destroy(); > +err_debug: > + debug_unregister(vfio_ap_dbf_info); > + return ret; > } > > static void __exit vfio_ap_exit(void)