From: Vi-shub <smsharma3121@gmail.com>
To: linux-erofs@lists.ozlabs.org
Cc: hsiangkao@linux.alibaba.com, yifan@pku.edu.cn,
Vi-shub <smsharma3121@gmail.com>
Subject: [PATCH] erofs-utils: lib: fix QPL job leak on early error paths in z_erofs_decompress_qpl() After z_erofs_qpl_get_job() succeeds, two early-return error paths bypass z_erofs_qpl_put_job(), leaking the QPL job handle: - Line 200: return -EFSCORRUPTED (when inputmargin >= inputsize) - Line 205: return -ENOMEM (when malloc fails for decodedskip buffer) Fix by replacing the bare returns with goto out_inflate_end, which already handles both z_erofs_qpl_put_job() and free(buff).
Date: Fri, 20 Mar 2026 03:41:36 +0530 [thread overview]
Message-ID: <20260319221136.2126-1-smsharma3121@gmail.com> (raw)
Signed-off-by: Vi-shub <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
next reply other threads:[~2026-03-19 22:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 22:11 Vi-shub [this message]
2026-03-20 1:16 ` [PATCH] erofs-utils: lib: fix QPL job leak on early error paths in z_erofs_decompress_qpl() After z_erofs_qpl_get_job() succeeds, two early-return error paths bypass z_erofs_qpl_put_job(), leaking the QPL job handle: - Line 200: return -EFSCORRUPTED (when inputmargin >= inputsize) - Line 205: return -ENOMEM (when malloc fails for decodedskip buffer) Fix by replacing the bare returns with goto out_inflate_end, which already handles both z_erofs_qpl_put_job() and free(buff) Ajay Rajera
2026-03-20 1:37 ` Gao Xiang
2026-03-20 1:41 ` Shubham Vishwakarma
2026-03-20 2:09 ` Ajay Rajera
2026-03-20 1:41 ` Gao Xiang
2026-03-20 2:04 ` Shubham Vishwakarma
2026-03-20 2:27 ` zhaoyifan (H)
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=20260319221136.2126-1-smsharma3121@gmail.com \
--to=smsharma3121@gmail.com \
--cc=hsiangkao@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=yifan@pku.edu.cn \
/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