Re: [PATCH] ext4: fix buffer_head leak in ext4_ind_map_blocks() error path

From: Theodore Ts'o

Date: Thu Nov 19 2026 - 09:48:34 EST



On Fri, 09 Oct 2026 06:28:46 +0000, guolingxing wrote:
> When ext4_ind_map_blocks() is called with EXT4_GET_BLOCKS_CREATE on
> a non-extent mapped inode of a filesystem with the bigalloc feature
> enabled, it fails with -EFSCORRUPTED via 'goto out'. However, at
> this point ext4_get_branch() has already acquired buffer_head
> references for the chain of indirect blocks, which are stored in
> the stack variable 'chain'. Since 'goto out' skips the cleanup
> loop that releases these references, they are leaked permanently
> (each failed allocation can leak up to 3 buffer_heads, and repeated
> allocation attempts keep pinning the corresponding pages in memory).
>
> [...]

Applied, thanks!

[1/1] ext4: fix buffer_head leak in ext4_ind_map_blocks() error path
commit: 79dd565874b3fa2d5cbafb2c2cb00ba850e6d4a8

Best regards,
--
Theodore Ts'o <tytso@xxxxxxx>