Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2830375pxv; Mon, 12 Jul 2021 03:01:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWGTYCV6SnOLlHozXtf6/x/ZbjP+tQBnIUSHzLLXBL8/Xalz/bIdObHaQDhgMeOtYyz1gR X-Received: by 2002:a02:c7cc:: with SMTP id s12mr10420839jao.37.1626084060771; Mon, 12 Jul 2021 03:01:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626084060; cv=none; d=google.com; s=arc-20160816; b=a1EVSzEEy6zQzcrbd5DpVDH9zeAKmMZxpyRSVLUtWgynIx6WN3y7em7vumq0dp3EB/ nGkIHV48VlFEjTENMequCSs5F5xXzyi1oTiuRXbJMlxnJ6DBFrjRtvtJxF+zNk+vN1QX nHKLtrGd386iG7wd50yVOI89fFdyMXPjoEQTq891aXPRkpZzNAH7bsT/OtnzcZPFqOCs Lcy3OEyeCfq7yWGVYecHkKGfvDVIyS+7wj8qcfijd2TjaURpX9byIwyW2N5k6kxZs3TZ 20cZnhqhmSj2di9CC/SDjd6AMN9+C/V3Az9v6C7iT5OLtKDyOYfL/VwDLBSqXPmub1mg httQ== 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=nAG6BGYj525o/ol6YL0ntDIup2k+8qmMcDTHZqNrV40=; b=PHky2/z3ENRmUVMoC72p3i/UBTcBkjKMvgxtDtYgCD1UYUdaxQacutN/Q0y+aKPMlr FtD+7C2b0y1ieB941uZG0+JeyJyE/w5mjb5v6mfTgJK90Dq+cJwjB8HuYOijlXc0NuA7 vslB9hXMQP0YVCKay7vs3MkqxyLqjrqu5VIqqq1heop/XOo756kR5sp21UxknBYwmoY+ hgiIlstSa7CawUIfJKrdbHmpga7xu/qvxIc1ekLa7ZDB3MduDNm4AQnrqW5nalenZjOV grSNjo4EfVeQNCCPLoE0HXCvpTddipQ3jsDXnLItiMAHJydvmb2Y/Ii5Bk0esgW4oVN2 2DNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZHFIZ7nG; 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 v14si17025218iom.9.2021.07.12.03.00.46; Mon, 12 Jul 2021 03:01:00 -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=ZHFIZ7nG; 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 S245091AbhGLHLZ (ORCPT + 99 others); Mon, 12 Jul 2021 03:11:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:46964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239134AbhGLGta (ORCPT ); Mon, 12 Jul 2021 02:49:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0C14860FE3; Mon, 12 Jul 2021 06:46:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626072397; bh=Q24hn74DSG3DcYlvrFfEOEIsZ208c90wgAIS+AXHEcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZHFIZ7nGzCpXkv0Vsya7gbVSDq2mr6v9zdXpOAIVkTXYX+YgQma9idU5s3tHk5pgF cqy4SDTDHvuu0FCwcN8Dn9tkNKKpRtmTIWVG3Kzs6tdM1Ske4z0ef8lFlEWFQb5bH4 YtFjIuBO0DYIYdwZkJR2d8cX9hcBoIgOtJAQLEXw= 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 5.10 428/593] net: sched: fix warning in tcindex_alloc_perfect_hash Date: Mon, 12 Jul 2021 08:09:48 +0200 Message-Id: <20210712060935.530971253@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060843.180606720@linuxfoundation.org> References: <20210712060843.180606720@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 c4007b9cd16d..5b274534264c 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c @@ -304,7 +304,7 @@ static int tcindex_alloc_perfect_hash(struct net *net, 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