Offering: HULK hulk inclusion category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9DNKF CVE: CVE-2024-26669
--------------------------------
Fix kabi change.
Fixes: 32f2a0afa95f ("net/sched: flower: Fix chain template offload") Signed-off-by: Zhengchao Shao shaozhengchao@huawei.com --- include/net/sch_generic.h | 5 +---- net/sched/cls_api.c | 25 +++++++++++++++++++------ net/sched/cls_flower.c | 6 +++--- 3 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 13f6609644df..fad29c9961cc 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -369,10 +369,7 @@ struct tcf_proto_ops { struct nlattr **tca, struct netlink_ext_ack *extack); void (*tmplt_destroy)(void *tmplt_priv); - void (*tmplt_reoffload)(struct tcf_chain *chain, - bool add, - flow_setup_cb_t *cb, - void *cb_priv); + /* rtnetlink specific */ int (*dump)(struct net*, struct tcf_proto*, void *, struct sk_buff *skb, struct tcmsg*, diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 521fd4d6eb31..dc24b7f63ef4 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -1397,6 +1397,19 @@ void tcf_block_put(struct tcf_block *block)
EXPORT_SYMBOL(tcf_block_put);
+static void (*tmplt_reoffload)(struct tcf_chain *chain, bool add, + flow_setup_cb_t *cb, void *cb_priv); + +static void cls_tmplt_reoffload(struct tcf_chain *chain, bool add, + flow_setup_cb_t *cb, void *cb_priv) +{ + tmplt_reoffload = (void *)kallsyms_lookup_name("fl_tmplt_reoffload"); + if (!tmplt_reoffload) + return; + + tmplt_reoffload(chain, add, cb, cb_priv); +} + static int tcf_block_playback_offloads(struct tcf_block *block, flow_setup_cb_t *cb, void *cb_priv, bool add, bool offload_in_use, @@ -1414,8 +1427,9 @@ tcf_block_playback_offloads(struct tcf_block *block, flow_setup_cb_t *cb, chain = __tcf_get_next_chain(block, chain), tcf_chain_put(chain_prev)) { if (chain->tmplt_ops && add) - chain->tmplt_ops->tmplt_reoffload(chain, true, cb, - cb_priv); + if (!strcmp(chain->tmplt_ops->kind, "flower")) + cls_tmplt_reoffload(chain, true, cb, cb_priv); + for (tp = __tcf_get_next_proto(chain, NULL); tp; tp_prev = tp, tp = __tcf_get_next_proto(chain, tp), @@ -1432,8 +1446,8 @@ tcf_block_playback_offloads(struct tcf_block *block, flow_setup_cb_t *cb, } } if (chain->tmplt_ops && !add) - chain->tmplt_ops->tmplt_reoffload(chain, false, cb, - cb_priv); + if (!strcmp(chain->tmplt_ops->kind, "flower")) + cls_tmplt_reoffload(chain, false, cb, cb_priv); }
return 0; @@ -2778,8 +2792,7 @@ static int tc_chain_tmplt_add(struct tcf_chain *chain, struct net *net, ops = tcf_proto_lookup_ops(name, true, extack); if (IS_ERR(ops)) return PTR_ERR(ops); - if (!ops->tmplt_create || !ops->tmplt_destroy || !ops->tmplt_dump || - !ops->tmplt_reoffload) { + if (!ops->tmplt_create || !ops->tmplt_destroy || !ops->tmplt_dump) { NL_SET_ERR_MSG(extack, "Chain templates are not supported with specified classifier"); module_put(ops->owner); return -EOPNOTSUPP; diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 96c137d48aab..5b5c8a7fd39d 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -2406,8 +2406,8 @@ static void fl_tmplt_destroy(void *tmplt_priv) kfree(tmplt); }
-static void fl_tmplt_reoffload(struct tcf_chain *chain, bool add, - flow_setup_cb_t *cb, void *cb_priv) +void fl_tmplt_reoffload(struct tcf_chain *chain, bool add, + flow_setup_cb_t *cb, void *cb_priv) { struct fl_flow_tmplt *tmplt = chain->tmplt_priv; struct flow_cls_offload cls_flower = {}; @@ -2427,6 +2427,7 @@ static void fl_tmplt_reoffload(struct tcf_chain *chain, bool add, cb(TC_SETUP_CLSFLOWER, &cls_flower, cb_priv); kfree(cls_flower.rule); } +EXPORT_SYMBOL(fl_tmplt_reoffload);
static int fl_dump_key_val(struct sk_buff *skb, void *val, int val_type, @@ -3233,7 +3234,6 @@ static struct tcf_proto_ops cls_fl_ops __read_mostly = { .bind_class = fl_bind_class, .tmplt_create = fl_tmplt_create, .tmplt_destroy = fl_tmplt_destroy, - .tmplt_reoffload = fl_tmplt_reoffload, .tmplt_dump = fl_tmplt_dump, .owner = THIS_MODULE, .flags = TCF_PROTO_OPS_DOIT_UNLOCKED,