From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_SBL,URIBL_SBL_A,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14E3EC4360C for ; Sun, 29 Sep 2019 14:02:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D811521924 for ; Sun, 29 Sep 2019 14:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569765742; bh=h7aXqYbuaeCQa/Wtp9rWH6rdp8pPeonuM38BRTgkl0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=eTtVN7rqFN7S5/tMp0GunSLRN5uhorICLimqvRpNX8lKyr206yIquh4NrXbpYFX7K 0Z0mdDkBNUEfQ9MIJU3GIhdCeRPm9kAivJOws+TYMXGgtuTP5d37ECy3a0m360AfAQ exOM/ZhWITu+TOIRDhBCAfmPNz9IuiLqf1lyAMiA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730144AbfI2OCQ (ORCPT ); Sun, 29 Sep 2019 10:02:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:44818 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730172AbfI2OCQ (ORCPT ); Sun, 29 Sep 2019 10:02:16 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 73C1A2082F; Sun, 29 Sep 2019 14:02:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569765735; bh=h7aXqYbuaeCQa/Wtp9rWH6rdp8pPeonuM38BRTgkl0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jPcGluhmxr1nldyCNHKX/CsAd5r4pd1dQycW+9W6IxprEpeQ+Po/GMouinWYj4+Cv vdvGYX/v2xHQMcjtfyuNe9R/jl9Bct7x0d1MqrssLgs1WBsRiNLqaRMMx/hEcUpmao FWD17cdmrQnZIubalRjsiKkSto0CP0mkeG4a5rTc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+21b29db13c065852f64b@syzkaller.appspotmail.com, Jamal Hadi Salim , Jiri Pirko , Cong Wang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.2 44/45] net_sched: check cops->tcf_block in tc_bind_tclass() Date: Sun, 29 Sep 2019 15:56:12 +0200 Message-Id: <20190929135034.757719891@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190929135024.387033930@linuxfoundation.org> References: <20190929135024.387033930@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Cong Wang [ Upstream commit 8b142a00edcf8422ca48b8de88d286efb500cb53 ] At least sch_red and sch_tbf don't implement ->tcf_block() while still have a non-zero tc "class". Instead of adding nop implementations to each of such qdisc's, we can just relax the check of cops->tcf_block() in tc_bind_tclass(). They don't support TC filter anyway. Reported-by: syzbot+21b29db13c065852f64b@syzkaller.appspotmail.com Cc: Jamal Hadi Salim Cc: Jiri Pirko Signed-off-by: Cong Wang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/sched/sch_api.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 04faee7ccbce6..1047825d9f48d 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -1920,6 +1920,8 @@ static void tc_bind_tclass(struct Qdisc *q, u32 portid, u32 clid, cl = cops->find(q, portid); if (!cl) return; + if (!cops->tcf_block) + return; block = cops->tcf_block(q, cl, NULL); if (!block) return; -- 2.20.1