Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp5815pxb; Mon, 13 Sep 2021 11:27:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9eztHjJ9Id4n2oXM4L9wrUepkYildITG12iusdZoPD7k78BJq9h5Alow9Vzy1rVlSXENW X-Received: by 2002:a6b:f007:: with SMTP id w7mr10296679ioc.112.1631557642725; Mon, 13 Sep 2021 11:27:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631557642; cv=none; d=google.com; s=arc-20160816; b=Nfwl7BaQ139L4m+iAwpuqcnXEzi3aldHH1wv4uAJSMf9GGN1pPCGckmrAHgtBh5Tcf AKT1shuuao5bq8yelmXK0Ert7V0q8bHTYiAB2XAmzp4DJ8Crio1N88qmKrsNWlUJzh5A oz/mku4HdQvbiLd1ekVuOc8KfnHfd6Gvsx80BoM7/kkl1Ufh9ImPyXs9Zf94RYJbAax4 IyzusQOCLEBbCyXt3kb2ctpu7LmFLQKwz/2iQ1MgoaRrw8+i9tvKScXhQw4u1GuAFILn veja6ao8mFxFYp8oypXVkMa8PXs2yR49M07VZT6Qphk7YAoHSkeeUus8ukvm0M3TircB qxLg== 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=xGMSrbEWcieYqnCbKid1DLz+fj8Rl65LEebgAEjpfbw=; b=bDFH0uqSf7CMGIUtgGc8JP/bKifwAaM/OhjiyhjgYtgfyuvjUoZg1oEYcO1GLxVbtv Jw5Y5jo+B06RzKMnLvrDGUdIybv2xF2bFZjFFSQxa1OxJzkGjqKi9LpTAtU9Rrc/Kmx5 TlXz3eUgRB5gI28JKK5gpjhsNqUBd017oFDa1kuUn4h/7HjmKSlTvPW3a8WLgfeJj8rv xjKF6o3bfgdgSxNirjF2H5IsN829987pK00RKgRyT1JQ16kp69e5ocY2ZGtif9P6w0Ug 5JNtb5mSB1vmv6TB+v6zHBnF53l1fzPoDuSMGIdT7UaYJTdGcCvhCBMVMHFPzJ9kYcLJ IC1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oU1DvDLa; 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=pass (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 l8si7049892ioj.7.2021.09.13.11.27.09; Mon, 13 Sep 2021 11:27:22 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=oU1DvDLa; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241018AbhIMNWe (ORCPT + 99 others); Mon, 13 Sep 2021 09:22:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:34856 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240574AbhIMNVB (ORCPT ); Mon, 13 Sep 2021 09:21:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E708F6112E; Mon, 13 Sep 2021 13:19:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539178; bh=p3JbWlnTi+ORko7oA/8YpW7jesu/8m3n+c66cEdIr60=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oU1DvDLaZ/dbxJNth9zbxVdAP6heSdYmVt89yZ00I5tZcXRr4Cm5PFu2vOx9UqLaV BRRmh+k84XmsYKynC9+lzYIuQUz+73Cp7KK/YqJmWDrh73Gzydt3TKUhx+/YGvvE0N ztOTkYP0qKf8mPpy+vr/wqCZ10OtUyJ80u138v2o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Moore , Pavel Skripkin , "David S. Miller" , Sasha Levin , syzbot+cdd51ee2e6b0b2e18c0d@syzkaller.appspotmail.com Subject: [PATCH 5.4 071/144] net: cipso: fix warnings in netlbl_cipsov4_add_std Date: Mon, 13 Sep 2021 15:14:12 +0200 Message-Id: <20210913131050.341196937@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131047.974309396@linuxfoundation.org> References: <20210913131047.974309396@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: Pavel Skripkin [ Upstream commit 8ca34a13f7f9b3fa2c464160ffe8cc1a72088204 ] Syzbot reported warning in netlbl_cipsov4_add(). The problem was in too big doi_def->map.std->lvl.local_size passed to kcalloc(). Since this value comes from userpace there is no need to warn if value is not correct. The same problem may occur with other kcalloc() calls in this function, so, I've added __GFP_NOWARN flag to all kcalloc() calls there. Reported-and-tested-by: syzbot+cdd51ee2e6b0b2e18c0d@syzkaller.appspotmail.com Fixes: 96cb8e3313c7 ("[NetLabel]: CIPSOv4 and Unlabeled packet integration") Acked-by: Paul Moore Signed-off-by: Pavel Skripkin Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/netlabel/netlabel_cipso_v4.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c index 4cb43a2c07d1..8cd3daf0e3db 100644 --- a/net/netlabel/netlabel_cipso_v4.c +++ b/net/netlabel/netlabel_cipso_v4.c @@ -187,14 +187,14 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, } doi_def->map.std->lvl.local = kcalloc(doi_def->map.std->lvl.local_size, sizeof(u32), - GFP_KERNEL); + GFP_KERNEL | __GFP_NOWARN); if (doi_def->map.std->lvl.local == NULL) { ret_val = -ENOMEM; goto add_std_failure; } doi_def->map.std->lvl.cipso = kcalloc(doi_def->map.std->lvl.cipso_size, sizeof(u32), - GFP_KERNEL); + GFP_KERNEL | __GFP_NOWARN); if (doi_def->map.std->lvl.cipso == NULL) { ret_val = -ENOMEM; goto add_std_failure; @@ -263,7 +263,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, doi_def->map.std->cat.local = kcalloc( doi_def->map.std->cat.local_size, sizeof(u32), - GFP_KERNEL); + GFP_KERNEL | __GFP_NOWARN); if (doi_def->map.std->cat.local == NULL) { ret_val = -ENOMEM; goto add_std_failure; @@ -271,7 +271,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, doi_def->map.std->cat.cipso = kcalloc( doi_def->map.std->cat.cipso_size, sizeof(u32), - GFP_KERNEL); + GFP_KERNEL | __GFP_NOWARN); if (doi_def->map.std->cat.cipso == NULL) { ret_val = -ENOMEM; goto add_std_failure; -- 2.30.2