mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 08:38:45 +02:00 
			
		
		
		
	fail_function: Remove a redundant mutex unlock
Fix a mutex_unlock() issue where before copy_from_user() is
not called mutex_locked.
Fixes: 4b1a29a7f5 ("error-injection: Support fault injection framework")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Luo Meng <luomeng12@huawei.com>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Link: https://lore.kernel.org/bpf/160570737118.263807.8358435412898356284.stgit@devnote2
			
			
This commit is contained in:
		
							parent
							
								
									14d6d86c21
								
							
						
					
					
						commit
						2801a5da5b
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		|  | @ -253,7 +253,7 @@ static ssize_t fei_write(struct file *file, const char __user *buffer, | |||
| 
 | ||||
| 	if (copy_from_user(buf, buffer, count)) { | ||||
| 		ret = -EFAULT; | ||||
| 		goto out; | ||||
| 		goto out_free; | ||||
| 	} | ||||
| 	buf[count] = '\0'; | ||||
| 	sym = strstrip(buf); | ||||
|  | @ -307,8 +307,9 @@ static ssize_t fei_write(struct file *file, const char __user *buffer, | |||
| 		ret = count; | ||||
| 	} | ||||
| out: | ||||
| 	kfree(buf); | ||||
| 	mutex_unlock(&fei_lock); | ||||
| out_free: | ||||
| 	kfree(buf); | ||||
| 	return ret; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Luo Meng
						Luo Meng