Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C0D5C433F5 for ; Wed, 24 Nov 2021 12:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241792AbhKXMWg (ORCPT ); Wed, 24 Nov 2021 07:22:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:47096 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242478AbhKXMRN (ORCPT ); Wed, 24 Nov 2021 07:17:13 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1197F610FC; Wed, 24 Nov 2021 12:10:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1637755853; bh=oOJPV2CNc0bd5QaZ5EFIK0Cp7xJoqO2+pimK1Z2tLv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I0tfwfMzTN6KKZWvyzWXHZYCE8WFKTF7lf5JiGLBxqGZDpLZxrA/3l53kViELQWi2 W/ZgPmjNOFewNmC98k70BSqitIVrCzT5zcbi34Zof51ffdHOADOdInsixLI1AxmM3u J0QN/Ie0W3yv4C0HH9PVPaH6Sv8RqD8AJEWP5zMo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , Casey Schaufler , Sasha Levin Subject: [PATCH 4.9 082/207] smackfs: use __GFP_NOFAIL for smk_cipso_doi() Date: Wed, 24 Nov 2021 12:55:53 +0100 Message-Id: <20211124115706.557759685@linuxfoundation.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211124115703.941380739@linuxfoundation.org> References: <20211124115703.941380739@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: Tetsuo Handa [ Upstream commit f91488ee15bd3cac467e2d6a361fc2d34d1052ae ] syzbot is reporting kernel panic at smk_cipso_doi() due to memory allocation fault injection [1]. The reason for need to use panic() was not explained. But since no fix was proposed for 18 months, for now let's use __GFP_NOFAIL for utilizing syzbot resource on other bugs. Link: https://syzkaller.appspot.com/bug?extid=89731ccb6fec15ce1c22 [1] Reported-by: syzbot Signed-off-by: Tetsuo Handa Signed-off-by: Casey Schaufler Signed-off-by: Sasha Levin --- security/smack/smackfs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index e26e7fbb89657..cf1f92a04359a 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c @@ -716,9 +716,7 @@ static void smk_cipso_doi(void) printk(KERN_WARNING "%s:%d remove rc = %d\n", __func__, __LINE__, rc); - doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL); - if (doip == NULL) - panic("smack: Failed to initialize cipso DOI.\n"); + doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL | __GFP_NOFAIL); doip->map.std = NULL; doip->doi = smk_cipso_doi_value; doip->type = CIPSO_V4_MAP_PASS; -- 2.33.0