Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp715547pxb; Tue, 5 Apr 2022 20:02:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx57cv3X71ZmFV11r0zsR3zyCZH7B2xcehR7luVTpzaFIu+UJvqWqhCxnc8gCg9XX5fY4nO X-Received: by 2002:a62:18cf:0:b0:4fa:6d07:8b9b with SMTP id 198-20020a6218cf000000b004fa6d078b9bmr6623310pfy.61.1649214154435; Tue, 05 Apr 2022 20:02:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649214154; cv=none; d=google.com; s=arc-20160816; b=TGpBZqI4LQNZJBWkqwFdDL+Nrg6eRrXFC6RJrBISaPK8icOejEWs5ZDXfxgOCsyhgr 3++5wA/NyjYHEkMsO4DlLRiABTnEkyl7pZbYJMutKLShlncxEgINJVpYhNCRPl6ErjPj vJEdZon822D8nGPURfnY9TyFiYzGbRnneKGTt3QyRHS2kFjBSWGGUrydWCvCPc25TJoq V7NE26+ktqztxeLy5jY2pq5BYhIjhH96kDeoF2J86Gnjg5iNairaD1+ARizfE8PuLWHO H1GiXvI6KmB+GGU/KFuiHfjOCzB97IePpnfFNnRxKtD0eHh8N6DJ1rXC8gXCT9ggQsvE ZlgA== 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=qOpFWr0pIeL+BOJV8cJ4Cs3p+oK4IvK6VziYmLbmCMEp44DUOOM5OzgpT9IIFJb9nS FU6B+DLM28R6NO+WNPd73CuDnnf2EnGsQoQWEOhcYMn4hojXocdymbKdWoKolRls58Cw 6D6WVdrb195vuupXt9+itV+GA9Rnqu0X4XdTSPbpwUKGqoULekbsGkekQNgaMplYVdD2 vkrW8nN7LC3/p4B2xatThra8aKgxfHM0S2y/jV/BMg5gd/x2pCmXZ8lymCB90g3l3JMw 48ZmcyZWIPqI6oYmcqeAgo+xpUQZKGJjyld90sv2E4sC/a+RpDk0TW06bYc6f55wsayD XXew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VszKd8la; 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 c9-20020a633509000000b003820b61cad9si1327927pga.520.2022.04.05.20.02.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 20:02:34 -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=VszKd8la; 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 C1066117CBB; Tue, 5 Apr 2022 19:47:20 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231737AbiDEICh (ORCPT + 99 others); Tue, 5 Apr 2022 04:02:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232771AbiDEHvl (ORCPT ); Tue, 5 Apr 2022 03:51:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 487944C422; Tue, 5 Apr 2022 00:47:51 -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 ams.source.kernel.org (Postfix) with ESMTPS id F2831B81B92; Tue, 5 Apr 2022 07:47:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DC72C340EE; Tue, 5 Apr 2022 07:47:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649144868; bh=FD6A8Q2VodmlK/aTr23PGmh0+5iHx7dgmOFrv2Xh6ew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VszKd8laoEkkxzEynK9e6KjAbODnhjou/jmuR66jNouKn6FnYFIz9nN76sZimduAF vPfBTNJjESOkPS/bl0ZeR+4TgSvjnUaah5dF7Cua+LrdTaL4MCPiPT7v064PBDmVfe lb2rulWiBmfJTJ6dKin7aVyWExBRkEAVdMlNE6sU= 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.17 0200/1126] selinux: check return value of sel_make_avc_files Date: Tue, 5 Apr 2022 09:15:47 +0200 Message-Id: <20220405070413.477480169@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@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