1. 26 Feb, 2023 9 commits
    • David S. Miller's avatar
      Merge branch 'net-sched-action-bind' · 3fa10563
      David S. Miller authored
      Pedro Tammela says:
      
      ====================
      net/sched: fix action bind logic
      
      Some actions are not handling the case where an action can be created and bound to a
      filter independently. These actions are checking for parameters only passed
      in the netlink message for create/change/replace, which then errors out
      for valid uses like:
      tc filter ... action pedit index 1
      
      In the iproute2 side, we saw a couple of actions with their parsers
      broken when passing "index 1" as the only action argument, while the kernel
      side accepted it correctly. We fixed those as well.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3fa10563
    • Pedro Tammela's avatar
      net/sched: act_sample: fix action bind logic · 4a20056a
      Pedro Tammela authored
      The TC architecture allows filters and actions to be created independently.
      In filters the user can reference action objects using:
      tc action add action sample ... index 1
      tc filter add ... action pedit index 1
      
      In the current code for act_sample this is broken as it checks netlink
      attributes for create/update before actually checking if we are binding to an
      existing action.
      
      tdc results:
      1..29
      ok 1 9784 - Add valid sample action with mandatory arguments
      ok 2 5c91 - Add valid sample action with mandatory arguments and continue control action
      ok 3 334b - Add valid sample action with mandatory arguments and drop control action
      ok 4 da69 - Add valid sample action with mandatory arguments and reclassify control action
      ok 5 13ce - Add valid sample action with mandatory arguments and pipe control action
      ok 6 1886 - Add valid sample action with mandatory arguments and jump control action
      ok 7 7571 - Add sample action with invalid rate
      ok 8 b6d4 - Add sample action with mandatory arguments and invalid control action
      ok 9 a874 - Add invalid sample action without mandatory arguments
      ok 10 ac01 - Add invalid sample action without mandatory argument rate
      ok 11 4203 - Add invalid sample action without mandatory argument group
      ok 12 14a7 - Add invalid sample action without mandatory argument group
      ok 13 8f2e - Add valid sample action with trunc argument
      ok 14 45f8 - Add sample action with maximum rate argument
      ok 15 ad0c - Add sample action with maximum trunc argument
      ok 16 83a9 - Add sample action with maximum group argument
      ok 17 ed27 - Add sample action with invalid rate argument
      ok 18 2eae - Add sample action with invalid group argument
      ok 19 6ff3 - Add sample action with invalid trunc size
      ok 20 2b2a - Add sample action with invalid index
      ok 21 dee2 - Add sample action with maximum allowed index
      ok 22 560e - Add sample action with cookie
      ok 23 704a - Replace existing sample action with new rate argument
      ok 24 60eb - Replace existing sample action with new group argument
      ok 25 2cce - Replace existing sample action with new trunc argument
      ok 26 59d1 - Replace existing sample action with new control argument
      ok 27 0a6e - Replace sample action with invalid goto chain control
      ok 28 3872 - Delete sample action with valid index
      ok 29 a394 - Delete sample action with invalid index
      
      Fixes: 5c5670fa ("net/sched: Introduce sample tc action")
      Reviewed-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Signed-off-by: default avatarPedro Tammela <pctammela@mojatatu.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4a20056a
    • Pedro Tammela's avatar
      net/sched: act_mpls: fix action bind logic · e88d78a7
      Pedro Tammela authored
      The TC architecture allows filters and actions to be created independently.
      In filters the user can reference action objects using:
      tc action add action mpls ... index 1
      tc filter add ... action mpls index 1
      
      In the current code for act_mpls this is broken as it checks netlink
      attributes for create/update before actually checking if we are binding to an
      existing action.
      
      tdc results:
      1..53
      ok 1 a933 - Add MPLS dec_ttl action with pipe opcode
      ok 2 08d1 - Add mpls dec_ttl action with pass opcode
      ok 3 d786 - Add mpls dec_ttl action with drop opcode
      ok 4 f334 - Add mpls dec_ttl action with reclassify opcode
      ok 5 29bd - Add mpls dec_ttl action with continue opcode
      ok 6 48df - Add mpls dec_ttl action with jump opcode
      ok 7 62eb - Add mpls dec_ttl action with trap opcode
      ok 8 09d2 - Add mpls dec_ttl action with opcode and cookie
      ok 9 c170 - Add mpls dec_ttl action with opcode and cookie of max length
      ok 10 9118 - Add mpls dec_ttl action with invalid opcode
      ok 11 6ce1 - Add mpls dec_ttl action with label (invalid)
      ok 12 352f - Add mpls dec_ttl action with tc (invalid)
      ok 13 fa1c - Add mpls dec_ttl action with ttl (invalid)
      ok 14 6b79 - Add mpls dec_ttl action with bos (invalid)
      ok 15 d4c4 - Add mpls pop action with ip proto
      ok 16 91fb - Add mpls pop action with ip proto and cookie
      ok 17 92fe - Add mpls pop action with mpls proto
      ok 18 7e23 - Add mpls pop action with no protocol (invalid)
      ok 19 6182 - Add mpls pop action with label (invalid)
      ok 20 6475 - Add mpls pop action with tc (invalid)
      ok 21 067b - Add mpls pop action with ttl (invalid)
      ok 22 7316 - Add mpls pop action with bos (invalid)
      ok 23 38cc - Add mpls push action with label
      ok 24 c281 - Add mpls push action with mpls_mc protocol
      ok 25 5db4 - Add mpls push action with label, tc and ttl
      ok 26 7c34 - Add mpls push action with label, tc ttl and cookie of max length
      ok 27 16eb - Add mpls push action with label and bos
      ok 28 d69d - Add mpls push action with no label (invalid)
      ok 29 e8e4 - Add mpls push action with ipv4 protocol (invalid)
      ok 30 ecd0 - Add mpls push action with out of range label (invalid)
      ok 31 d303 - Add mpls push action with out of range tc (invalid)
      ok 32 fd6e - Add mpls push action with ttl of 0 (invalid)
      ok 33 19e9 - Add mpls mod action with mpls label
      ok 34 1fde - Add mpls mod action with max mpls label
      ok 35 0c50 - Add mpls mod action with mpls label exceeding max (invalid)
      ok 36 10b6 - Add mpls mod action with mpls label of MPLS_LABEL_IMPLNULL (invalid)
      ok 37 57c9 - Add mpls mod action with mpls min tc
      ok 38 6872 - Add mpls mod action with mpls max tc
      ok 39 a70a - Add mpls mod action with mpls tc exceeding max (invalid)
      ok 40 6ed5 - Add mpls mod action with mpls ttl
      ok 41 77c1 - Add mpls mod action with mpls ttl and cookie
      ok 42 b80f - Add mpls mod action with mpls max ttl
      ok 43 8864 - Add mpls mod action with mpls min ttl
      ok 44 6c06 - Add mpls mod action with mpls ttl of 0 (invalid)
      ok 45 b5d8 - Add mpls mod action with mpls ttl exceeding max (invalid)
      ok 46 451f - Add mpls mod action with mpls max bos
      ok 47 a1ed - Add mpls mod action with mpls min bos
      ok 48 3dcf - Add mpls mod action with mpls bos exceeding max (invalid)
      ok 49 db7c - Add mpls mod action with protocol (invalid)
      ok 50 b070 - Replace existing mpls push action with new ID
      ok 51 95a9 - Replace existing mpls push action with new label, tc, ttl and cookie
      ok 52 6cce - Delete mpls pop action
      ok 53 d138 - Flush mpls actions
      
      Fixes: 2a2ea508 ("net: sched: add mpls manipulation actions to TC")
      Reviewed-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Signed-off-by: default avatarPedro Tammela <pctammela@mojatatu.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e88d78a7
    • Pedro Tammela's avatar
      net/sched: act_pedit: fix action bind logic · e9e42292
      Pedro Tammela authored
      The TC architecture allows filters and actions to be created independently.
      In filters the user can reference action objects using:
      tc action add action pedit ... index 1
      tc filter add ... action pedit index 1
      
      In the current code for act_pedit this is broken as it checks netlink
      attributes for create/update before actually checking if we are binding to an
      existing action.
      
      tdc results:
      1..69
      ok 1 319a - Add pedit action that mangles IP TTL
      ok 2 7e67 - Replace pedit action with invalid goto chain
      ok 3 377e - Add pedit action with RAW_OP offset u32
      ok 4 a0ca - Add pedit action with RAW_OP offset u32 (INVALID)
      ok 5 dd8a - Add pedit action with RAW_OP offset u16 u16
      ok 6 53db - Add pedit action with RAW_OP offset u16 (INVALID)
      ok 7 5c7e - Add pedit action with RAW_OP offset u8 add value
      ok 8 2893 - Add pedit action with RAW_OP offset u8 quad
      ok 9 3a07 - Add pedit action with RAW_OP offset u8-u16-u8
      ok 10 ab0f - Add pedit action with RAW_OP offset u16-u8-u8
      ok 11 9d12 - Add pedit action with RAW_OP offset u32 set u16 clear u8 invert
      ok 12 ebfa - Add pedit action with RAW_OP offset overflow u32 (INVALID)
      ok 13 f512 - Add pedit action with RAW_OP offset u16 at offmask shift set
      ok 14 c2cb - Add pedit action with RAW_OP offset u32 retain value
      ok 15 1762 - Add pedit action with RAW_OP offset u8 clear value
      ok 16 bcee - Add pedit action with RAW_OP offset u8 retain value
      ok 17 e89f - Add pedit action with RAW_OP offset u16 retain value
      ok 18 c282 - Add pedit action with RAW_OP offset u32 clear value
      ok 19 c422 - Add pedit action with RAW_OP offset u16 invert value
      ok 20 d3d3 - Add pedit action with RAW_OP offset u32 invert value
      ok 21 57e5 - Add pedit action with RAW_OP offset u8 preserve value
      ok 22 99e0 - Add pedit action with RAW_OP offset u16 preserve value
      ok 23 1892 - Add pedit action with RAW_OP offset u32 preserve value
      ok 24 4b60 - Add pedit action with RAW_OP negative offset u16/u32 set value
      ok 25 a5a7 - Add pedit action with LAYERED_OP eth set src
      ok 26 86d4 - Add pedit action with LAYERED_OP eth set src & dst
      ok 27 f8a9 - Add pedit action with LAYERED_OP eth set dst
      ok 28 c715 - Add pedit action with LAYERED_OP eth set src (INVALID)
      ok 29 8131 - Add pedit action with LAYERED_OP eth set dst (INVALID)
      ok 30 ba22 - Add pedit action with LAYERED_OP eth type set/clear sequence
      ok 31 dec4 - Add pedit action with LAYERED_OP eth set type (INVALID)
      ok 32 ab06 - Add pedit action with LAYERED_OP eth add type
      ok 33 918d - Add pedit action with LAYERED_OP eth invert src
      ok 34 a8d4 - Add pedit action with LAYERED_OP eth invert dst
      ok 35 ee13 - Add pedit action with LAYERED_OP eth invert type
      ok 36 7588 - Add pedit action with LAYERED_OP ip set src
      ok 37 0fa7 - Add pedit action with LAYERED_OP ip set dst
      ok 38 5810 - Add pedit action with LAYERED_OP ip set src & dst
      ok 39 1092 - Add pedit action with LAYERED_OP ip set ihl & dsfield
      ok 40 02d8 - Add pedit action with LAYERED_OP ip set ttl & protocol
      ok 41 3e2d - Add pedit action with LAYERED_OP ip set ttl (INVALID)
      ok 42 31ae - Add pedit action with LAYERED_OP ip ttl clear/set
      ok 43 486f - Add pedit action with LAYERED_OP ip set duplicate fields
      ok 44 e790 - Add pedit action with LAYERED_OP ip set ce, df, mf, firstfrag, nofrag fields
      ok 45 cc8a - Add pedit action with LAYERED_OP ip set tos
      ok 46 7a17 - Add pedit action with LAYERED_OP ip set precedence
      ok 47 c3b6 - Add pedit action with LAYERED_OP ip add tos
      ok 48 43d3 - Add pedit action with LAYERED_OP ip add precedence
      ok 49 438e - Add pedit action with LAYERED_OP ip clear tos
      ok 50 6b1b - Add pedit action with LAYERED_OP ip clear precedence
      ok 51 824a - Add pedit action with LAYERED_OP ip invert tos
      ok 52 106f - Add pedit action with LAYERED_OP ip invert precedence
      ok 53 6829 - Add pedit action with LAYERED_OP beyond ip set dport & sport
      ok 54 afd8 - Add pedit action with LAYERED_OP beyond ip set icmp_type & icmp_code
      ok 55 3143 - Add pedit action with LAYERED_OP beyond ip set dport (INVALID)
      ok 56 815c - Add pedit action with LAYERED_OP ip6 set src
      ok 57 4dae - Add pedit action with LAYERED_OP ip6 set dst
      ok 58 fc1f - Add pedit action with LAYERED_OP ip6 set src & dst
      ok 59 6d34 - Add pedit action with LAYERED_OP ip6 dst retain value (INVALID)
      ok 60 94bb - Add pedit action with LAYERED_OP ip6 traffic_class
      ok 61 6f5e - Add pedit action with LAYERED_OP ip6 flow_lbl
      ok 62 6795 - Add pedit action with LAYERED_OP ip6 set payload_len, nexthdr, hoplimit
      ok 63 1442 - Add pedit action with LAYERED_OP tcp set dport & sport
      ok 64 b7ac - Add pedit action with LAYERED_OP tcp sport set (INVALID)
      ok 65 cfcc - Add pedit action with LAYERED_OP tcp flags set
      ok 66 3bc4 - Add pedit action with LAYERED_OP tcp set dport, sport & flags fields
      ok 67 f1c8 - Add pedit action with LAYERED_OP udp set dport & sport
      ok 68 d784 - Add pedit action with mixed RAW/LAYERED_OP #1
      ok 69 70ca - Add pedit action with mixed RAW/LAYERED_OP #2
      
      Fixes: 71d0ed70 ("net/act_pedit: Support using offset relative to the conventional network headers")
      Fixes: f67169fe ("net/sched: act_pedit: fix WARN() in the traffic path")
      Reviewed-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Signed-off-by: default avatarPedro Tammela <pctammela@mojatatu.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e9e42292
    • Michal Schmidt's avatar
      qede: avoid uninitialized entries in coal_entry array · aaa3c08e
      Michal Schmidt authored
      Even after commit 908d4bb7 ("qede: fix interrupt coalescing
      configuration"), some entries of the coal_entry array may theoretically
      be used uninitialized:
      
       1. qede_alloc_fp_array() allocates QEDE_MAX_RSS_CNT entries for
          coal_entry. The initial allocation uses kcalloc, so everything is
          initialized.
       2. The user sets a small number of queues (ethtool -L).
          coal_entry is reallocated for the actual small number of queues.
       3. The user sets a bigger number of queues.
          coal_entry is reallocated bigger. The added entries are not
          necessarily initialized.
      
      In practice, the reallocations will actually keep using the originally
      allocated region of memory, but we should not rely on it.
      
      The reallocation is unnecessary. coal_entry can always have
      QEDE_MAX_RSS_CNT entries.
      
      Fixes: 908d4bb7 ("qede: fix interrupt coalescing configuration")
      Signed-off-by: default avatarMichal Schmidt <mschmidt@redhat.com>
      Nacked-by: default avatarManish Chopra <manishc@marvell.com>
      Acked-by: default avatarManish Chopra <manishc@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aaa3c08e
    • David S. Miller's avatar
      Merge tag 'mlx5-fixes-2023-02-24' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux · 50645610
      David S. Miller authored
      Saeed Mahemeed says:
      
      ====================
      mlx5 fixes 2023-02-24
      
      V1->V2:
       - Toss away arguably non-fixes patches
      
      This series provides bug fixes for mlx5 driver.
      Please pull and let me know if there is any problem.
      ====================
      50645610
    • Fedor Pchelkin's avatar
      nfc: fix memory leak of se_io context in nfc_genl_se_io · 25ff6f8a
      Fedor Pchelkin authored
      The callback context for sending/receiving APDUs to/from the selected
      secure element is allocated inside nfc_genl_se_io and supposed to be
      eventually freed in se_io_cb callback function. However, there are several
      error paths where the bwi_timer is not charged to call se_io_cb later, and
      the cb_context is leaked.
      
      The patch proposes to free the cb_context explicitly on those error paths.
      
      At the moment we can't simply check 'dev->ops->se_io()' return value as it
      may be negative in both cases: when the timer was charged and was not.
      
      Fixes: 5ce3f32b ("NFC: netlink: SE API implementation")
      Reported-by: syzbot+df64c0a2e8d68e78a4fa@syzkaller.appspotmail.com
      Signed-off-by: default avatarFedor Pchelkin <pchelkin@ispras.ru>
      Signed-off-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      25ff6f8a
    • Jacob Keller's avatar
      ice: remove unnecessary CONFIG_ICE_GNSS · cf871006
      Jacob Keller authored
      CONFIG_ICE_GNSS was added by commit c7ef8221 ("ice: use GNSS subsystem
      instead of TTY") as a way to allow the ice driver to optionally support
      GNSS features without forcing a dependency on CONFIG_GNSS.
      
      The original implementation of that commit at [1] used IS_REACHABLE. This
      was rejected by Olek at [2] with the suggested implementation of
      CONFIG_ICE_GNSS.
      
      Eventually after merging, Linus reported a .config which had
      CONFIG_ICE_GNSS = y when both GNSS = n and ICE = n. This confused him and
      he felt that the config option was not useful, and commented about it at
      [3].
      
      CONFIG_ICE_GNSS is defined to y whenever GNSS = ICE. This results in it
      being set in cases where both options are not enabled.
      
      The goal of CONFIG_ICE_GNSS is to ensure that the GNSS support in the ice
      driver is enabled when GNSS is enabled.
      
      The complaint from Olek about the original IS_REACHABLE was due to the
      required IS_REACHABLE checks throughout the ice driver code and the fact
      that ice_gnss.c was compiled regardless of GNSS support.
      
      This can be fixed in the Makefile by using ice-$(CONFIG_GNSS) += ice_gnss.o
      
      In this case, if GNSS = m and ICE = y, we can result in some confusing
      behavior where GNSS support is not enabled because its not built in. See
      [4].
      
      To disallow this, have CONFIG_ICE depend on GNSS || GNSS = n. This ensures
      that we cannot enable CONFIG_ICE as builtin while GNSS is a module.
      
      Drop CONFIG_ICE_GNSS, and replace the IS_ENABLED checks for it with
      checks for GNSS. Update the Makefile to add the ice_gnss.o object based on
      CONFIG_GNSS.
      
      This works to ensure that GNSS support can optionally be enabled, doesn't
      have an unnnecessary extra config option, and has Kbuild enforce the
      dependency such that you can't accidentally enable GNSS as a module and ICE
      as a builtin.
      
      [1] https://lore.kernel.org/intel-wired-lan/20221019095603.44825-1-arkadiusz.kubalewski@intel.com/
      [2] https://lore.kernel.org/intel-wired-lan/20221028165706.96849-1-alexandr.lobakin@intel.com/
      [3] https://lore.kernel.org/all/CAHk-=wi_410KZqHwF-WL5U7QYxnpHHHNP-3xL=g_y89XnKc-uw@mail.gmail.com/
      [4] https://lore.kernel.org/netdev/20230223161309.0e439c5f@kernel.org/Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Fixes: c7ef8221 ("ice: use GNSS subsystem instead of TTY")
      Cc: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
      Cc: Alexander Lobakin <alexandr.lobakin@intel.com>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Anthony Nguyen <anthony.l.nguyen@intel.com>
      Acked-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cf871006
    • Nathan Chancellor's avatar
      net/sched: cls_api: Move call to tcf_exts_miss_cookie_base_destroy() · 37e1f3ac
      Nathan Chancellor authored
      When CONFIG_NET_CLS_ACT is disabled:
      
        ../net/sched/cls_api.c:141:13: warning: 'tcf_exts_miss_cookie_base_destroy' defined but not used [-Wunused-function]
          141 | static void tcf_exts_miss_cookie_base_destroy(struct tcf_exts *exts)
              |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Due to the way the code is structured, it is possible for a definition
      of tcf_exts_miss_cookie_base_destroy() to be present without actually
      being used. Its single callsite is in an '#ifdef CONFIG_NET_CLS_ACT'
      block but a definition will always be present in the file. The version
      of tcf_exts_miss_cookie_base_destroy() that actually does something
      depends on CONFIG_NET_TC_SKB_EXT, so the stub function is used in both
      CONFIG_NET_CLS_ACT=n and CONFIG_NET_CLS_ACT=y + CONFIG_NET_TC_SKB_EXT=n
      configurations.
      
      Move the call to tcf_exts_miss_cookie_base_destroy() in
      tcf_exts_destroy() out of the '#ifdef CONFIG_NET_CLS_ACT', so that it
      always appears used to the compiler, while not changing any behavior
      with any of the various configuration combinations.
      
      Fixes: 80cd22c3 ("net/sched: cls_api: Support hardware miss to tc action")
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      37e1f3ac
  2. 25 Feb, 2023 2 commits
  3. 24 Feb, 2023 15 commits
  4. 23 Feb, 2023 13 commits
  5. 22 Feb, 2023 1 commit
    • Pavel Tikhomirov's avatar
      netfilter: x_tables: fix percpu counter block leak on error path when creating new netns · 0af8c09c
      Pavel Tikhomirov authored
      Here is the stack where we allocate percpu counter block:
      
        +-< __alloc_percpu
          +-< xt_percpu_counter_alloc
            +-< find_check_entry # {arp,ip,ip6}_tables.c
              +-< translate_table
      
      And it can be leaked on this code path:
      
        +-> ip6t_register_table
          +-> translate_table # allocates percpu counter block
          +-> xt_register_table # fails
      
      there is no freeing of the counter block on xt_register_table fail.
      Note: xt_percpu_counter_free should be called to free it like we do in
      do_replace through cleanup_entry helper (or in __ip6t_unregister_table).
      
      Probability of hitting this error path is low AFAICS (xt_register_table
      can only return ENOMEM here, as it is not replacing anything, as we are
      creating new netns, and it is hard to imagine that all previous
      allocations succeeded and after that one in xt_register_table failed).
      But it's worth fixing even the rare leak.
      
      Fixes: 71ae0dff ("netfilter: xtables: use percpu rule counters")
      Signed-off-by: default avatarPavel Tikhomirov <ptikhomirov@virtuozzo.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      0af8c09c