Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp627497pxb; Tue, 5 Apr 2022 16:28:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsUy/T+TUjyhL37YQ9UQJHyJIYFra1tiPj3H6x27KVong7/fsezE8qzqXPK76IrdanDVl2 X-Received: by 2002:a05:6a00:3496:b0:4fa:e48e:3d02 with SMTP id cp22-20020a056a00349600b004fae48e3d02mr6160761pfb.26.1649201291048; Tue, 05 Apr 2022 16:28:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649201291; cv=none; d=google.com; s=arc-20160816; b=AOLf4qgPaaTlvB252FqdoceucC6eVvQQKHnwku7v7gq0zbkMOjCLCZpVHKYF5oVppL mLqH4uLqViHGRut22PxaKCXosa4cF+E1YkaY3P7eFr0brJiaL56cYTilxhagxwgz7WWc djFUKBW9buNG6QTBNxLb1MiYZ9JExcSCwFPDlfHhRnC5+L/JSWnFxEwXEVso7A7aRPrG /xmGuIBOmfHcrbE6ADPdrRL38i8NJ1vnzSOgquBfrowl375ycHrpxjkiG7oIE0uLkMCe Rw75DJM1B+7JxFCdHG7ZGEtuehyBApT2AEcYZM087YWP5QNiaUVZzX8+oQAUD6ib1TyS gsvw== 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=MVqFc/kEZ7WK704q0T1T9MBwKHlBEGH05fikUPJc9Fc=; b=cSw6Zfe0DdHkJ9ky6zG+GvywEzAsYtnvoPv4/tx5LzUah42i75TEPlKo93m0wXRrp7 WzJIO7EOwj8vtwQmUeKtBfokKHqGvznqQv30evoRVme7lpplRWOkJrP5bPz4mqVK1zCb 5g3NRoTrpbJ966gKAEMhEQ65Ta7GnKeuKc3Og32x+iEiG6ebL4M9TmNtsj84IgZZ0l4B uH6YOIdMnsE12GlcaGxpcs+/iOsqqnPG0btmJapNHnPc7Q/OgsuLBipKAgFW+ixD/3Ed Zg6UnsKcCOcmByzlGsRKMOvUon0AQtGOvsL9jVCctkH6+MTnmdn6PEmnofQ4GmWzF/Bu imvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cpe8pw7Q; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id o4-20020a635a04000000b003816043f06asi15360423pgb.607.2022.04.05.16.28.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 16:28:11 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cpe8pw7Q; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0FCDDF61DC; Tue, 5 Apr 2022 16:11:49 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378050AbiDELb1 (ORCPT + 99 others); Tue, 5 Apr 2022 07:31:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244188AbiDEIvs (ORCPT ); Tue, 5 Apr 2022 04:51:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8A4AD3AD5; Tue, 5 Apr 2022 01:40:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A466E60FFC; Tue, 5 Apr 2022 08:40:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA690C385A0; Tue, 5 Apr 2022 08:40:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148011; bh=FD6A8Q2VodmlK/aTr23PGmh0+5iHx7dgmOFrv2Xh6ew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cpe8pw7QDVkL9epidr4MzQDn8oovMSNLGQbi3yKw42nkoMtpAEB2wy+Ti1UzHXcmN cs0T1e96dzy3FjI4krW2YhhT5upGMAWU5ZI/kjcUPqenYYMOm80geyR0qOYimUwRgw B7gLllbR4uyyCK/JaoGj6ZBwUXbOiXD6XtDN8ZCE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Christian=20G=C3=B6ttsche?= , Nick Desaulniers , Paul Moore , Sasha Levin Subject: [PATCH 5.16 0202/1017] selinux: check return value of sel_make_avc_files Date: Tue, 5 Apr 2022 09:18:35 +0200 Message-Id: <20220405070400.245926398@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christian Göttsche [ Upstream commit bcb62828e3e8c813b6613db6eb7fd9657db248fc ] sel_make_avc_files() might fail and return a negative errno value on memory allocation failures. Re-add the check of the return value, dropped in 66f8e2f03c02 ("selinux: sidtab reverse lookup hash table"). Reported by clang-analyzer: security/selinux/selinuxfs.c:2129:2: warning: Value stored to 'ret' is never read [deadcode.DeadStores] ret = sel_make_avc_files(dentry); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: 66f8e2f03c02 ("selinux: sidtab reverse lookup hash table") Signed-off-by: Christian Göttsche Reviewed-by: Nick Desaulniers [PM: description line wrapping, added proper commit ref] Signed-off-by: Paul Moore Signed-off-by: Sasha Levin --- security/selinux/selinuxfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index e4cd7cb856f3..f2f6203e0fff 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c @@ -2127,6 +2127,8 @@ static int sel_fill_super(struct super_block *sb, struct fs_context *fc) } ret = sel_make_avc_files(dentry); + if (ret) + goto err; dentry = sel_make_dir(sb->s_root, "ss", &fsi->last_ino); if (IS_ERR(dentry)) { -- 2.34.1