mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	Btrfs: do not overwrite scrub error with fault error in scrub ioctl
If scrub returned an error and then the copy_to_user() call did not succeed, we would overwrite the error returned by scrub with -EFAULT. Fix that by calling copy_to_user() only if btrfs_scrub_dev() returned success. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
		
							parent
							
								
									bc9a8bf79c
								
							
						
					
					
						commit
						06fe39ab15
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
					@ -4381,7 +4381,7 @@ static long btrfs_ioctl_scrub(struct file *file, void __user *arg)
 | 
				
			||||||
			      &sa->progress, sa->flags & BTRFS_SCRUB_READONLY,
 | 
								      &sa->progress, sa->flags & BTRFS_SCRUB_READONLY,
 | 
				
			||||||
			      0);
 | 
								      0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (copy_to_user(arg, sa, sizeof(*sa)))
 | 
						if (ret == 0 && copy_to_user(arg, sa, sizeof(*sa)))
 | 
				
			||||||
		ret = -EFAULT;
 | 
							ret = -EFAULT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!(sa->flags & BTRFS_SCRUB_READONLY))
 | 
						if (!(sa->flags & BTRFS_SCRUB_READONLY))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue