[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240512100930.7p5pylbazn5etw7k@quack3>
Date: Sun, 12 May 2024 12:09:30 +0200
From: Jan Kara <jack@...e.cz>
To: Kemeng Shi <shikemeng@...weicloud.com>
Cc: tytso@....edu, jack@...e.com, linux-ext4@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/9] jbd2: avoid memleak in
jbd2_journal_write_metadata_buffer
On Mon 06-05-24 22:17:53, Kemeng Shi wrote:
> The new_bh is from alloc_buffer_head, we should call free_buffer_head to
> free it in error case.
>
> Signed-off-by: Kemeng Shi <shikemeng@...weicloud.com>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@...e.cz>
Honza
> ---
> 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);
> --
> 2.30.0
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists