public inbox for linux-erofs@ozlabs.org
 help / color / mirror / Atom feed
* [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).
@ 2026-03-19 22:11 Vi-shub
  2026-03-20  1:16 ` Ajay Rajera
  0 siblings, 1 reply; 8+ messages in thread
From: Vi-shub @ 2026-03-19 22:11 UTC (permalink / raw)
  To: linux-erofs; +Cc: hsiangkao, yifan, Vi-shub

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



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

* Re: [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).
  2026-03-19 22:11 [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) Vi-shub
@ 2026-03-20  1:16 ` Ajay Rajera
  2026-03-20  1:37   ` Gao Xiang
  0 siblings, 1 reply; 8+ messages in thread
From: Ajay Rajera @ 2026-03-20  1:16 UTC (permalink / raw)
  To: Vi-shub; +Cc: linux-erofs, hsiangkao, yifan

Hi Vi-shub,
just a review :
I think the fix looks correct and it is the right approach but the
commit message formatting needs work. The entire description is in the
subject line. Per kernel conventions, the subject should be a short
one-liner, e.g: erofs-utils: lib: fix QPL job leak on early error
paths
The detailed explanation (which error paths leak, why, and how the fix
works) should go in the commit message body, separated from the
subject.

So you can resend with the subject/body split fixed? so It will look more clear.
Thanks, Ajay


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

* Re: [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).
  2026-03-20  1:16 ` Ajay Rajera
@ 2026-03-20  1:37   ` Gao Xiang
  2026-03-20  1:41     ` Shubham Vishwakarma
  2026-03-20  1:41     ` Gao Xiang
  0 siblings, 2 replies; 8+ messages in thread
From: Gao Xiang @ 2026-03-20  1:37 UTC (permalink / raw)
  To: Ajay Rajera, Vi-shub; +Cc: linux-erofs, yifan



On 2026/3/20 09:16, Ajay Rajera wrote:
> Hi Vi-shub,
> just a review :
> I think the fix looks correct and it is the right approach but the
> commit message formatting needs work. The entire description is in the
> subject line. Per kernel conventions, the subject should be a short
> one-liner, e.g: erofs-utils: lib: fix QPL job leak on early error
> paths
> The detailed explanation (which error paths leak, why, and how the fix
> works) should go in the commit message body, separated from the
> subject.
> 
> So you can resend with the subject/body split fixed? so It will look more clear.

yes, the commit message is in a mess.

Thanks,
Gao Xiang

> Thanks, Ajay



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

* Re: [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).
  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
  1 sibling, 1 reply; 8+ messages in thread
From: Shubham Vishwakarma @ 2026-03-20  1:41 UTC (permalink / raw)
  To: Gao Xiang; +Cc: Ajay Rajera, linux-erofs, yifan

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

Hi Gao and Ajay,

Thank you for the review and for pointing that out.

I apologize for the formatting; I made a mistake while using the CLI SMTP
instead of my usual Gmail GUI. I will correct the subject line and commit
message body and resend the patch shortly.

Thanks,
Shubham Vishwakarma

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

>
>
> On 2026/3/20 09:16, Ajay Rajera wrote:
> > Hi Vi-shub,
> > just a review :
> > I think the fix looks correct and it is the right approach but the
> > commit message formatting needs work. The entire description is in the
> > subject line. Per kernel conventions, the subject should be a short
> > one-liner, e.g: erofs-utils: lib: fix QPL job leak on early error
> > paths
> > The detailed explanation (which error paths leak, why, and how the fix
> > works) should go in the commit message body, separated from the
> > subject.
> >
> > So you can resend with the subject/body split fixed? so It will look
> more clear.
>
> yes, the commit message is in a mess.
>
> Thanks,
> Gao Xiang
>
> > Thanks, Ajay
>
>

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

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

* Re: [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).
  2026-03-20  1:37   ` Gao Xiang
  2026-03-20  1:41     ` Shubham Vishwakarma
@ 2026-03-20  1:41     ` Gao Xiang
  2026-03-20  2:04       ` Shubham Vishwakarma
  1 sibling, 1 reply; 8+ messages in thread
From: Gao Xiang @ 2026-03-20  1:41 UTC (permalink / raw)
  To: Ajay Rajera, Vi-shub; +Cc: linux-erofs, yifan



On 2026/3/20 09:37, Gao Xiang wrote:
> 
> 
> On 2026/3/20 09:16, Ajay Rajera wrote:
>> Hi Vi-shub,
>> just a review :
>> I think the fix looks correct and it is the right approach but the
>> commit message formatting needs work. The entire description is in the
>> subject line. Per kernel conventions, the subject should be a short
>> one-liner, e.g: erofs-utils: lib: fix QPL job leak on early error
>> paths
>> The detailed explanation (which error paths leak, why, and how the fix
>> works) should go in the commit message body, separated from the
>> subject.
>>
>> So you can resend with the subject/body split fixed? so It will look more clear.
> 
> yes, the commit message is in a mess.

BTW, I don't know who is using the email address
<yifan@pku.edu.cn>, and the recipient doesn't exist.

Here, I want to say, I have to identfy you as another
AI bot.

Thanks,
Gao Xiang

> 
> Thanks,
> Gao Xiang
> 
>> Thanks, Ajay
> 



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

* Re: [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).
  2026-03-20  1:41     ` Gao Xiang
@ 2026-03-20  2:04       ` Shubham Vishwakarma
  2026-03-20  2:27         ` zhaoyifan (H)
  0 siblings, 1 reply; 8+ messages in thread
From: Shubham Vishwakarma @ 2026-03-20  2:04 UTC (permalink / raw)
  To: Gao Xiang; +Cc: Ajay Rajera, linux-erofs

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

 Hi Gao,

I understand the concern, but I want to be honest: if I had used AI to
draft the initial submission, it likely would have been sent without those
formatting errors.

The issues with the invalid email address and the oversized subject line
occurred because I was unfamiliar with sending via the SMTP CLI. I used GPT
to help me configure the CLI tool, which led to the mistakes you saw.

I appreciate the feedback on the patch. If there is still doubt regarding
my work, I will continue to submit more patches to demonstrate my ability.

Thanks,

Shubham Vishwakarma


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

>
>
> On 2026/3/20 09:37, Gao Xiang wrote:
> >
> >
> > On 2026/3/20 09:16, Ajay Rajera wrote:
> >> Hi Vi-shub,
> >> just a review :
> >> I think the fix looks correct and it is the right approach but the
> >> commit message formatting needs work. The entire description is in the
> >> subject line. Per kernel conventions, the subject should be a short
> >> one-liner, e.g: erofs-utils: lib: fix QPL job leak on early error
> >> paths
> >> The detailed explanation (which error paths leak, why, and how the fix
> >> works) should go in the commit message body, separated from the
> >> subject.
> >>
> >> So you can resend with the subject/body split fixed? so It will look
> more clear.
> >
> > yes, the commit message is in a mess.
>
> BTW, I don't know who is using the email address
> <yifan@pku.edu.cn>, and the recipient doesn't exist.
>
> Here, I want to say, I have to identfy you as another
> AI bot.
>
> Thanks,
> Gao Xiang
>
> >
> > Thanks,
> > Gao Xiang
> >
> >> Thanks, Ajay
> >
>
>

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

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

* Re: [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).
  2026-03-20  1:41     ` Shubham Vishwakarma
@ 2026-03-20  2:09       ` Ajay Rajera
  0 siblings, 0 replies; 8+ messages in thread
From: Ajay Rajera @ 2026-03-20  2:09 UTC (permalink / raw)
  To: Shubham Vishwakarma; +Cc: Gao Xiang, linux-erofs

hi, I just want to let you know that this email address
<yifan@pku.edu.cn> is incorrect, the recipient doesn't exist so it is
better to not use it anymore.
Thanks, Ajay Rajera.

On Fri, 20 Mar 2026 at 07:11, Shubham Vishwakarma
<smsharma3121@gmail.com> wrote:
>
> Hi Gao and Ajay,
>
> Thank you for the review and for pointing that out.
>
> I apologize for the formatting; I made a mistake while using the CLI SMTP instead of my usual Gmail GUI. I will correct the subject line and commit message body and resend the patch shortly.
>
> Thanks,
> Shubham Vishwakarma
>
> On Fri, Mar 20, 2026 at 7:07 AM Gao Xiang <hsiangkao@linux.alibaba.com> wrote:
>>
>>
>>
>> On 2026/3/20 09:16, Ajay Rajera wrote:
>> > Hi Vi-shub,
>> > just a review :
>> > I think the fix looks correct and it is the right approach but the
>> > commit message formatting needs work. The entire description is in the
>> > subject line. Per kernel conventions, the subject should be a short
>> > one-liner, e.g: erofs-utils: lib: fix QPL job leak on early error
>> > paths
>> > The detailed explanation (which error paths leak, why, and how the fix
>> > works) should go in the commit message body, separated from the
>> > subject.
>> >
>> > So you can resend with the subject/body split fixed? so It will look more clear.
>>
>> yes, the commit message is in a mess.
>>
>> Thanks,
>> Gao Xiang
>>
>> > Thanks, Ajay
>>


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

* Re: [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).
  2026-03-20  2:04       ` Shubham Vishwakarma
@ 2026-03-20  2:27         ` zhaoyifan (H)
  0 siblings, 0 replies; 8+ messages in thread
From: zhaoyifan (H) @ 2026-03-20  2:27 UTC (permalink / raw)
  To: Shubham Vishwakarma, Gao Xiang; +Cc: Ajay Rajera, linux-erofs

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

Hi Vishwakarma,


Just a quick note for you and all the beginning committers:

Before submitting any patch to our community mailing list, please 
carefully read the contribution guidelines (we follow the Linux kernel 
process: [1]).

You're welcome to use AI agents to help check whether the patch obeys 
the guidelines, but please remember to personally review your changes, 
test locally, and understand what you're submitting.


Also we are about to publish specific guidelines for AI-assisted content.


Finally, before sending any email to the mailing list, we strongly 
recommend sending a test to your own inbox first—messages posted to the 
list are permanent and cannot be edited or retracted.


[1] https://docs.kernel.org/process/submitting-patches.html

[ This email is generated with help with Qwen3.5-plus: translation from 
Chinese to English ]


Thanks,

Yifan Zhao


On 2026/3/20 10:04, Shubham Vishwakarma wrote:
> Hi Gao,
>
> I understand the concern, but I want to be honest: if I had used AI to 
> draft the initial submission, it likely would have been sent without 
> those formatting errors.
>
> The issues with the invalid email address and the oversized subject 
> line occurred because I was unfamiliar with sending via the SMTP CLI. 
> I used GPT to help me configure the CLI tool, which led to the 
> mistakes you saw.
>
> I appreciate the feedback on the patch. If there is still doubt 
> regarding my work, I will continue to submit more patches to 
> demonstrate my ability.
>
> Thanks,
>
> Shubham Vishwakarma
>
>
> On Fri, Mar 20, 2026 at 7:11 AM Gao Xiang 
> <hsiangkao@linux.alibaba.com> wrote:
>
>
>
>     On 2026/3/20 09:37, Gao Xiang wrote:
>     >
>     >
>     > On 2026/3/20 09:16, Ajay Rajera wrote:
>     >> Hi Vi-shub,
>     >> just a review :
>     >> I think the fix looks correct and it is the right approach but the
>     >> commit message formatting needs work. The entire description is
>     in the
>     >> subject line. Per kernel conventions, the subject should be a short
>     >> one-liner, e.g: erofs-utils: lib: fix QPL job leak on early error
>     >> paths
>     >> The detailed explanation (which error paths leak, why, and how
>     the fix
>     >> works) should go in the commit message body, separated from the
>     >> subject.
>     >>
>     >> So you can resend with the subject/body split fixed? so It will
>     look more clear.
>     >
>     > yes, the commit message is in a mess.
>
>     BTW, I don't know who is using the email address
>     <yifan@pku.edu.cn>, and the recipient doesn't exist.
>
>     Here, I want to say, I have to identfy you as another
>     AI bot.
>
>     Thanks,
>     Gao Xiang
>
>     >
>     > Thanks,
>     > Gao Xiang
>     >
>     >> Thanks, Ajay
>     >
>

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

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

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

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19 22:11 [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) Vi-shub
2026-03-20  1:16 ` 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)

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