Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2836085pxv; Mon, 12 Jul 2021 03:08:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxq2Y+IByqdc473wZSb2vR7Cu6liAE9T2B6/J+VpMHbXkNp69GTVcwjMQ+28zdT6uXQB1nB X-Received: by 2002:a5d:88c6:: with SMTP id i6mr39540287iol.75.1626084511250; Mon, 12 Jul 2021 03:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626084511; cv=none; d=google.com; s=arc-20160816; b=0r6vA5DWKvxGQDuluWWHjfzLmSZp/3c7cu2i60O3LevCDRYfJp3uXRUWFzZJNkY06I IqBnR2WAGeBtzHYyD8zuhg6bDx1iY4SpXEBpTU1a8ckaWWsLeq1Hsj9m9a1UuM3lg7fZ YwNCSs/jiudBpmcXRAmWmLa5YoboM6GxnLJ0GNumAQUvkinJeOVPRTcImWeyP1jx0oXf /Mx5J/Q6W1ITyOtOcjfZ04QmTx5KuTN0+Lxobihj75n8MMJ5sgbERyTpwDBMHJPlWiYo oOubzY+w87Of0R9RShn8pGlEOcldloCdYahPHZnzXquRvoQEr4TTFDa+G1+9TBtQkn3l EPpg== 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=BhzphJCG9S418WYAtc4qkGdMvp66D8zKDpGbGjSI7FdjiH1hG/47FTq2TqQBBJF3D0 j6RnuvUkfQGFbTFBl/ArMYSW0b/8OjxZ6DzmPBZ8u1CjVbVynJcokI3N6g613O6JF2nF pg3A7ICouBoDndBHDak89nCDMvW5IvVSI1ls2rRjIx7EPac7+mZYSsUlZ5WBOmVyRgAJ IC1+5KWGN1/DuyHhCTedXQdk+ghDqOCfcrr6Mj6LCOlJ96npldrWKGNNP41phfQW3tXX 81QBKkc6G70qLMP2baz4FgE/cquSrsR73kgyzwtTRTfRjtKvcRQsJjenvjU/TjZPIh7/ svvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dehXqkpf; 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 g13si18764360ilf.35.2021.07.12.03.08.19; Mon, 12 Jul 2021 03:08:31 -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=dehXqkpf; 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 S1347647AbhGLHxn (ORCPT + 99 others); Mon, 12 Jul 2021 03:53:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:58152 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343967AbhGLHUO (ORCPT ); Mon, 12 Jul 2021 03:20:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9F20261166; Mon, 12 Jul 2021 07:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626074246; bh=Q24hn74DSG3DcYlvrFfEOEIsZ208c90wgAIS+AXHEcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dehXqkpfER3ywkRLYJlvtxPSojZmRXpp/Fr+4mWNocH5FqESBMQ8fX3E1PEcTeFnv O9ibsGRA5jxseT9JYEoVnY+dAdcN2mmeKKyG7sQ0jIc4PWd/R785Gx0xhMXr5sTiI+ xlT0b5/XmCJEkN+QCFw8KHR2kyaDeYifGma3laOc= 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.12 514/700] net: sched: fix warning in tcindex_alloc_perfect_hash Date: Mon, 12 Jul 2021 08:09:57 +0200 Message-Id: <20210712061031.219924821@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060924.797321836@linuxfoundation.org> References: <20210712060924.797321836@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