aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSidong Yang <sidong.yang@furiosa.ai>2025-03-19 11:24:01 +0000
committerDavid Sterba <dsterba@suse.com>2025-04-01 01:02:26 +0200
commit8e587ab43cb92a9e57f99ea8d6c069ee65863707 (patch)
tree1e82ee19972a0678b1982a6e0dbedb97bd81522b
parentbtrfs: zoned: fix zone finishing with missing devices (diff)
downloadwireguard-linux-8e587ab43cb92a9e57f99ea8d6c069ee65863707.tar.xz
wireguard-linux-8e587ab43cb92a9e57f99ea8d6c069ee65863707.zip
btrfs: ioctl: don't free iov when btrfs_encoded_read() returns -EAGAIN
Fix a bug in encoded read that mistakenly frees the iov in case btrfs_encoded_read() returns -EAGAIN assuming the structure will be reused. This can happen when when receiving requests concurrently, the io_uring subsystem does not reset the data, and the last free will happen in btrfs_uring_read_finished(). Handle the -EAGAIN error and skip freeing iov. CC: stable@vger.kernel.org # 6.13+ Signed-off-by: Sidong Yang <sidong.yang@furiosa.ai> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to '')
-rw-r--r--fs/btrfs/ioctl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index a13d81bb56a0..63aeacc54945 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -4902,6 +4902,8 @@ static int btrfs_uring_encoded_read(struct io_uring_cmd *cmd, unsigned int issue
ret = btrfs_encoded_read(&kiocb, &data->iter, &data->args, &cached_state,
&disk_bytenr, &disk_io_size);
+ if (ret == -EAGAIN)
+ goto out_acct;
if (ret < 0 && ret != -EIOCBQUEUED)
goto out_free;