2020-03-30 02:20:02

by Zhiqiang Liu

[permalink] [raw]
Subject: [PATCH] signal: check sig before setting info in kill_pid_usb_asyncio


In kill_pid_usb_asyncio, if signal is not valid, we do not need to
set info struct.

Signed-off-by: Zhiqiang Liu <[email protected]>
---
kernel/signal.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 9ad8dea93dbb..9cdc9e388a19 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1505,15 +1505,15 @@ int kill_pid_usb_asyncio(int sig, int errno, sigval_t addr,
unsigned long flags;
int ret = -EINVAL;

+ if (!valid_signal(sig))
+ return ret;
+
clear_siginfo(&info);
info.si_signo = sig;
info.si_errno = errno;
info.si_code = SI_ASYNCIO;
*((sigval_t *)&info.si_pid) = addr;

- if (!valid_signal(sig))
- return ret;
-
rcu_read_lock();
p = pid_task(pid, PIDTYPE_PID);
if (!p) {
--
2.19.1


2020-03-30 08:46:21

by Christian Brauner

[permalink] [raw]
Subject: Re: [PATCH] signal: check sig before setting info in kill_pid_usb_asyncio

On Mon, Mar 30, 2020 at 10:18:33AM +0800, Zhiqiang Liu wrote:
>
> In kill_pid_usb_asyncio, if signal is not valid, we do not need to
> set info struct.
>
> Signed-off-by: Zhiqiang Liu <[email protected]>

I'd have done:

if (!valid_signal(sig))
return -EINVAL;

instead of setting ret to EINVAL above but that's mostly a matter of style.

Picking this up unless someone sees a problem with it.

Thank you!
Acked-by: Christian Brauner <[email protected]>

2020-04-09 03:27:36

by Zhiqiang Liu

[permalink] [raw]
Subject: Re: [PATCH] signal: check sig before setting info in kill_pid_usb_asyncio

Friendly ping...

On 2020/3/30 16:44, Christian Brauner wrote:
> On Mon, Mar 30, 2020 at 10:18:33AM +0800, Zhiqiang Liu wrote:
>>
>> In kill_pid_usb_asyncio, if signal is not valid, we do not need to
>> set info struct.
>>
>> Signed-off-by: Zhiqiang Liu <[email protected]>
>
> I'd have done:
>
> if (!valid_signal(sig))
> return -EINVAL;
>
> instead of setting ret to EINVAL above but that's mostly a matter of style.
>
> Picking this up unless someone sees a problem with it.
>
> Thank you!
> Acked-by: Christian Brauner <[email protected]>
>
> .
>

2020-04-09 06:55:13

by Christian Brauner

[permalink] [raw]
Subject: Re: [PATCH] signal: check sig before setting info in kill_pid_usb_asyncio

On April 9, 2020 5:26:08 AM GMT+02:00, Zhiqiang Liu <[email protected]> wrote:
>Friendly ping...
>
>On 2020/3/30 16:44, Christian Brauner wrote:
>> On Mon, Mar 30, 2020 at 10:18:33AM +0800, Zhiqiang Liu wrote:
>>>
>>> In kill_pid_usb_asyncio, if signal is not valid, we do not need to
>>> set info struct.
>>>
>>> Signed-off-by: Zhiqiang Liu <[email protected]>
>>
>> I'd have done:
>>
>> if (!valid_signal(sig))
>> return -EINVAL;
>>
>> instead of setting ret to EINVAL above but that's mostly a matter of
>style.
>>
>> Picking this up unless someone sees a problem with it.
>>
>> Thank you!
>> Acked-by: Christian Brauner <[email protected]>
>>
>> .
>>

The patches are queued for after rc1. So around next week.
They came too late to make it into the merge window.

Christian

2020-04-09 08:44:39

by Zhiqiang Liu

[permalink] [raw]
Subject: Re: [PATCH] signal: check sig before setting info in kill_pid_usb_asyncio



On 2020/4/9 14:53, Christian Brauner wrote:
> On April 9, 2020 5:26:08 AM GMT+02:00, Zhiqiang Liu <[email protected]> wrote:
>> Friendly ping...
>>
>> On 2020/3/30 16:44, Christian Brauner wrote:
>>> On Mon, Mar 30, 2020 at 10:18:33AM +0800, Zhiqiang Liu wrote:
>>>>
>>>> In kill_pid_usb_asyncio, if signal is not valid, we do not need to
>>>> set info struct.
>>>>
>>>> Signed-off-by: Zhiqiang Liu <[email protected]>
>>>
>>> I'd have done:
>>>
>>> if (!valid_signal(sig))
>>> return -EINVAL;
>>>
>>> instead of setting ret to EINVAL above but that's mostly a matter of
>> style.
>>>
>>> Picking this up unless someone sees a problem with it.
>>>
>>> Thank you!
>>> Acked-by: Christian Brauner <[email protected]>
>>>
>>> .
>>>
>
> The patches are queued for after rc1. So around next week.
> They came too late to make it into the merge window.
>
> Christian
>
That is ok, thanks.

Regards.
Zhiqiang Liu.

> .
>

2020-04-13 05:43:37

by Christian Brauner

[permalink] [raw]
Subject: Re: [PATCH] signal: check sig before setting info in kill_pid_usb_asyncio

On Mon, Mar 30, 2020 at 10:18:33AM +0800, Zhiqiang Liu wrote:
>
> In kill_pid_usb_asyncio, if signal is not valid, we do not need to
> set info struct.
>
> Signed-off-by: Zhiqiang Liu <[email protected]>
> Acked-by: Christian Brauner <[email protected]>

Applied, thanks!
Christian