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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 4A3DBC388F9 for ; Tue, 27 Oct 2020 14:33:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E8DA5207BB for ; Tue, 27 Oct 2020 14:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809180; bh=PHMnfJhj2uVCqgcWdyotQLpyIPaEYsfFZEEQ+RZSnzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gSMhpei+MqkGXg5lcSXR3NF9VBCmtTp4pZlep6odVhdg7a0SDAMfLnR6p0wcOn0aG K901TGx0D/mOC+JEHCvvoMguti1Sw8m60ZwCknDOiNJrnm52lGCpIcwzkEcGC8PDf6 c3OhO1Ii0vVh/0lHDOg1VhOqsjx1grY2lG/Ee7PU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1747955AbgJ0Oc6 (ORCPT ); Tue, 27 Oct 2020 10:32:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:56910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759855AbgJ0Oa0 (ORCPT ); Tue, 27 Oct 2020 10:30:26 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 D203122202; Tue, 27 Oct 2020 14:30:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809026; bh=PHMnfJhj2uVCqgcWdyotQLpyIPaEYsfFZEEQ+RZSnzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BZCibn6z64S51fRslc1HuzDlUjq3+cDGRJb936OSw2UWK3gOG3vZw0QqBpRILu9nG uePYt/s4r5atjJ0TipsB+52O1fERSQ+Q2a2zWPpe4p2Hh8DUx0vy61QhJ5/Lu0ocXW zOt3bCjOHBiA4vEztrN7Aef4k2GTnpS/l+ce+ahw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vlad Buslov , Davide Caratti , Jamal Hadi Salim , Jiri Pirko , Cong Wang Subject: [PATCH 5.4 017/408] net_sched: remove a redundant goto chain check Date: Tue, 27 Oct 2020 14:49:15 +0100 Message-Id: <20201027135455.853428084@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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: Cong Wang [ Upstream commit 1aad8049909a6d3379175ef2824a68ac35c0b564 ] All TC actions call tcf_action_check_ctrlact() to validate goto chain, so this check in tcf_action_init_1() is actually redundant. Remove it to save troubles of leaking memory. Fixes: e49d8c22f126 ("net_sched: defer tcf_idr_insert() in tcf_action_init_1()") Reported-by: Vlad Buslov Suggested-by: Davide Caratti Cc: Jamal Hadi Salim Cc: Jiri Pirko Signed-off-by: Cong Wang Reviewed-by: Davide Caratti Signed-off-by: Greg Kroah-Hartman --- net/sched/act_api.c | 14 -------------- 1 file changed, 14 deletions(-) --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -706,13 +706,6 @@ int tcf_action_destroy(struct tc_action return ret; } -static int tcf_action_destroy_1(struct tc_action *a, int bind) -{ - struct tc_action *actions[] = { a, NULL }; - - return tcf_action_destroy(actions, bind); -} - static int tcf_action_put(struct tc_action *p) { return __tcf_action_put(p, false); @@ -932,13 +925,6 @@ struct tc_action *tcf_action_init_1(stru if (err < 0) goto err_mod; - if (TC_ACT_EXT_CMP(a->tcfa_action, TC_ACT_GOTO_CHAIN) && - !rcu_access_pointer(a->goto_chain)) { - tcf_action_destroy_1(a, bind); - NL_SET_ERR_MSG(extack, "can't use goto chain with NULL chain"); - return ERR_PTR(-EINVAL); - } - if (!name && tb[TCA_ACT_COOKIE]) tcf_set_action_cookie(&a->act_cookie, cookie);