Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp760123pxb; Tue, 5 Apr 2022 22:07:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxruK9t1YGtXxi8QGZF9j10JL/ueRspJ8Z8dlc6IJXzHYpR7OxevQz/4S9irHmR8czCv8VC X-Received: by 2002:a65:6a13:0:b0:373:14f6:5d33 with SMTP id m19-20020a656a13000000b0037314f65d33mr5907670pgu.62.1649221653208; Tue, 05 Apr 2022 22:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649221653; cv=none; d=google.com; s=arc-20160816; b=TvfBvvQycuOJgVcaX+C+UXud2chjb6oc306C8U5h/ZLk+X/ICSnGE4o6TpP12zAgaM hs63vlm8AlIm+QgzXlsUwuiD2VnK3F0qneWTvXIZGjj17hphuLjtjJ4Ljf212YNRk73C Xe5DboBhcJV+9sCLigDjTi/AYbE1zzxmbTK7N0rTRaCTNjL54bHSwVExL1GRKO8z/wT7 h2/wDzKsc/culotjC9iUJAwneRg0Adorp913F2oAsKNMcIbpYP3WzpTIWKXCW4y/U8HV EcSkfUnl32A0cQlNqjGHGNoW95DOvaDvitaeMTrE40lAveJgBVwKJPpi0Snz+W1qiMU5 ZC6g== 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=ReghzeNtKx1REpo/g1TlKFxYOMx898yiiqgvjDOw3otHvUXsvwU+D2qXeFD/rg4wzb tP9zAN+WQDV6wH24ZGaX0LxR2KBQcjpFtZ3qIOrz3F/ZHIhOyl5YsitqNGvYFUPkc3Jv ZIwrIFrteX6JCUgSLczzA6hjHpy4O+tEYwysFLmum7vBkej/FjKKUTL72pP/v5pjTPDE voek6ceJEjAlCa6LV8I9T+3JhTAufuTuJJo4UwqNNoFEBkXSrIg3iksBNFhyG/19HXmS ZS2HFJ2GRNf3GhRPf560wTvKd2+mNvQpxJKDKVkDp5m3QjyKj/AuANSHOYx6t8xsUd5s QuPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bRlS+EwL; 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 om7-20020a17090b3a8700b001bd14e030c7si4223399pjb.159.2022.04.05.22.07.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 22:07:33 -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=bRlS+EwL; 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 713AE154726; Tue, 5 Apr 2022 20:31:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242625AbiDEOwh (ORCPT + 99 others); Tue, 5 Apr 2022 10:52:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244547AbiDEJl2 (ORCPT ); Tue, 5 Apr 2022 05:41:28 -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 0FBEEBBE05; Tue, 5 Apr 2022 02:26:59 -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 B3C5FB81CAC; Tue, 5 Apr 2022 09:26:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26EA4C385A2; Tue, 5 Apr 2022 09:26:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649150816; bh=FD6A8Q2VodmlK/aTr23PGmh0+5iHx7dgmOFrv2Xh6ew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bRlS+EwLOoDQ6eBs0EgvjjUfRKFVeQy7kRPxYX76eGHe+fWC8P3Ux/IaozxpGzzyj OzYjqrWPeJ/KlB7tVTHEJTEYspxuWAifjLpmXuaJ2P9EOshEA9S40HDCAU/NzBl9KX vKZpurK3cT2POuC1FH/EmGmc8n8aO3fEhnu+h10U= 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.15 191/913] selinux: check return value of sel_make_avc_files Date: Tue, 5 Apr 2022 09:20:53 +0200 Message-Id: <20220405070345.582805648@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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