[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <160570737118.263807.8358435412898356284.stgit@devnote2>
Date: Wed, 18 Nov 2020 22:49:31 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: jbacik@...com, ast@...nel.org
Cc: bpf@...r.kernel.org, mhiramat@...nel.org,
linux-kernel@...r.kernel.org, luomeng12@...wei.com
Subject: [PATCH] fail_function: remove a redundant mutex unlock
From: Luo Meng <luomeng12@...wei.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@...wei.com>
Acked-by: Masami Hiramatsu <mhiramat@...nel.org>
Signed-off-by: Luo Meng <luomeng12@...wei.com>
Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
---
0 files changed
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;
}
Powered by blists - more mailing lists