public inbox for linux-erofs@ozlabs.org
 help / color / mirror / Atom feed
* [PATCH v3] erofs-utils: decompress: fix QPL job leak on error paths
@ 2026-03-20  1:59 Vi-shub
  2026-03-20  5:30 ` Gao Xiang
  0 siblings, 1 reply; 3+ messages in thread
From: Vi-shub @ 2026-03-20  1:59 UTC (permalink / raw)
  To: linux-erofs; +Cc: hsiangkao, Vi-shub

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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] erofs-utils: decompress: fix QPL job leak on error paths
  2026-03-20  1:59 [PATCH v3] erofs-utils: decompress: fix QPL job leak on error paths Vi-shub
@ 2026-03-20  5:30 ` Gao Xiang
  2026-03-20  8:29   ` Shubham Vishwakarma
  0 siblings, 1 reply; 3+ messages in thread
From: Gao Xiang @ 2026-03-20  5:30 UTC (permalink / raw)
  To: Vi-shub, linux-erofs



On 2026/3/20 09:59, Vi-shub wrote:
> 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>

LGTM, will apply.

Thanks,
Gao Xiang


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] erofs-utils: decompress: fix QPL job leak on error paths
  2026-03-20  5:30 ` Gao Xiang
@ 2026-03-20  8:29   ` Shubham Vishwakarma
  0 siblings, 0 replies; 3+ messages in thread
From: Shubham Vishwakarma @ 2026-03-20  8:29 UTC (permalink / raw)
  To: Gao Xiang; +Cc: linux-erofs

[-- Attachment #1: Type: text/plain, Size: 495 bytes --]

Hi Gao,

Got it. Thanks for applying.

Shubham Vishwakarma


On Fri, 20 Mar 2026 at 11:00 AM, Gao Xiang <hsiangkao@linux.alibaba.com>
wrote:

>
>
> On 2026/3/20 09:59, Vi-shub wrote:
> > 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>
>
> LGTM, will apply.
>
> Thanks,
> Gao Xiang
>

[-- Attachment #2: Type: text/html, Size: 999 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-20  8:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20  1:59 [PATCH v3] erofs-utils: decompress: fix QPL job leak on error paths Vi-shub
2026-03-20  5:30 ` Gao Xiang
2026-03-20  8:29   ` Shubham Vishwakarma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox