Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Volkan Unal <vunal@linux.ibm.com>
To: linux-s390@vger.kernel.org
Subject: [PATCH v1] s390/dasd: Fix memory leak in FBA driver initialization
Date: Wed, 14 Oct 2026 15:21:30 +0100	[thread overview]
Message-ID: <20261014142130.756272-1-vunal@linux.ibm.com> (raw)

Fix memory leak in dasd_fba_init() where the allocated zero page
is not freed if ccw_driver_register() fails.

Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Volkan Unal <vunal@linux.ibm.com>
---
 drivers/s390/block/dasd_fba.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
index 3f56b353b868..3b8d15e9a2de 100644
--- a/drivers/s390/block/dasd_fba.c
+++ b/drivers/s390/block/dasd_fba.c
@@ -804,10 +804,13 @@ dasd_fba_init(void)
 		return -ENOMEM;
 
 	ret = ccw_driver_register(&dasd_fba_driver);
-	if (!ret)
-		wait_for_device_probe();
+	if (ret) {
+		free_page((unsigned long)dasd_fba_zero_page);
+		return ret;
+	}
 
-	return ret;
+	wait_for_device_probe();
+	return 0;
 }
 
 static void __exit
-- 
2.55.0


             reply	other threads:[~2026-10-14 14:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 14:21 Volkan Unal [this message]
2026-10-14 14:27 ` [PATCH v1] s390/dasd: Fix memory leak in FBA driver initialization sashiko-bot

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=20261014142130.756272-1-vunal@linux.ibm.com \
    --to=vunal@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    /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