Skip to contentSkip to conversation

Patch "Btrfs: fix extent map leak during fallocate error path" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Mar 22, 2018

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

Btrfs: fix extent map leak during fallocate error path

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
btrfs-fix-extent-map-leak-during-fallocate-error-path.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Thu Mar 22 14:40:23 CET 2018

From: Filipe Manana <[email protected]>
Date: Mon, 3 Apr 2017 15:57:17 +0100
Subject: Btrfs: fix extent map leak during fallocate error path

From: Filipe Manana <[email protected]>

[ Upstream commit be2d253cc98244765323a7c94cc1ac5cd5a17072 ]

If the call to btrfs_qgroup_reserve_data() failed, we were leaking an extent map structure. The failure can happen either due to an -ENOMEM condition or, when quotas are enabled, due to -EDQUOT for example.

---
 fs/btrfs/file.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/file.c +3 -1
@@ -2817,8 +2817,10 @@ static long btrfs_fallocate(struct file
 			}
 			ret = btrfs_qgroup_reserve_data(inode, cur_offset,
 					last_byte - cur_offset);
-			if (ret < 0)
+			if (ret < 0) {
+				free_extent_map(em);
 				break;
+			}
 		} else {
 			/*
 			 * Do not need to reserve unwritten extent for this

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/btrfs-fix-incorrect-space-accounting-after-failure-to-insert-inline-extent.patch queue-4.9/btrfs-fix-extent-map-leak-during-fallocate-error-path.patch queue-4.9/btrfs-send-fix-file-hole-not-being-preserved-due-to-inline-extent.patch