Skip to contentSkip to conversation

Btrfs: don't leak delayed node on path allocation failure

PATCH New Filipe David Borba Manana 1 participant 1 message Oct 12, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: don't leak delayed node on path allocation failure

If the path allocation failed, we would return without decrementing the reference count in the delayed node we got before, resulting in a leak.

---
 fs/btrfs/delayed-inode.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/delayed-inode.c +3 -1
index cbd9523..df1a496 100644
@@ -1174,8 +1174,10 @@ int btrfs_commit_inode_delayed_items(struct btrfs_trans_handle *trans,
 	mutex_unlock(&delayed_node->mutex);
 
 	path = btrfs_alloc_path();
-	if (!path)
+	if (!path) {
+		btrfs_release_delayed_node(delayed_node);
 		return -ENOMEM;
+	}
 	path->leave_spinning = 1;
 
 	block_rsv = trans->block_rsv;
Signature · 1 line
1.7.9.5