21 Jul, 2020

1 commit

  • In case the qdisc_match_from_root function() is called from non-rcu path
    with rtnl mutex held, a suspiciout rcu usage warning appears:

    [ 241.504354] =============================
    [ 241.504358] WARNING: suspicious RCU usage
    [ 241.504366] 5.8.0-rc4-custom-01521-g72a7c7d549c3 #32 Not tainted
    [ 241.504370] -----------------------------
    [ 241.504378] net/sched/sch_api.c:270 RCU-list traversed in non-reader section!!
    [ 241.504382]
    other info that might help us debug this:
    [ 241.504388]
    rcu_scheduler_active = 2, debug_locks = 1
    [ 241.504394] 1 lock held by tc/1391:
    [ 241.504398] #0: ffffffff85a27850 (rtnl_mutex){+.+.}-{3:3}, at: rtnetlink_rcv_msg+0x49a/0xbd0
    [ 241.504431]
    stack backtrace:
    [ 241.504440] CPU: 0 PID: 1391 Comm: tc Not tainted 5.8.0-rc4-custom-01521-g72a7c7d549c3 #32
    [ 241.504446] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-2.fc32 04/01/2014
    [ 241.504453] Call Trace:
    [ 241.504465] dump_stack+0x100/0x184
    [ 241.504482] lockdep_rcu_suspicious+0x153/0x15d
    [ 241.504499] qdisc_match_from_root+0x293/0x350

    Fix this by passing the rtnl held lockdep condition down to
    hlist_for_each_entry_rcu()

    Reported-by: Ido Schimmel
    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jiri Pirko
     

21 Jun, 2020

1 commit


28 May, 2020

1 commit

  • With this tracepoint, we could know when qdisc's are created,
    especially those default qdisc's.

    Sample output:

    tc-736 [001] ...1 56.230107: qdisc_create: dev=ens3 kind=pfifo parent=1:0
    tc-736 [001] ...1 56.230113: qdisc_create: dev=ens3 kind=hfsc parent=ffff:ffff
    tc-738 [001] ...1 56.256816: qdisc_create: dev=ens3 kind=pfifo parent=1:100
    tc-739 [001] ...1 56.267584: qdisc_create: dev=ens3 kind=pfifo parent=1:200
    tc-740 [001] ...1 56.279649: qdisc_create: dev=ens3 kind=fq_codel parent=1:100
    tc-741 [001] ...1 56.289996: qdisc_create: dev=ens3 kind=pfifo_fast parent=1:200
    tc-745 [000] .N.1 111.687483: qdisc_create: dev=ens3 kind=ingress parent=ffff:fff1

    Cc: Jamal Hadi Salim
    Cc: Jiri Pirko
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     

18 Mar, 2020

2 commits

  • qdisc_watchdog_schedule_range_ns() can use the newly added slack
    and avoid rearming the hrtimer a bit earlier than the current
    value. This patch has no effect if delta_ns parameter
    is zero.

    Note that this means the max slack is potentially doubled.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     
  • Some packet schedulers might want to add a slack
    when programming hrtimers. This can reduce number
    of interrupts and increase batch sizes and thus
    give good xmit_more savings.

    This commit adds qdisc_watchdog_schedule_range_ns()
    helper, with an extra delta_ns parameter.

    Legacy qdisc_watchdog_schedule_n() becomes an inline
    passing a zero slack.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

27 Jan, 2020

2 commits

  • In a complex TC class hierarchy like this:

    tc qdisc add dev eth0 root handle 1:0 cbq bandwidth 100Mbit \
    avpkt 1000 cell 8
    tc class add dev eth0 parent 1:0 classid 1:1 cbq bandwidth 100Mbit \
    rate 6Mbit weight 0.6Mbit prio 8 allot 1514 cell 8 maxburst 20 \
    avpkt 1000 bounded

    tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip \
    sport 80 0xffff flowid 1:3
    tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip \
    sport 25 0xffff flowid 1:4

    tc class add dev eth0 parent 1:1 classid 1:3 cbq bandwidth 100Mbit \
    rate 5Mbit weight 0.5Mbit prio 5 allot 1514 cell 8 maxburst 20 \
    avpkt 1000
    tc class add dev eth0 parent 1:1 classid 1:4 cbq bandwidth 100Mbit \
    rate 3Mbit weight 0.3Mbit prio 5 allot 1514 cell 8 maxburst 20 \
    avpkt 1000

    where filters are installed on qdisc 1:0, so we can't merely
    search from class 1:1 when creating class 1:3 and class 1:4. We have
    to walk through all the child classes of the direct parent qdisc.
    Otherwise we would miss filters those need reverse binding.

    Fixes: 07d79fc7d94e ("net_sched: add reverse binding for tc class")
    Cc: Jamal Hadi Salim
    Cc: Jiri Pirko
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     
  • The current implementations of ops->bind_class() are merely
    searching for classid and updating class in the struct tcf_result,
    without invoking either of cl_ops->bind_tcf() or
    cl_ops->unbind_tcf(). This breaks the design of them as qdisc's
    like cbq use them to count filters too. This is why syzbot triggered
    the warning in cbq_destroy_class().

    In order to fix this, we have to call cl_ops->bind_tcf() and
    cl_ops->unbind_tcf() like the filter binding path. This patch does
    so by refactoring out two helper functions __tcf_bind_filter()
    and __tcf_unbind_filter(), which are lockless and accept a Qdisc
    pointer, then teaching each implementation to call them correctly.

    Note, we merely pass the Qdisc pointer as an opaque pointer to
    each filter, they only need to pass it down to the helper
    functions without understanding it at all.

    Fixes: 07d79fc7d94e ("net_sched: add reverse binding for tc class")
    Reported-and-tested-by: syzbot+0a0596220218fcb603a8@syzkaller.appspotmail.com
    Reported-and-tested-by: syzbot+63bdb6006961d8c917c6@syzkaller.appspotmail.com
    Cc: Jamal Hadi Salim
    Cc: Jiri Pirko
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     

09 Oct, 2019

1 commit

  • Marcelo noticed a backward compatibility issue of TCA_KIND
    after we move from NLA_STRING to NLA_NUL_STRING, so it is probably
    too late to change it.

    Instead, to make everyone happy, we can just insert a NUL to
    terminate the string with nla_strlcpy() like we do for TC actions.

    Fixes: 62794fc4fbf5 ("net_sched: add max len check for TCA_KIND")
    Reported-by: Marcelo Ricardo Leitner
    Cc: Jamal Hadi Salim
    Cc: Jiri Pirko
    Signed-off-by: Cong Wang
    Reviewed-by: Marcelo Ricardo Leitner
    Signed-off-by: Jakub Kicinski

    Cong Wang
     

22 Sep, 2019

1 commit

  • The TCA_KIND attribute is of NLA_STRING which does not check
    the NUL char. KMSAN reported an uninit-value of TCA_KIND which
    is likely caused by the lack of NUL.

    Change it to NLA_NUL_STRING and add a max len too.

    Fixes: 8b4c3cdd9dd8 ("net: sched: Add policy validation for tc attributes")
    Reported-and-tested-by: syzbot+618aacd49e8c8b8486bd@syzkaller.appspotmail.com
    Cc: Jamal Hadi Salim
    Signed-off-by: Cong Wang
    Reviewed-by: David Ahern
    Acked-by: Jiri Pirko
    Signed-off-by: Jakub Kicinski

    Cong Wang
     

11 Sep, 2019

1 commit

  • At least sch_red and sch_tbf don't implement ->tcf_block()
    while still have a non-zero tc "class".

    Instead of adding nop implementations to each of such qdisc's,
    we can just relax the check of cops->tcf_block() in
    tc_bind_tclass(). They don't support TC filter anyway.

    Reported-by: syzbot+21b29db13c065852f64b@syzkaller.appspotmail.com
    Cc: Jamal Hadi Salim
    Cc: Jiri Pirko
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 3029 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

28 Apr, 2019

2 commits

  • We currently have two levels of strict validation:

    1) liberal (default)
    - undefined (type >= max) & NLA_UNSPEC attributes accepted
    - attribute length >= expected accepted
    - garbage at end of message accepted
    2) strict (opt-in)
    - NLA_UNSPEC attributes accepted
    - attribute length >= expected accepted

    Split out parsing strictness into four different options:
    * TRAILING - check that there's no trailing data after parsing
    attributes (in message or nested)
    * MAXTYPE - reject attrs > max known type
    * UNSPEC - reject attributes with NLA_UNSPEC policy entries
    * STRICT_ATTRS - strictly validate attribute size

    The default for future things should be *everything*.
    The current *_strict() is a combination of TRAILING and MAXTYPE,
    and is renamed to _deprecated_strict().
    The current regular parsing has none of this, and is renamed to
    *_parse_deprecated().

    Additionally it allows us to selectively set one of the new flags
    even on old policies. Notably, the UNSPEC flag could be useful in
    this case, since it can be arranged (by filling in the policy) to
    not be an incompatible userspace ABI change, but would then going
    forward prevent forgetting attribute entries. Similar can apply
    to the POLICY flag.

    We end up with the following renames:
    * nla_parse -> nla_parse_deprecated
    * nla_parse_strict -> nla_parse_deprecated_strict
    * nlmsg_parse -> nlmsg_parse_deprecated
    * nlmsg_parse_strict -> nlmsg_parse_deprecated_strict
    * nla_parse_nested -> nla_parse_nested_deprecated
    * nla_validate_nested -> nla_validate_nested_deprecated

    Using spatch, of course:
    @@
    expression TB, MAX, HEAD, LEN, POL, EXT;
    @@
    -nla_parse(TB, MAX, HEAD, LEN, POL, EXT)
    +nla_parse_deprecated(TB, MAX, HEAD, LEN, POL, EXT)

    @@
    expression NLH, HDRLEN, TB, MAX, POL, EXT;
    @@
    -nlmsg_parse(NLH, HDRLEN, TB, MAX, POL, EXT)
    +nlmsg_parse_deprecated(NLH, HDRLEN, TB, MAX, POL, EXT)

    @@
    expression NLH, HDRLEN, TB, MAX, POL, EXT;
    @@
    -nlmsg_parse_strict(NLH, HDRLEN, TB, MAX, POL, EXT)
    +nlmsg_parse_deprecated_strict(NLH, HDRLEN, TB, MAX, POL, EXT)

    @@
    expression TB, MAX, NLA, POL, EXT;
    @@
    -nla_parse_nested(TB, MAX, NLA, POL, EXT)
    +nla_parse_nested_deprecated(TB, MAX, NLA, POL, EXT)

    @@
    expression START, MAX, POL, EXT;
    @@
    -nla_validate_nested(START, MAX, POL, EXT)
    +nla_validate_nested_deprecated(START, MAX, POL, EXT)

    @@
    expression NLH, HDRLEN, MAX, POL, EXT;
    @@
    -nlmsg_validate(NLH, HDRLEN, MAX, POL, EXT)
    +nlmsg_validate_deprecated(NLH, HDRLEN, MAX, POL, EXT)

    For this patch, don't actually add the strict, non-renamed versions
    yet so that it breaks compile if I get it wrong.

    Also, while at it, make nla_validate and nla_parse go down to a
    common __nla_validate_parse() function to avoid code duplication.

    Ultimately, this allows us to have very strict validation for every
    new caller of nla_parse()/nlmsg_parse() etc as re-introduced in the
    next patch, while existing things will continue to work as is.

    In effect then, this adds fully strict validation for any new command.

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     
  • Even if the NLA_F_NESTED flag was introduced more than 11 years ago, most
    netlink based interfaces (including recently added ones) are still not
    setting it in kernel generated messages. Without the flag, message parsers
    not aware of attribute semantics (e.g. wireshark dissector or libmnl's
    mnl_nlmsg_fprintf()) cannot recognize nested attributes and won't display
    the structure of their contents.

    Unfortunately we cannot just add the flag everywhere as there may be
    userspace applications which check nlattr::nla_type directly rather than
    through a helper masking out the flags. Therefore the patch renames
    nla_nest_start() to nla_nest_start_noflag() and introduces nla_nest_start()
    as a wrapper adding NLA_F_NESTED. The calls which add NLA_F_NESTED manually
    are rewritten to use nla_nest_start().

    Except for changes in include/net/netlink.h, the patch was generated using
    this semantic patch:

    @@ expression E1, E2; @@
    -nla_nest_start(E1, E2)
    +nla_nest_start_noflag(E1, E2)

    @@ expression E1, E2; @@
    -nla_nest_start_noflag(E1, E2 | NLA_F_NESTED)
    +nla_nest_start(E1, E2)

    Signed-off-by: Michal Kubecek
    Acked-by: Jiri Pirko
    Acked-by: David Ahern
    Signed-off-by: David S. Miller

    Michal Kubecek
     

11 Apr, 2019

1 commit

  • Since stats updating is always consistent with TCQ_F_CPUSTATS flag,
    we can disable it at qdisc creation time flipping such bit.

    In my experiments, if the NOLOCK flag is cleared, per CPU stats
    accounting does not give any measurable performance gain, but it
    waste some memory.

    Let's clear TCQ_F_CPUSTATS together with NOLOCK, when enslaving
    a NOLOCK qdisc to 'lock' one.

    Use stats update helper inside pfifo_fast, to cope correctly with
    TCQ_F_CPUSTATS flag change.

    As a side effect, q.qlen value for any child qdiscs is always
    consistent for all lock classfull qdiscs.

    Signed-off-by: Paolo Abeni
    Signed-off-by: David S. Miller

    Paolo Abeni
     

14 Mar, 2019

1 commit

  • It is confusing to directly use return value of netlink_send()/
    netlink_unicast() as the return value of *notify*, as it may be not
    error at all.

    Example: in tc_del_tfilter(), after calling tfilter_del_notify(), it will
    goto errout if (err). However, the netlink_send()/netlink_unicast() will
    return positive value even for successful case. So it may not call
    tcf_chain_tp_remove() and so on to clean up the resource, as a result,
    resource is leaked.

    It may be easier to only check the return value of tfilter_del_nofiy(),
    but it is more clean to correct all related functions.

    Co-developed-by: Zengmo Gao
    Signed-off-by: Zhike Wang
    Acked-by: Cong Wang
    Signed-off-by: David S. Miller

    Zhike Wang
     

19 Feb, 2019

1 commit


18 Feb, 2019

1 commit


13 Feb, 2019

3 commits

  • Add 'rtnl_held' flag to tcf proto change, delete, destroy, dump, walk
    functions to track rtnl lock status. Extend users of these function in cls
    API to propagate rtnl lock status to them. This allows classifiers to
    obtain rtnl lock when necessary and to pass rtnl lock status to extensions
    and driver offload callbacks.

    Add flags field to tcf proto ops. Add flag value to indicate that
    classifier doesn't require rtnl lock.

    Signed-off-by: Vlad Buslov
    Acked-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Vlad Buslov
     
  • All users of chain->filters_chain rely on rtnl lock and assume that no new
    classifier instances are added when traversing the list. Use
    tcf_get_next_proto() to traverse filters list without relying on rtnl
    mutex. This function iterates over classifiers by taking reference to
    current iterator classifier only and doesn't assume external
    synchronization of filters list.

    Signed-off-by: Vlad Buslov
    Acked-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Vlad Buslov
     
  • All users of block->chain_list rely on rtnl lock and assume that no new
    chains are added when traversing the list. Use tcf_get_next_chain() to
    traverse chain list without relying on rtnl mutex. This function iterates
    over chains by taking reference to current iterator chain only and doesn't
    assume external synchronization of chain list.

    Don't take reference to all chains in block when flushing and use
    tcf_get_next_chain() to safely iterate over chain list instead. Remove
    tcf_block_put_all_chains() that is no longer used.

    Signed-off-by: Vlad Buslov
    Acked-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Vlad Buslov
     

20 Jan, 2019

1 commit


28 Dec, 2018

1 commit

  • Pull networking updates from David Miller:

    1) New ipset extensions for matching on destination MAC addresses, from
    Stefano Brivio.

    2) Add ipv4 ttl and tos, plus ipv6 flow label and hop limit offloads to
    nfp driver. From Stefano Brivio.

    3) Implement GRO for plain UDP sockets, from Paolo Abeni.

    4) Lots of work from Michał Mirosław to eliminate the VLAN_TAG_PRESENT
    bit so that we could support the entire vlan_tci value.

    5) Rework the IPSEC policy lookups to better optimize more usecases,
    from Florian Westphal.

    6) Infrastructure changes eliminating direct manipulation of SKB lists
    wherever possible, and to always use the appropriate SKB list
    helpers. This work is still ongoing...

    7) Lots of PHY driver and state machine improvements and
    simplifications, from Heiner Kallweit.

    8) Various TSO deferral refinements, from Eric Dumazet.

    9) Add ntuple filter support to aquantia driver, from Dmitry Bogdanov.

    10) Batch dropping of XDP packets in tuntap, from Jason Wang.

    11) Lots of cleanups and improvements to the r8169 driver from Heiner
    Kallweit, including support for ->xmit_more. This driver has been
    getting some much needed love since he started working on it.

    12) Lots of new forwarding selftests from Petr Machata.

    13) Enable VXLAN learning in mlxsw driver, from Ido Schimmel.

    14) Packed ring support for virtio, from Tiwei Bie.

    15) Add new Aquantia AQtion USB driver, from Dmitry Bezrukov.

    16) Add XDP support to dpaa2-eth driver, from Ioana Ciocoi Radulescu.

    17) Implement coalescing on TCP backlog queue, from Eric Dumazet.

    18) Implement carrier change in tun driver, from Nicolas Dichtel.

    19) Support msg_zerocopy in UDP, from Willem de Bruijn.

    20) Significantly improve garbage collection of neighbor objects when
    the table has many PERMANENT entries, from David Ahern.

    21) Remove egdev usage from nfp and mlx5, and remove the facility
    completely from the tree as it no longer has any users. From Oz
    Shlomo and others.

    22) Add a NETDEV_PRE_CHANGEADDR so that drivers can veto the change and
    therefore abort the operation before the commit phase (which is the
    NETDEV_CHANGEADDR event). From Petr Machata.

    23) Add indirect call wrappers to avoid retpoline overhead, and use them
    in the GRO code paths. From Paolo Abeni.

    24) Add support for netlink FDB get operations, from Roopa Prabhu.

    25) Support bloom filter in mlxsw driver, from Nir Dotan.

    26) Add SKB extension infrastructure. This consolidates the handling of
    the auxiliary SKB data used by IPSEC and bridge netfilter, and is
    designed to support the needs to MPTCP which could be integrated in
    the future.

    27) Lots of XDP TX optimizations in mlx5 from Tariq Toukan.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1845 commits)
    net: dccp: fix kernel crash on module load
    drivers/net: appletalk/cops: remove redundant if statement and mask
    bnx2x: Fix NULL pointer dereference in bnx2x_del_all_vlans() on some hw
    net/net_namespace: Check the return value of register_pernet_subsys()
    net/netlink_compat: Fix a missing check of nla_parse_nested
    ieee802154: lowpan_header_create check must check daddr
    net/mlx4_core: drop useless LIST_HEAD
    mlxsw: spectrum: drop useless LIST_HEAD
    net/mlx5e: drop useless LIST_HEAD
    iptunnel: Set tun_flags in the iptunnel_metadata_reply from src
    net/mlx5e: fix semicolon.cocci warnings
    staging: octeon: fix build failure with XFRM enabled
    net: Revert recent Spectre-v1 patches.
    can: af_can: Fix Spectre v1 vulnerability
    packet: validate address length if non-zero
    nfc: af_nfc: Fix Spectre v1 vulnerability
    phonet: af_phonet: Fix Spectre v1 vulnerability
    net: core: Fix Spectre v1 vulnerability
    net: minor cleanup in skb_ext_add()
    net: drop the unused helper skb_ext_get()
    ...

    Linus Torvalds
     

16 Dec, 2018

1 commit


02 Dec, 2018

1 commit

  • Now that call_rcu()'s callback is not invoked until after bh-disable
    regions of code have completed (in addition to explicitly marked
    RCU read-side critical sections), call_rcu() can be used in place
    of call_rcu_bh(). Similarly, rcu_barrier() can be used in place o
    frcu_barrier_bh(). This commit therefore makes these changes.

    Signed-off-by: Paul E. McKenney
    Cc: Jamal Hadi Salim
    Cc: Cong Wang
    Cc: Jiri Pirko
    Cc: "David S. Miller"
    Cc:

    Paul E. McKenney
     

15 Nov, 2018

1 commit

  • Drivers are currently not notified when a Qdisc is grafted as root.
    This requires special casing Qdiscs added with parent = TC_H_ROOT in
    the driver. Also there is no notification sent to the driver when
    an existing Qdisc is grafted as root.

    Add this very simple notifications, drivers should now be able to
    track their Qdisc tree fully.

    Signed-off-by: Jakub Kicinski
    Reviewed-by: John Hurley
    Signed-off-by: David S. Miller

    Jakub Kicinski
     

09 Nov, 2018

3 commits


25 Oct, 2018

1 commit

  • Marco reported an error with hfsc:
    root@Calimero:~# tc qdisc add dev eth0 root handle 1:0 hfsc default 1
    Error: Attribute failed policy validation.

    Apparently a few implementations pass TCA_OPTIONS as a binary instead
    of nested attribute, so drop TCA_OPTIONS from the policy.

    Fixes: 8b4c3cdd9dd8 ("net: sched: Add policy validation for tc attributes")
    Reported-by: Marco Berizzi
    Signed-off-by: David Ahern
    Signed-off-by: David S. Miller

    David Ahern
     

20 Oct, 2018

1 commit

  • net/sched/cls_api.c has overlapping changes to a call to
    nlmsg_parse(), one (from 'net') added rtm_tca_policy instead of NULL
    to the 5th argument, and another (from 'net-next') added cb->extack
    instead of NULL to the 6th argument.

    net/ipv4/ipmr_base.c is a case of a bug fix in 'net' being done to
    code which moved (to mr_table_dump)) in 'net-next'. Thanks to David
    Ahern for the heads up.

    Signed-off-by: David S. Miller

    David S. Miller
     

19 Oct, 2018

1 commit

  • When dumping classes by parent, kernel would return classes twice:

    | # tc qdisc add dev lo root prio
    | # tc class show dev lo
    | class prio 8001:1 parent 8001:
    | class prio 8001:2 parent 8001:
    | class prio 8001:3 parent 8001:
    | # tc class show dev lo parent 8001:
    | class prio 8001:1 parent 8001:
    | class prio 8001:2 parent 8001:
    | class prio 8001:3 parent 8001:
    | class prio 8001:1 parent 8001:
    | class prio 8001:2 parent 8001:
    | class prio 8001:3 parent 8001:

    This comes from qdisc_match_from_root() potentially returning the root
    qdisc itself if its handle matched. Though in that case, root's classes
    were already dumped a few lines above.

    Fixes: cb395b2010879 ("net: sched: optimize class dumps")
    Signed-off-by: Phil Sutter
    Reviewed-by: Jiri Pirko
    Reviewed-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Phil Sutter
     

16 Oct, 2018

1 commit

  • Similarly to what has been done in 8b4c3cdd9dd8 ("net: sched: Add policy
    validation for tc attributes"), fix classifier code to add validation of
    TCA_CHAIN and TCA_KIND netlink attributes.

    tested with:
    # ./tdc.py -c filter

    v2: Let sch_api and cls_api share nla_policy they have in common, thanks
    to David Ahern.
    v3: Avoid EXPORT_SYMBOL(), as validation of those attributes is not done
    by TC modules, thanks to Cong Wang.
    While at it, restore the 'Delete / get qdisc' comment to its orginal
    position, just above tc_get_qdisc() function prototype.

    Fixes: 5bc1701881e39 ("net: sched: introduce multichain support for filters")
    Signed-off-by: Davide Caratti
    Signed-off-by: David S. Miller

    Davide Caratti
     

09 Oct, 2018

1 commit

  • Make sure extack is passed to nlmsg_parse where easy to do so.
    Most of these are dump handlers and leveraging the extack in
    the netlink_callback.

    Signed-off-by: David Ahern
    Acked-by: Christian Brauner
    Signed-off-by: David S. Miller

    David Ahern
     

07 Oct, 2018

1 commit


06 Oct, 2018

1 commit

  • A number of TC attributes are processed without proper validation
    (e.g., length checks). Add a tca policy for all input attributes and use
    when invoking nlmsg_parse.

    The 2 Fixes tags below cover the latest additions. The other attributes
    are a string (KIND), nested attribute (OPTIONS which does seem to have
    validation in most cases), for dumps only or a flag.

    Fixes: 5bc1701881e39 ("net: sched: introduce multichain support for filters")
    Fixes: d47a6b0e7c492 ("net: sched: introduce ingress/egress block index attributes for qdisc")
    Signed-off-by: David Ahern
    Signed-off-by: David S. Miller

    David Ahern
     

26 Sep, 2018

2 commits

  • Currently, Qdisc API functions assume that users have rtnl lock taken. To
    implement rtnl unlocked classifiers update interface, Qdisc API must be
    extended with functions that do not require rtnl lock.

    Extend Qdisc structure with rcu. Implement special version of put function
    qdisc_put_unlocked() that is called without rtnl lock taken. This function
    only takes rtnl lock if Qdisc reference counter reached zero and is
    intended to be used as optimization.

    Signed-off-by: Vlad Buslov
    Acked-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Vlad Buslov
     
  • Current implementation of qdisc_destroy() decrements Qdisc reference
    counter and only actually destroy Qdisc if reference counter value reached
    zero. Rename qdisc_destroy() to qdisc_put() in order for it to better
    describe the way in which this function currently implemented and used.

    Extract code that deallocates Qdisc into new private qdisc_destroy()
    function. It is intended to be shared between regular qdisc_put() and its
    unlocked version that is introduced in next patch in this series.

    Signed-off-by: Vlad Buslov
    Acked-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Vlad Buslov
     

11 Sep, 2018

1 commit


04 Jul, 2018

1 commit


16 May, 2018

1 commit