Commit 6288958
btrfs: free pages on error in btrfs_uring_read_extent()
[ Upstream commit 3f50141 ]
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: 34310c4 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent e109404 commit 6288958
1 file changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4661 | 4661 | | |
4662 | 4662 | | |
4663 | 4663 | | |
4664 | | - | |
| 4664 | + | |
4665 | 4665 | | |
4666 | 4666 | | |
4667 | 4667 | | |
| |||
4719 | 4719 | | |
4720 | 4720 | | |
4721 | 4721 | | |
| 4722 | + | |
| 4723 | + | |
| 4724 | + | |
| 4725 | + | |
| 4726 | + | |
4722 | 4727 | | |
4723 | 4728 | | |
4724 | 4729 | | |
| |||
0 commit comments