]> git.hungrycats.org Git - linux/commitdiff
btrfs: free iov when btrfs_uring_read_extent fails
authorYang Xiuwei <yangxiuwei@kylinos.cn>
Wed, 19 Aug 2026 02:54:33 +0000 (10:54 +0800)
committerDavid Sterba <dsterba@suse.com>
Thu, 17 Sep 2026 17:48:19 +0000 (19:48 +0200)
After btrfs_uring_read_extent(), the caller always jumped to out_acct.
That skips kfree(data->iov), which is only correct for -EIOCBQUEUED
where the deferred path owns the iov. On failure, fall through to
out_free instead.

Fixes: 34310c442e17 ("btrfs: add io_uring command for encoded reads (ENCODED_READ ioctl)")
Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c

index 54960351fbd1713f9e853620a810e12b5068dd9f..64ccfa5fefdabf99f60a8b80aebce36e14519eb4 100644 (file)
@@ -4865,8 +4865,8 @@ static int btrfs_uring_encoded_read(struct io_uring_cmd *cmd, unsigned int issue
                                              cached_state, disk_bytenr, disk_io_size,
                                              count, data->args.compression,
                                              data->iov, cmd);
-
-               goto out_acct;
+               if (ret == -EIOCBQUEUED)
+                       goto out_acct;
        }
 
 out_free: