All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fail_function: remove a redundant mutex unlock
@ 2020-11-10  8:42 Luo Meng
  2020-11-11  9:31 ` Masami Hiramatsu
  2020-11-18 13:49 ` Masami Hiramatsu
  0 siblings, 2 replies; 6+ messages in thread
From: Luo Meng @ 2020-11-10  8:42 UTC (permalink / raw)
  To: jbacik, ast, mhiramat, linux-kernel, luomeng12

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>
Signed-off-by: Luo Meng <luomeng12@huawei.com>
---
 kernel/fail_function.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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;
 }
 
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] fail_function: remove a redundant mutex unlock
  2020-11-10  8:42 [PATCH] fail_function: remove a redundant mutex unlock Luo Meng
@ 2020-11-11  9:31 ` Masami Hiramatsu
  2020-11-18  4:08   ` Alexei Starovoitov
  2020-11-18 13:49 ` Masami Hiramatsu
  1 sibling, 1 reply; 6+ messages in thread
From: Masami Hiramatsu @ 2020-11-11  9:31 UTC (permalink / raw)
  To: Luo Meng; +Cc: jbacik, ast, linux-kernel, stable

Hi Luo,

On Tue, 10 Nov 2020 16:42:45 +0800
Luo Meng <luomeng12@huawei.com> wrote:

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

Oops, thank you for the fix.

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

> 
> Fixes: 4b1a29a7f542 ("error-injection: Support fault injection framework")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Luo Meng <luomeng12@huawei.com>
> ---
>  kernel/fail_function.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> 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;
>  }
>  
> -- 
> 2.25.4
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] fail_function: remove a redundant mutex unlock
  2020-11-11  9:31 ` Masami Hiramatsu
@ 2020-11-18  4:08   ` Alexei Starovoitov
  2020-11-18 13:37     ` Masami Hiramatsu
  0 siblings, 1 reply; 6+ messages in thread
From: Alexei Starovoitov @ 2020-11-18  4:08 UTC (permalink / raw)
  To: Masami Hiramatsu; +Cc: Luo Meng, Josef Bacik, Alexei Starovoitov, LKML, stable

On Wed, Nov 11, 2020 at 1:31 AM Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> Hi Luo,
>
> On Tue, 10 Nov 2020 16:42:45 +0800
> Luo Meng <luomeng12@huawei.com> wrote:
>
> > Fix a mutex_unlock() issue where before copy_from_user() is
> > not called mutex_locked.
>
> Oops, thank you for the fix.
>
> Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Did anyone pick this up?
If not, please resend cc-ing bpf@vger so it can get into patchwork and
be processed by bpf maintainers.

Thanks!

> >
> > Fixes: 4b1a29a7f542 ("error-injection: Support fault injection framework")
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Luo Meng <luomeng12@huawei.com>
> > ---
> >  kernel/fail_function.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > 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;
> >  }
> >
> > --
> > 2.25.4
> >
>
>
> --
> Masami Hiramatsu <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] fail_function: remove a redundant mutex unlock
  2020-11-18  4:08   ` Alexei Starovoitov
@ 2020-11-18 13:37     ` Masami Hiramatsu
  0 siblings, 0 replies; 6+ messages in thread
From: Masami Hiramatsu @ 2020-11-18 13:37 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: Luo Meng, Josef Bacik, Alexei Starovoitov, LKML, stable

Hi,

On Tue, 17 Nov 2020 20:08:08 -0800
Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:

> On Wed, Nov 11, 2020 at 1:31 AM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> >
> > Hi Luo,
> >
> > On Tue, 10 Nov 2020 16:42:45 +0800
> > Luo Meng <luomeng12@huawei.com> wrote:
> >
> > > Fix a mutex_unlock() issue where before copy_from_user() is
> > > not called mutex_locked.
> >
> > Oops, thank you for the fix.
> >
> > Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
> 
> Did anyone pick this up?
> If not, please resend cc-ing bpf@vger so it can get into patchwork and
> be processed by bpf maintainers.

OK, I'll resend this to the bpf@vger. 

Thank you,

> 
> Thanks!
> 
> > >
> > > Fixes: 4b1a29a7f542 ("error-injection: Support fault injection framework")
> > > Reported-by: Hulk Robot <hulkci@huawei.com>
> > > Signed-off-by: Luo Meng <luomeng12@huawei.com>
> > > ---
> > >  kernel/fail_function.c | 5 +++--
> > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > >
> > > 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;
> > >  }
> > >
> > > --
> > > 2.25.4
> > >
> >
> >
> > --
> > Masami Hiramatsu <mhiramat@kernel.org>


-- 
Masami Hiramatsu <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] fail_function: remove a redundant mutex unlock
  2020-11-10  8:42 [PATCH] fail_function: remove a redundant mutex unlock Luo Meng
  2020-11-11  9:31 ` Masami Hiramatsu
@ 2020-11-18 13:49 ` Masami Hiramatsu
  2020-11-19 19:10   ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 6+ messages in thread
From: Masami Hiramatsu @ 2020-11-18 13:49 UTC (permalink / raw)
  To: jbacik, ast; +Cc: bpf, mhiramat, linux-kernel, luomeng12

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

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;
 }
 


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] fail_function: remove a redundant mutex unlock
  2020-11-18 13:49 ` Masami Hiramatsu
@ 2020-11-19 19:10   ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2020-11-19 19:10 UTC (permalink / raw)
  To: Masami Hiramatsu; +Cc: jbacik, ast, bpf, linux-kernel, luomeng12

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



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-11-19 19:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10  8:42 [PATCH] fail_function: remove a redundant mutex unlock Luo Meng
2020-11-11  9:31 ` Masami Hiramatsu
2020-11-18  4:08   ` Alexei Starovoitov
2020-11-18 13:37     ` Masami Hiramatsu
2020-11-18 13:49 ` Masami Hiramatsu
2020-11-19 19:10   ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.