All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhiqiang Liu <liuzhiqiang26@huawei.com>
To: <ebiederm@xmission.com>, <christian.brauner@ubuntu.com>,
	<oleg@redhat.com>, <tj@kernel.org>, <guro@fb.com>,
	<joel@joelfernandes.org>, <jannh@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Mingfangsen <mingfangsen@huawei.com>,
	Yanxiaodan <yanxiaodan@huawei.com>,
	linfeilong <linfeilong@huawei.com>
Subject: [PATCH] signal: check sig before setting info in kill_pid_usb_asyncio
Date: Mon, 30 Mar 2020 10:18:33 +0800	[thread overview]
Message-ID: <f525fd08-1cf7-fb09-d20c-4359145eb940@huawei.com> (raw)


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

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
---
 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


             reply	other threads:[~2020-03-30  2:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30  2:18 Zhiqiang Liu [this message]
2020-03-30  8:44 ` [PATCH] signal: check sig before setting info in kill_pid_usb_asyncio Christian Brauner
2020-04-09  3:26   ` Zhiqiang Liu
2020-04-09  6:53     ` Christian Brauner
2020-04-09  8:41       ` Zhiqiang Liu
2020-04-12 20:59 ` Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f525fd08-1cf7-fb09-d20c-4359145eb940@huawei.com \
    --to=liuzhiqiang26@huawei.com \
    --cc=christian.brauner@ubuntu.com \
    --cc=ebiederm@xmission.com \
    --cc=guro@fb.com \
    --cc=jannh@google.com \
    --cc=joel@joelfernandes.org \
    --cc=linfeilong@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingfangsen@huawei.com \
    --cc=oleg@redhat.com \
    --cc=tj@kernel.org \
    --cc=yanxiaodan@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.