Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4156918pxv; Mon, 19 Jul 2021 18:44:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJTENngGn1445e6oofwOS0xesLC3v78wupkGEA3W/XaMRrJi5v93QWzLfZLM1SGdDP0JFQ X-Received: by 2002:a05:6402:605:: with SMTP id n5mr37735175edv.89.1626745490132; Mon, 19 Jul 2021 18:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626745490; cv=none; d=google.com; s=arc-20160816; b=u5iDDZE7PJW3qFdbXmjElhC5uO4jAenLkbKS9i1AbCYUO1gFXsKybW75+xi510fyka lLGaWOMnl15L3ZqZ6HBqkyRoP5/tCa9jvcThBDWa7qv7UGW8+pFuXvrmkwnlIndQ3nDR deGyZ5noogUIuMxGD4+yKLg9FNH/9dNIO4Q4YCB04egzIWbZHc8yiT6Ofb+WITmtuV8J EVM+Y2swZEnsKHnPxTDC/jcNiMJgfzp29Q0VlFAk1MoEILH96mcFz/FxBXFQ4uUT4g1v MudhuChkaeh7C6PHsMFXyIomhNZCQxERLQRXV/AdaWBqf0COeEGldzpvl1pjotE1uqSa cnMg== 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=lZ2vKqQCW+cyDyiXpWEEJHVKvHB7qkfo42oG/fD1c94=; b=NF4ZuAfUhlq89Ay/2sZd+g2AeKP0GrPWbu+ycV1vJWy/7/CC9WVjukDeUGnNSQCzqB pxLqFVLrNMayHfNVCgKjajjBF+KfLVXfjFr7bDHRis4vsqliwzVddTv6HWQSMMU8B+Fg 5fCKHycELOYzlWlaVxtVx8zcgBUZPPyk+YYzyauPRQM8uvmGmeohbqD/jfWLJlA15atA Z+SNOYuBCuMdf0SIaQlYAH/mh+uKn66daQxQxOjYWl7QiFIjbuuRr7a5UdcXT8S95gEN kzHuQHZmFq07e3RsBTWK4YVdmTtdc+ThqUhMwdVr249SoOAYo3Z/SLpFfC6bhMix43cS FREA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Gwe0qLKd; 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 nd38si23506557ejc.558.2021.07.19.18.44.27; Mon, 19 Jul 2021 18:44:50 -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=Gwe0qLKd; 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 S243950AbhGSO54 (ORCPT + 99 others); Mon, 19 Jul 2021 10:57:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:54260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343539AbhGSOja (ORCPT ); Mon, 19 Jul 2021 10:39:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D8073611CE; Mon, 19 Jul 2021 15:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626707940; bh=Xig838R7qfc3NVGddFFVfGWgtkES/pd2dEx2YcMiClA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gwe0qLKdnZWN5Bq6148fHvtja/HCU0WEUTVLUfdaGfTrxMfLBLHo6pPfD3fVX2NO4 +inbx4Xi2GiAr3U0LpzWxni37CmSk0gIc/XPFHbG2NUeTNUbV3DsVjtSCiQ15Pi7lh hQ7fI9sw8zqILHNVe0FkloMZQyEeADO+KwrXHmtQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Skripkin , Cong Wang , "David S. Miller" , Sasha Levin , syzbot+1071ad60cd7df39fdadb@syzkaller.appspotmail.com Subject: [PATCH 4.14 117/315] net: sched: fix warning in tcindex_alloc_perfect_hash Date: Mon, 19 Jul 2021 16:50:06 +0200 Message-Id: <20210719144946.719624654@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144942.861561397@linuxfoundation.org> References: <20210719144942.861561397@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 3f2db250099f46988088800052cdf2332c7aba61 ] Syzbot reported warning in tcindex_alloc_perfect_hash. The problem was in too big cp->hash, which triggers warning in kmalloc. Since cp->hash comes from userspace, there is no need to warn if value is not correct Fixes: b9a24bb76bf6 ("net_sched: properly handle failure case of tcf_exts_init()") Reported-and-tested-by: syzbot+1071ad60cd7df39fdadb@syzkaller.appspotmail.com Signed-off-by: Pavel Skripkin Acked-by: Cong Wang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/sched/cls_tcindex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index 5b119efb20ee..9314a739c170 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c @@ -297,7 +297,7 @@ static int tcindex_alloc_perfect_hash(struct tcindex_data *cp) int i, err = 0; cp->perfect = kcalloc(cp->hash, sizeof(struct tcindex_filter_result), - GFP_KERNEL); + GFP_KERNEL | __GFP_NOWARN); if (!cp->perfect) return -ENOMEM; -- 2.30.2