Skip to contentSkip to conversation

signal: check sig before setting info in kill_pid_usb_asyncio

PATCH Applied Zhiqiang Liu 2 participants 6 messages Mar 30, 2020 – Apr 12, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 kernel/signal.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/signal.c +3 -3
index 9ad8dea93dbb..9cdc9e388a19 100644
@@ -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) {
Signature · 1 line
2.19.1
#2 lore raw

Friendly ping...

Quoted 21 lines · Christian Brauner
Quoted 5 lines · Zhiqiang Liu

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

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!

.

#3 lore raw
Quoted 10 lines · Zhiqiang Liu

Friendly ping...

Quoted 7 lines · Christian Brauner
Quoted 5 lines · Zhiqiang Liu

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

Quoted 15 lines
Quoted 6 lines

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.

Quoted 8 lines

Picking this up unless someone sees a problem with it.

Thank you!

.

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

Christian

#4 lore raw
Quoted 24 lines · Christian Brauner
Quoted 23 lines · Zhiqiang Liu

Friendly ping...

Quoted 5 lines · Christian Brauner
Quoted 4 lines · Zhiqiang Liu

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

Quoted 8 lines
Quoted 1 line

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.

Quoted 6 lines

Picking this up unless someone sees a problem with it.

Thank you!

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

.

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.

Quoted 2 lines

.