diff mbox series

fail_function: remove a redundant mutex unlock

Message ID 160570737118.263807.8358435412898356284.stgit@devnote2 (mailing list archive)
State Accepted
Commit 891515d945a31d2d86dc9b338455962659ea14f9
Delegated to: BPF
Headers show
Series fail_function: remove a redundant mutex unlock | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Masami Hiramatsu (Google) Nov. 18, 2020, 1:49 p.m. UTC
From: Luo Meng <luomeng12@huawei.com>

Fix a mutex_unlock() issue where before copy_from_user() is
not called mutex_locked.

Fixes: 4b1a29a7f542 ("error-injection: Support fault injection framework")
Reported-by: Hulk Robot <hulkci@huawei.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Luo Meng <luomeng12@huawei.com>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 0 files changed

Comments

patchwork-bot+netdevbpf@kernel.org Nov. 19, 2020, 7:10 p.m. UTC | #1
Hello:

This patch was applied to bpf/bpf.git (refs/heads/master):

On Wed, 18 Nov 2020 22:49:31 +0900 you wrote:
> From: Luo Meng <luomeng12@huawei.com>
> 
> Fix a mutex_unlock() issue where before copy_from_user() is
> not called mutex_locked.
> 
> Fixes: 4b1a29a7f542 ("error-injection: Support fault injection framework")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
> Signed-off-by: Luo Meng <luomeng12@huawei.com>
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> 
> [...]

Here is the summary with links:
  - fail_function: remove a redundant mutex unlock
    https://git.kernel.org/bpf/bpf/c/891515d945a3

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/kernel/fail_function.c b/kernel/fail_function.c
index 63b349168da7..b0b1ad93fa95 100644
--- a/kernel/fail_function.c
+++ b/kernel/fail_function.c
@@ -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;
 }