Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp343651pxb; Thu, 12 Nov 2020 05:26:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJyKqWMhLZBJlw6sMIKN44kB1G9BpsLKs6hyOYI5zZN1zDZdBLBbwOeIZv4HLu80tz8vsJhF X-Received: by 2002:a05:6402:141:: with SMTP id s1mr4956662edu.87.1605187614430; Thu, 12 Nov 2020 05:26:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605187614; cv=none; d=google.com; s=arc-20160816; b=AfWo3dD+BU10R1yfm9+e/mNu4MZyUxU9zZJJr2BNDvzTQQbCysQ2nraW73CH+VeTxW 0A51yPjF8tdm9eQiDfrGgnXPrUJaCp/lIhECvMNM9ML4PUPZXjIG3HV8pyP5z8u189HY M7NG5JPaYqsEJ2C0qIrPq1kPvIk9VopcDEj7GyYtcKE6EykA5mV/Hp5R/yQeES7Loc5n IvL8XQEDo6tHatxpyp5WGWX9nwfFOdp9ykN8MMbCcEmhY9S5mWsJsHeJmaYgeYrvgUyU EHlofDgVUn5LoxAHwN1JvXe/UzPKLh6LEfGF13GVRxX1u3XmiDk7SzVyJTcCfS0qJDMi kSkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=3VGBzUhCoJBTCdXdAe2DOtpkVpkEtM8TDBey2QwiDNA=; b=g/ZO5YO5e7IuRYuYHNhHTwO0UjyAFxG0pO6dBnt7W2skxzyzpuH29Q3GVEfJU092tI bHjTU0+4+C/UHf60F5G0oYQUSfrfk+ye65ubAem0D7FD/58U/NzV+LpVY0nONPALXgZd gtTPX3pp54B7X3UDFrMo79C5dUHHmqQeqCHk42mxombqs0xno+9XcS3glhd5PF/E/H2o yLbKgd5TCh13k89p3vTAtN8SHQWLEh5bJpQe5WlqP6RLcGO5b3DWrKpz+sg6AM3DFh22 y8+d39hgKtR+CgNNpPWehgc43lALwlyxXRIl9Zj6DU4H88qAAFMK+RwmvcvP/MlZVyUN pHYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o16si3893311edi.462.2020.11.12.05.26.31; Thu, 12 Nov 2020 05:26:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728298AbgKLNXz (ORCPT + 99 others); Thu, 12 Nov 2020 08:23:55 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:7888 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728179AbgKLNXy (ORCPT ); Thu, 12 Nov 2020 08:23:54 -0500 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4CX2Nv0LsNz75wx; Thu, 12 Nov 2020 21:23:43 +0800 (CST) Received: from [10.174.176.61] (10.174.176.61) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.487.0; Thu, 12 Nov 2020 21:23:44 +0800 Subject: Re: [PATCH] selinux: Fix error return code in sel_ib_pkey_sid_slow() To: , , , , References: <20201112085542.182692-1-chenzhou10@huawei.com> CC: , , Hulk Robot From: chenzhou Message-ID: <263b9cb9-7d16-91d7-a8ed-02b199f8b105@huawei.com> Date: Thu, 12 Nov 2020 21:23:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20201112085542.182692-1-chenzhou10@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.176.61] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/11/12 16:55, Chen Zhou wrote: > Fix to return a negative error code from the error handling case > instead of 0 in function sel_ib_pkey_sid_slow(), as done elsewhere > in this function. > > Fixes: 409dcf31538a ("selinux: Add a cache for quicker retreival of PKey SIDs") > Reported-by: Hulk Robot > Signed-off-by: Chen Zhou > --- > security/selinux/ibpkey.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/security/selinux/ibpkey.c b/security/selinux/ibpkey.c > index f68a7617cfb9..680b2dd1520f 100644 > --- a/security/selinux/ibpkey.c > +++ b/security/selinux/ibpkey.c > @@ -151,8 +151,10 @@ static int sel_ib_pkey_sid_slow(u64 subnet_prefix, u16 pkey_num, u32 *sid) > * is valid, it just won't be added to the cache. > */ > new = kzalloc(sizeof(*new), GFP_ATOMIC); > - if (!new) > + if (IS_ERR(new)) { > + ret = PTR_ERR(new); > goto out; > + } > > new->psec.subnet_prefix = subnet_prefix; > new->psec.pkey = pkey_num; Ignore this, will send v2.