Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1992581ybb; Sun, 29 Mar 2020 19:20:02 -0700 (PDT) X-Google-Smtp-Source: ADFU+vugZf5OlzUp3SVc0vAKZHF/X8Q5HctXnL25JQ8kySoqBBsEAyRa7njJQDJcpPZ5ppfDvqr9 X-Received: by 2002:aca:56cd:: with SMTP id k196mr6474777oib.85.1585534802784; Sun, 29 Mar 2020 19:20:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585534802; cv=none; d=google.com; s=arc-20160816; b=k8Va6ng1PMbbuAok00zUmucgNdGJINIe8mvtJT+hmzdKts99j3Fqxmw2ouGTrcbEhh aWtwOfPd2yUsHCdJpiOT2jRTPTRjPMtkn3BycYpfPA22n3JnLbrak5PGMuhfFw6C0IOl 2NT8sCmvjPEOSeiYOXOd9xSJ3pOoDVaHKKBqGG609otV/iCG7JDcxd7d8vsQOl984StL jQS3PTiT2pW7grQ/eEtJ2Tu+urM1rteXIb4wXi/AN+3bexHxZW/fWlJrmaQApqsTEl8D gH9zhGAaStkMb83eXtKDy5bVnRi2u/yED/+oj7KZBDzLVXUop/GdMBqXgnwlcHEFQM9j nWmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:subject :from:cc:to; bh=aItqQ4ZyKdoHGXYoV2YVAiBEm+i+rQZPomyfAb5ob4M=; b=kbPH24Bm1nBpezzgVk4WKlBXlD6qiAkgYw3RJAqYX++OMYnM2XfIMRauptQIYkxotQ makRz+FMEJh9Qs3gG9J6649h8OFijFZFgbYl2FkLJEXFUYz0cvt9OKtYkrvi+e8XYo9H WIH4puMK2ZmXfv8UfMnW3miuwDaNQSdXQTXlZ1ycTMXFwAWOk0vyMQTv1JmFANgV6pgz 9XQBHUgHdc8K6+BYTt7oBOnHPYo/ZyAs27kRBPQTpIShP0WDYRap45gaKEjc48HWGnWe B2Z9hcDyUNDKx4pzOGZrKpAlPgNMEWo681dQpnLubtM+ri9D16XIjMms2kPgwJItd5U7 H8sA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p9si5601067oti.202.2020.03.29.19.19.50; Sun, 29 Mar 2020 19:20:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728592AbgC3CSr (ORCPT + 99 others); Sun, 29 Mar 2020 22:18:47 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:56520 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727801AbgC3CSr (ORCPT ); Sun, 29 Mar 2020 22:18:47 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 31DAE3ED48BD469060FE; Mon, 30 Mar 2020 10:18:44 +0800 (CST) Received: from [127.0.0.1] (10.173.220.183) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Mon, 30 Mar 2020 10:18:34 +0800 To: , , , , , , , "linux-kernel@vger.kernel.org" CC: Mingfangsen , Yanxiaodan , linfeilong From: Zhiqiang Liu Subject: [PATCH] signal: check sig before setting info in kill_pid_usb_asyncio Message-ID: Date: Mon, 30 Mar 2020 10:18:33 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.173.220.183] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In kill_pid_usb_asyncio, if signal is not valid, we do not need to set info struct. Signed-off-by: Zhiqiang Liu --- 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