lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <448062a9-43f8-c7ad-0b4d-ddf892713d9e@huaweicloud.com>
Date: Mon, 6 May 2024 22:42:02 +0800
From: Zhang Yi <yi.zhang@...weicloud.com>
To: Kemeng Shi <shikemeng@...weicloud.com>
Cc: linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org, tytso@....edu,
 jack@...e.com
Subject: Re: [PATCH 1/9] jbd2: avoid memleak in
 jbd2_journal_write_metadata_buffer

On 2024/5/6 22:17, Kemeng Shi wrote:
> The new_bh is from alloc_buffer_head, we should call free_buffer_head to
> free it in error case.

Oh, yeah, this is a separate bh, so it should be freed explicitly, it
looks good to me.

Reviewed-by: Zhang Yi <yi.zhang@...wei.com>

> 
> Signed-off-by: Kemeng Shi <shikemeng@...weicloud.com>
> ---
>  fs/jbd2/journal.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index b6c114c11b97..207b24e12ce9 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -399,6 +399,7 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
>  		tmp = jbd2_alloc(bh_in->b_size, GFP_NOFS);
>  		if (!tmp) {
>  			brelse(new_bh);
> +			free_buffer_head(new_bh);
>  			return -ENOMEM;
>  		}
>  		spin_lock(&jh_in->b_state_lock);
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ