.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * net/sched/cls_flow.c Generic flow classifier |
---|
3 | 4 | * |
---|
4 | 5 | * 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. |
---|
10 | 6 | */ |
---|
11 | 7 | |
---|
12 | 8 | #include <linux/kernel.h> |
---|
.. | .. |
---|
229 | 225 | |
---|
230 | 226 | static u32 flow_get_vlan_tag(const struct sk_buff *skb) |
---|
231 | 227 | { |
---|
232 | | - u16 uninitialized_var(tag); |
---|
| 228 | + u16 tag; |
---|
233 | 229 | |
---|
234 | 230 | if (vlan_get_tag(skb, &tag) < 0) |
---|
235 | 231 | return 0; |
---|
.. | .. |
---|
391 | 387 | static int flow_change(struct net *net, struct sk_buff *in_skb, |
---|
392 | 388 | struct tcf_proto *tp, unsigned long base, |
---|
393 | 389 | 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) |
---|
395 | 392 | { |
---|
396 | 393 | struct flow_head *head = rtnl_dereference(tp->root); |
---|
397 | 394 | struct flow_filter *fold, *fnew; |
---|
.. | .. |
---|
407 | 404 | if (opt == NULL) |
---|
408 | 405 | return -EINVAL; |
---|
409 | 406 | |
---|
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); |
---|
411 | 409 | if (err < 0) |
---|
412 | 410 | return err; |
---|
413 | 411 | |
---|
.. | .. |
---|
440 | 438 | if (err < 0) |
---|
441 | 439 | goto err1; |
---|
442 | 440 | |
---|
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); |
---|
444 | 442 | if (err < 0) |
---|
445 | 443 | goto err2; |
---|
446 | 444 | |
---|
447 | 445 | err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &fnew->exts, ovr, |
---|
448 | | - extack); |
---|
| 446 | + true, extack); |
---|
449 | 447 | if (err < 0) |
---|
450 | 448 | goto err2; |
---|
451 | 449 | |
---|
.. | .. |
---|
566 | 564 | } |
---|
567 | 565 | |
---|
568 | 566 | 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) |
---|
570 | 568 | { |
---|
571 | 569 | struct flow_head *head = rtnl_dereference(tp->root); |
---|
572 | 570 | struct flow_filter *f = arg; |
---|
.. | .. |
---|
590 | 588 | return 0; |
---|
591 | 589 | } |
---|
592 | 590 | |
---|
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) |
---|
594 | 593 | { |
---|
595 | 594 | struct flow_head *head = rtnl_dereference(tp->root); |
---|
596 | 595 | struct flow_filter *f, *next; |
---|
.. | .. |
---|
617 | 616 | } |
---|
618 | 617 | |
---|
619 | 618 | 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) |
---|
621 | 620 | { |
---|
622 | 621 | struct flow_filter *f = fh; |
---|
623 | 622 | struct nlattr *nest; |
---|
.. | .. |
---|
627 | 626 | |
---|
628 | 627 | t->tcm_handle = f->handle; |
---|
629 | 628 | |
---|
630 | | - nest = nla_nest_start(skb, TCA_OPTIONS); |
---|
| 629 | + nest = nla_nest_start_noflag(skb, TCA_OPTIONS); |
---|
631 | 630 | if (nest == NULL) |
---|
632 | 631 | goto nla_put_failure; |
---|
633 | 632 | |
---|
.. | .. |
---|
677 | 676 | return -1; |
---|
678 | 677 | } |
---|
679 | 678 | |
---|
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) |
---|
681 | 681 | { |
---|
682 | 682 | struct flow_head *head = rtnl_dereference(tp->root); |
---|
683 | 683 | struct flow_filter *f; |
---|