public inbox for linux-erofs@ozlabs.org
 help / color / mirror / Atom feed
From: Vi-shub <smsharma3121@gmail.com>
To: linux-erofs@lists.ozlabs.org
Cc: hsiangkao@linux.alibaba.com, Vi-shub <smsharma3121@gmail.com>
Subject: [PATCH v3] erofs-utils: decompress: fix QPL job leak on error paths
Date: Fri, 20 Mar 2026 07:29:47 +0530	[thread overview]
Message-ID: <20260320015947.2325-1-smsharma3121@gmail.com> (raw)

Two early returns in z_erofs_decompress_qpl() after a successful
z_erofs_qpl_get_job() skip the cleanup, leaking the job handle.
Use goto out_inflate_end instead.

Signed-off-by: Shubham Sharma <smsharma3121@gmail.com>
---
 lib/decompress.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/decompress.c b/lib/decompress.c
index e7ec83e..eb696d3 100644
--- a/lib/decompress.c
+++ b/lib/decompress.c
@@ -196,13 +196,17 @@ static int z_erofs_decompress_qpl(struct z_erofs_decompress_req *rq)
 		return PTR_ERR(job);
 
 	inputmargin = z_erofs_fixup_insize(src, rq->inputsize);
-	if (inputmargin >= rq->inputsize)
-		return -EFSCORRUPTED;
+	if (inputmargin >= rq->inputsize) {
+		ret = -EFSCORRUPTED;
+		goto out_inflate_end;
+	}
 
 	if (rq->decodedskip) {
 		buff = malloc(rq->decodedlength);
-		if (!buff)
-			return -ENOMEM;
+		if (!buff) {
+			ret = -ENOMEM;
+			goto out_inflate_end;
+		}
 		dest = buff;
 	}
 
-- 
2.39.1.windows.1



             reply	other threads:[~2026-03-20  2:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-20  1:59 Vi-shub [this message]
2026-03-20  5:30 ` [PATCH v3] erofs-utils: decompress: fix QPL job leak on error paths Gao Xiang
2026-03-20  8:29   ` Shubham Vishwakarma

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=20260320015947.2325-1-smsharma3121@gmail.com \
    --to=smsharma3121@gmail.com \
    --cc=hsiangkao@linux.alibaba.com \
    --cc=linux-erofs@lists.ozlabs.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