Skip to contentSkip to conversation

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).

PATCH In review Vi-shub 4 participants 8 messages Mar 19 – Mar 20 Library code

lore
Share & tools
lore

Vi-shub

author
#0 lore raw

PATCH 1/1 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).

---
 lib/decompress.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
lib/decompress.c +8 -4
index e7ec83e..eb696d3 100644
@@ -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;
 	}
 
Signature · 1 line
2.39.1.windows.1
#1 lore raw

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

#2 lore raw
Quoted 11 lines · Ajay Rajera

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.

Quoted 1 line

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

Quoted 1 line

Thanks, Ajay

#3 lore raw
Quoted 14 lines · Gao Xiang
Quoted 11 lines · Ajay Rajera

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.

Quoted 3 lines
Quoted 1 line

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 <[email protected]>, and the recipient doesn't exist.

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

Thanks,
Gao Xiang

Quoted 6 lines

Thanks,
Gao Xiang

Quoted 1 line

Thanks, Ajay

#4 lore raw

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

Quoted 39 lines · Gao Xiang
Quoted 14 lines · Gao Xiang
Quoted 11 lines · Ajay Rajera

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.

Quoted 1 line
Quoted 1 line

So you can resend with the subject/body split fixed? so It will look

more clear.

Quoted 2 lines

yes, the commit message is in a mess.

BTW, I don't know who is using the email address <[email protected]>, and the recipient doesn't exist.

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

Thanks,
Gao Xiang

Quoted 6 lines

Thanks,
Gao Xiang

Quoted 1 line

Thanks, Ajay

#5 lore raw

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

Quoted 55 lines · Shubham Vishwakarma

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 <[email protected]> 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 <[email protected]>, 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
>

#6 lore raw
In reply to Gao Xiang

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

Quoted 25 lines · Gao Xiang
Quoted 11 lines · Ajay Rajera

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.

Quoted 1 line

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

Quoted 1 line

Thanks, Ajay

#7 lore raw

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

Quoted 35 lines · Shubham Vishwakarma

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

Quoted 24 lines · Gao Xiang
Quoted 11 lines · Ajay Rajera

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.

Quoted 1 line

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

Quoted 1 line

Thanks, Ajay