hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/net/sched/cls_api.c
....@@ -41,8 +41,6 @@
4141 #include <net/tc_act/tc_gate.h>
4242 #include <net/flow_offload.h>
4343
44
-extern const struct nla_policy rtm_tca_policy[TCA_MAX + 1];
45
-
4644 /* The list of all installed classifier types */
4745 static LIST_HEAD(tcf_proto_base);
4846
....@@ -535,8 +533,8 @@
535533 {
536534 struct tcf_block *block = chain->block;
537535 const struct tcf_proto_ops *tmplt_ops;
536
+ unsigned int refcnt, non_act_refcnt;
538537 bool free_block = false;
539
- unsigned int refcnt;
540538 void *tmplt_priv;
541539
542540 mutex_lock(&block->lock);
....@@ -556,13 +554,15 @@
556554 * save these to temporary variables.
557555 */
558556 refcnt = --chain->refcnt;
557
+ non_act_refcnt = refcnt - chain->action_refcnt;
559558 tmplt_ops = chain->tmplt_ops;
560559 tmplt_priv = chain->tmplt_priv;
561560
562
- /* The last dropped non-action reference will trigger notification. */
563
- if (refcnt - chain->action_refcnt == 0 && !by_act) {
564
- tc_chain_notify_delete(tmplt_ops, tmplt_priv, chain->index,
565
- block, NULL, 0, 0, false);
561
+ if (non_act_refcnt == chain->explicitly_created && !by_act) {
562
+ if (non_act_refcnt == 0)
563
+ tc_chain_notify_delete(tmplt_ops, tmplt_priv,
564
+ chain->index, block, NULL, 0, 0,
565
+ false);
566566 /* Last reference to chain, no need to lock. */
567567 chain->flushing = false;
568568 }
....@@ -1466,6 +1466,7 @@
14661466
14671467 err_unroll:
14681468 list_for_each_entry_safe(block_cb, next, &bo->cb_list, list) {
1469
+ list_del(&block_cb->driver_list);
14691470 if (i-- > 0) {
14701471 list_del(&block_cb->list);
14711472 tcf_block_playback_offloads(block, block_cb->cb,
....@@ -2773,6 +2774,7 @@
27732774 return PTR_ERR(ops);
27742775 if (!ops->tmplt_create || !ops->tmplt_destroy || !ops->tmplt_dump) {
27752776 NL_SET_ERR_MSG(extack, "Chain templates are not supported with specified classifier");
2777
+ module_put(ops->owner);
27762778 return -EOPNOTSUPP;
27772779 }
27782780