]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: free pages on error in btrfs_uring_read_extent()
authorMiquel Sabaté Solà <mssola@mssola.com>
Mon, 16 Feb 2026 21:12:15 +0000 (22:12 +0100)
committerDavid Sterba <dsterba@suse.com>
Thu, 26 Feb 2026 14:03:27 +0000 (15:03 +0100)
commit3f501412f2079ca14bf68a18d80a2b7a823f1f64
tree752f818c74cf386ca15f4c96e78156b7d3295427
parent2ab22446425c2c72b44926bc964c263e06e7e137
btrfs: free pages on error in btrfs_uring_read_extent()

In this function the 'pages' object is never freed in the hopes that it is
picked up by btrfs_uring_read_finished() whenever that executes in the
future. But that's just the happy path. Along the way previous
allocations might have gone wrong, or we might not get -EIOCBQUEUED from
btrfs_encoded_read_regular_fill_pages(). In all these cases, we go to a
cleanup section that frees all memory allocated by this function without
assuming any deferred execution, and this also needs to happen for the
'pages' allocation.

Fixes: 34310c442e17 ("btrfs: add io_uring command for encoded reads (ENCODED_READ ioctl)")
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c