mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-03 18:20:25 +02:00 
			
		
		
		
	btrfs: fix dip leak
The btrfs DIO code leaks dip structs when dip->csums allocation fails; bio->bi_end_io isn't set at the point where the free_ordered branch is consequently taken, thus bio_endio doesn't call the function which would free it in the normal case. Fix. Signed-off-by: Daniel J Blueman <daniel.blueman@gmail.com> Acked-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
		
							parent
							
								
									ea8efc74bd
								
							
						
					
					
						commit
						b4966b7770
					
				
					 1 changed files with 1 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -6058,6 +6058,7 @@ static void btrfs_submit_direct(int rw, struct bio *bio, struct inode *inode,
 | 
			
		|||
	if (!skip_sum) {
 | 
			
		||||
		dip->csums = kmalloc(sizeof(u32) * bio->bi_vcnt, GFP_NOFS);
 | 
			
		||||
		if (!dip->csums) {
 | 
			
		||||
			kfree(dip);
 | 
			
		||||
			ret = -ENOMEM;
 | 
			
		||||
			goto free_ordered;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue