Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3877633pxb; Tue, 17 Nov 2020 06:02:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxaqHz5HmmgO9LPozCiB6w9gPPN6RAQoc1QIzFxRRig8vQ0oJQRn/MTMMlpITkl+yUvPiyd X-Received: by 2002:aa7:db48:: with SMTP id n8mr21601346edt.123.1605621768512; Tue, 17 Nov 2020 06:02:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605621768; cv=none; d=google.com; s=arc-20160816; b=GKlIwkuxTajYsImOBHcN3vCZOKqTLriy66BSxFx5PkmmLrIXlBRlaS0BBytlo4trLB hc7yZHs0xPC49EsoHVgi1nmE4TAp6lzGQ7u3YzT2K3DcqOGylqdh1536n+Wo2LAQBAoo 5UJ7V2XBsjx7uSGZrQLIcHo8PbuuMTtlFGsIQF1qD4K/L8TxD07clTCje2ujNx0AfVUW gHti1bM391Vf4PFusaDthb31X0bBNFyh+8/B/VQuMbCTlZ1lg/uDBiGYg2xX9f2r4bK0 x1zfO9CkCHhZWDhv/nY7rT2rSBq5BBHcGW3o4UBkluop10viNc3kl6jYYlpnogZENQRk CBng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CQvV+M3I0l4Dz/2V0Qhf68mDXj3wCOs5VDZskMjkMbk=; b=z882gCBOnnceDMtkZbBcFKB7DimY53qqpE1J8MGLIiR8h/wLdOcToku1pEUeVUksVY ODMKsckbqsk2cpSvRjy3waQPOTTHUc0Xj33y9mReq1Ye+T1Jm2F1WbjLFXuCfgGhmNP7 w6/bc2YUQiTYtUZavnOiIB5lDIuP6KZJDSLEIcwy9oqWAdwLr5HmOfdX05uEno/qsO4m x6+9KsVZmEon0lcnT2D3djTMbPDwRjr/36p+XzvU8AmMjE8n4pEB91Jn5XfBCYjdQhjr xHFmQ4LiufKq54SI8kSFFqTBuFRwE0LfGCeO+KOVBtWao8TiUhiFM85vO9F1Kikfh8hv vTnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="etPmTn/H"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a3si1013980edv.447.2020.11.17.06.02.21; Tue, 17 Nov 2020 06:02:48 -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; dkim=pass header.i=@kernel.org header.s=default header.b="etPmTn/H"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730178AbgKQOAV (ORCPT + 99 others); Tue, 17 Nov 2020 09:00:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:46768 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730168AbgKQNPT (ORCPT ); Tue, 17 Nov 2020 08:15:19 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D7FE5246DD; Tue, 17 Nov 2020 13:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605618919; bh=uqGE8wpkaITO0ex9MMrcYTpJWm9L9GH831zZi00LWIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=etPmTn/HOl2ffu+mk6WoNm/doyDCdAgDohgFnU6NzFRxPEBZKTxWiqD8uk4VUNGJe AB34JHTq2enUjn0+iWP6GiYayWHyruphy+aTkWiREDR+n+COBWSJ7SBlJ2/XBTO9pW kCC+5Jzp6TUlzfBYGGRbfnZmDzZvYjNTVtOEiEmI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Chen Zhou , Paul Moore Subject: [PATCH 4.14 52/85] selinux: Fix error return code in sel_ib_pkey_sid_slow() Date: Tue, 17 Nov 2020 14:05:21 +0100 Message-Id: <20201117122113.589598006@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122111.018425544@linuxfoundation.org> References: <20201117122111.018425544@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen Zhou commit c350f8bea271782e2733419bd2ab9bf4ec2051ef upstream. 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. Cc: stable@vger.kernel.org Fixes: 409dcf31538a ("selinux: Add a cache for quicker retreival of PKey SIDs") Reported-by: Hulk Robot Signed-off-by: Chen Zhou Signed-off-by: Paul Moore Signed-off-by: Greg Kroah-Hartman --- security/selinux/ibpkey.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/security/selinux/ibpkey.c +++ b/security/selinux/ibpkey.c @@ -160,8 +160,10 @@ static int sel_ib_pkey_sid_slow(u64 subn * is valid, it just won't be added to the cache. */ new = kzalloc(sizeof(*new), GFP_ATOMIC); - if (!new) + if (!new) { + ret = -ENOMEM; goto out; + } new->psec.subnet_prefix = subnet_prefix; new->psec.pkey = pkey_num;