hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/sched/cls_flow.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * net/sched/cls_flow.c Generic flow classifier
34 *
45 * Copyright (c) 2007, 2008 Patrick McHardy <kaber@trash.net>
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License
8
- * as published by the Free Software Foundation; either version 2
9
- * of the License, or (at your option) any later version.
106 */
117
128 #include <linux/kernel.h>
....@@ -229,7 +225,7 @@
229225
230226 static u32 flow_get_vlan_tag(const struct sk_buff *skb)
231227 {
232
- u16 uninitialized_var(tag);
228
+ u16 tag;
233229
234230 if (vlan_get_tag(skb, &tag) < 0)
235231 return 0;
....@@ -391,7 +387,8 @@
391387 static int flow_change(struct net *net, struct sk_buff *in_skb,
392388 struct tcf_proto *tp, unsigned long base,
393389 u32 handle, struct nlattr **tca,
394
- void **arg, bool ovr, struct netlink_ext_ack *extack)
390
+ void **arg, bool ovr, bool rtnl_held,
391
+ struct netlink_ext_ack *extack)
395392 {
396393 struct flow_head *head = rtnl_dereference(tp->root);
397394 struct flow_filter *fold, *fnew;
....@@ -407,7 +404,8 @@
407404 if (opt == NULL)
408405 return -EINVAL;
409406
410
- err = nla_parse_nested(tb, TCA_FLOW_MAX, opt, flow_policy, NULL);
407
+ err = nla_parse_nested_deprecated(tb, TCA_FLOW_MAX, opt, flow_policy,
408
+ NULL);
411409 if (err < 0)
412410 return err;
413411
....@@ -440,12 +438,12 @@
440438 if (err < 0)
441439 goto err1;
442440
443
- err = tcf_exts_init(&fnew->exts, TCA_FLOW_ACT, TCA_FLOW_POLICE);
441
+ err = tcf_exts_init(&fnew->exts, net, TCA_FLOW_ACT, TCA_FLOW_POLICE);
444442 if (err < 0)
445443 goto err2;
446444
447445 err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &fnew->exts, ovr,
448
- extack);
446
+ true, extack);
449447 if (err < 0)
450448 goto err2;
451449
....@@ -566,7 +564,7 @@
566564 }
567565
568566 static int flow_delete(struct tcf_proto *tp, void *arg, bool *last,
569
- struct netlink_ext_ack *extack)
567
+ bool rtnl_held, struct netlink_ext_ack *extack)
570568 {
571569 struct flow_head *head = rtnl_dereference(tp->root);
572570 struct flow_filter *f = arg;
....@@ -590,7 +588,8 @@
590588 return 0;
591589 }
592590
593
-static void flow_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack)
591
+static void flow_destroy(struct tcf_proto *tp, bool rtnl_held,
592
+ struct netlink_ext_ack *extack)
594593 {
595594 struct flow_head *head = rtnl_dereference(tp->root);
596595 struct flow_filter *f, *next;
....@@ -617,7 +616,7 @@
617616 }
618617
619618 static int flow_dump(struct net *net, struct tcf_proto *tp, void *fh,
620
- struct sk_buff *skb, struct tcmsg *t)
619
+ struct sk_buff *skb, struct tcmsg *t, bool rtnl_held)
621620 {
622621 struct flow_filter *f = fh;
623622 struct nlattr *nest;
....@@ -627,7 +626,7 @@
627626
628627 t->tcm_handle = f->handle;
629628
630
- nest = nla_nest_start(skb, TCA_OPTIONS);
629
+ nest = nla_nest_start_noflag(skb, TCA_OPTIONS);
631630 if (nest == NULL)
632631 goto nla_put_failure;
633632
....@@ -677,7 +676,8 @@
677676 return -1;
678677 }
679678
680
-static void flow_walk(struct tcf_proto *tp, struct tcf_walker *arg)
679
+static void flow_walk(struct tcf_proto *tp, struct tcf_walker *arg,
680
+ bool rtnl_held)
681681 {
682682 struct flow_head *head = rtnl_dereference(tp->root);
683683 struct flow_filter *f;