From: Anthony Krowiak <akrowiak@linux.ibm.com>
To: Haoxiang Li <haoxiang_li2024@163.com>,
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
Subject: Re: [PATCH] s390/vfio-ap: Unregister the debug area on init failure
Date: Thu, 3 Dec 2026 12:06:21 -0500 [thread overview]
Message-ID: <6fcbafbb-995e-4623-9cdd-c6378039101a@linux.ibm.com> (raw)
In-Reply-To: <20261203161237.1025099-1-haoxiang_li2024@163.com>
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 <haoxiang_li2024@163.com>
> ---
> 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)
prev parent reply other threads:[~2026-12-03 17:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 16:12 [PATCH] s390/vfio-ap: Unregister the debug area on init failure Haoxiang Li
2026-12-03 16:21 ` sashiko-bot
2026-12-03 17:06 ` Anthony Krowiak [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6fcbafbb-995e-4623-9cdd-c6378039101a@linux.ibm.com \
--to=akrowiak@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=dengler@linux.ibm.com \
--cc=freude@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=haoxiang_li2024@163.com \
--cc=hca@linux.ibm.com \
--cc=jjherne@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjrosato@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=svens@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox