From: Damien Le Moal <dlemoal@kernel.org>
To: Jackie Liu <liu.yun@linux.dev>, axboe@kernel.dk
Cc: linux-block@vger.kernel.org
Subject: Re: [PATCH 1/2] block: fix zones_cond memory leak in blk_revalidate_disk_zones()
Date: Tue, 31 Mar 2026 19:01:48 +0900 [thread overview]
Message-ID: <723851a5-5219-4310-a311-1107ece2550e@kernel.org> (raw)
In-Reply-To: <db3b585abda63bd1a959c457aaf95572652ebeb5@linux.dev>
On 3/31/26 18:47, Jackie Liu wrote:
>> This does not look correct: on success case, this will free the array despite
>> that array being set already. So rather than this, I think it is better to
>> change disk_revalidate_zone_resources() to free the array it allocated in the
>> case of an error. That will be a lot cleaner than this.
>
> Thanks for the review.
>
> Actually, the free_zones_cond label is only reachable on error paths
> (ret <= 0). On the success path (ret > 0), the function returns
> directly via "return disk_update_zone_resources(disk, &args)" and never
> reaches this label. So the logic should be correct.
Ah, yes, indeed.
>
> That said, I agree that having disk_revalidate_zone_resources() free
> the array itself on error is cleaner and easier to follow. I'll send
> a v2 with that approach.
Sounds good. Thanks.
>
--
Damien Le Moal
Western Digital Research
prev parent reply other threads:[~2026-03-31 10:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 8:47 [PATCH 1/2] block: fix zones_cond memory leak in blk_revalidate_disk_zones() Jackie Liu
2026-03-31 9:18 ` Damien Le Moal
2026-03-31 9:47 ` Jackie Liu
2026-03-31 10:01 ` Damien Le Moal [this message]
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=723851a5-5219-4310-a311-1107ece2550e@kernel.org \
--to=dlemoal@kernel.org \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=liu.yun@linux.dev \
/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