mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	Btrfs: don't leak reloc root nodes on error
We don't track the reloc roots in any sort of normal way, so the only way the root/commit_root nodes get free'd is if the relocation finishes successfully and the reloc root is deleted. Fix this by free'ing them in free_reloc_roots. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
		
							parent
							
								
									e2c8990734
								
							
						
					
					
						commit
						6bdf131fac
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		|  | @ -2357,6 +2357,10 @@ void free_reloc_roots(struct list_head *list) | ||||||
| 	while (!list_empty(list)) { | 	while (!list_empty(list)) { | ||||||
| 		reloc_root = list_entry(list->next, struct btrfs_root, | 		reloc_root = list_entry(list->next, struct btrfs_root, | ||||||
| 					root_list); | 					root_list); | ||||||
|  | 		free_extent_buffer(reloc_root->node); | ||||||
|  | 		free_extent_buffer(reloc_root->commit_root); | ||||||
|  | 		reloc_root->node = NULL; | ||||||
|  | 		reloc_root->commit_root = NULL; | ||||||
| 		__del_reloc_root(reloc_root); | 		__del_reloc_root(reloc_root); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Josef Bacik
						Josef Bacik