mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-08 10:35:54 -04:00
Btrfs: fix use after free in O_DIRECT
This fixes a bug where we use dip after we have freed it. Instead just use the file_offset that was passed to the function. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
This commit is contained in:
@@ -5934,8 +5934,7 @@ static void btrfs_submit_direct(int rw, struct bio *bio, struct inode *inode,
|
||||
*/
|
||||
if (write) {
|
||||
struct btrfs_ordered_extent *ordered;
|
||||
ordered = btrfs_lookup_ordered_extent(inode,
|
||||
dip->logical_offset);
|
||||
ordered = btrfs_lookup_ordered_extent(inode, file_offset);
|
||||
if (!test_bit(BTRFS_ORDERED_PREALLOC, &ordered->flags) &&
|
||||
!test_bit(BTRFS_ORDERED_NOCOW, &ordered->flags))
|
||||
btrfs_free_reserved_extent(root, ordered->start,
|
||||
|
||||
Reference in New Issue
Block a user