1. 31 May, 2022 7 commits
  2. 29 May, 2022 3 commits
    • David S. Miller's avatar
      Merge branch 'sfc-fixes' · 90343f57
      David S. Miller authored
      Íñigo Huguet says:
      
      ====================
      sfc: fix some efx_separate_tx_channels errors
      
      Trying to load sfc driver with modparam efx_separate_tx_channels=1
      resulted in errors during initialization and not being able to use the
      NIC. This patches fix a few bugs and make it work again.
      
      v2:
      * added Martin's patch instead of a previous mine. Mine one solved some
      of the initialization errors, but Martin's solves them also in all
      possible cases.
      * removed whitespaces cleanup, as requested by Jakub
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      90343f57
    • Íñigo Huguet's avatar
      sfc: fix wrong tx channel offset with efx_separate_tx_channels · c308dfd1
      Íñigo Huguet authored
      tx_channel_offset is calculated in efx_allocate_msix_channels, but it is
      also calculated again in efx_set_channels because it was originally done
      there, and when efx_allocate_msix_channels was introduced it was
      forgotten to be removed from efx_set_channels.
      
      Moreover, the old calculation is wrong when using
      efx_separate_tx_channels because now we can have XDP channels after the
      TX channels, so n_channels - n_tx_channels doesn't point to the first TX
      channel.
      
      Remove the old calculation from efx_set_channels, and add the
      initialization of this variable if MSI or legacy interrupts are used,
      next to the initialization of the rest of the related variables, where
      it was missing.
      
      Fixes: 3990a8ff ("sfc: allocate channels for XDP tx queues")
      Reported-by: default avatarTianhao Zhao <tizhao@redhat.com>
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c308dfd1
    • Martin Habets's avatar
      sfc: fix considering that all channels have TX queues · 2e102b53
      Martin Habets authored
      Normally, all channels have RX and TX queues, but this is not true if
      modparam efx_separate_tx_channels=1 is used. In that cases, some
      channels only have RX queues and others only TX queues (or more
      preciselly, they have them allocated, but not initialized).
      
      Fix efx_channel_has_tx_queues to return the correct value for this case
      too.
      
      Messages shown at probe time before the fix:
       sfc 0000:03:00.0 ens6f0np0: MC command 0x82 inlen 544 failed rc=-22 (raw=0) arg=0
       ------------[ cut here ]------------
       netdevice: ens6f0np0: failed to initialise TXQ -1
       WARNING: CPU: 1 PID: 626 at drivers/net/ethernet/sfc/ef10.c:2393 efx_ef10_tx_init+0x201/0x300 [sfc]
       [...] stripped
       RIP: 0010:efx_ef10_tx_init+0x201/0x300 [sfc]
       [...] stripped
       Call Trace:
        efx_init_tx_queue+0xaa/0xf0 [sfc]
        efx_start_channels+0x49/0x120 [sfc]
        efx_start_all+0x1f8/0x430 [sfc]
        efx_net_open+0x5a/0xe0 [sfc]
        __dev_open+0xd0/0x190
        __dev_change_flags+0x1b3/0x220
        dev_change_flags+0x21/0x60
       [...] stripped
      
      Messages shown at remove time before the fix:
       sfc 0000:03:00.0 ens6f0np0: failed to flush 10 queues
       sfc 0000:03:00.0 ens6f0np0: failed to flush queues
      
      Fixes: 8700aff0 ("sfc: fix channel allocation with brute force")
      Reported-by: default avatarTianhao Zhao <tizhao@redhat.com>
      Signed-off-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Tested-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2e102b53
  3. 28 May, 2022 13 commits
  4. 27 May, 2022 15 commits
  5. 26 May, 2022 2 commits
    • Phil Sutter's avatar
      netfilter: nft_limit: Clone packet limits' cost value · 558254b0
      Phil Sutter authored
      When cloning a packet-based limit expression, copy the cost value as
      well. Otherwise the new limit is not functional anymore.
      
      Fixes: 3b9e2ea6 ("netfilter: nft_limit: move stateful fields out of expression data")
      Signed-off-by: default avatarPhil Sutter <phil@nwl.cc>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      558254b0
    • Pablo Neira Ayuso's avatar
      netfilter: nf_tables: disallow non-stateful expression in sets earlier · 52077804
      Pablo Neira Ayuso authored
      Since 3e135cd4 ("netfilter: nft_dynset: dynamic stateful expression
      instantiation"), it is possible to attach stateful expressions to set
      elements.
      
      cd5125d8 ("netfilter: nf_tables: split set destruction in deactivate
      and destroy phase") introduces conditional destruction on the object to
      accomodate transaction semantics.
      
      nft_expr_init() calls expr->ops->init() first, then check for
      NFT_STATEFUL_EXPR, this stills allows to initialize a non-stateful
      lookup expressions which points to a set, which might lead to UAF since
      the set is not properly detached from the set->binding for this case.
      Anyway, this combination is non-sense from nf_tables perspective.
      
      This patch fixes this problem by checking for NFT_STATEFUL_EXPR before
      expr->ops->init() is called.
      
      The reporter provides a KASAN splat and a poc reproducer (similar to
      those autogenerated by syzbot to report use-after-free errors). It is
      unknown to me if they are using syzbot or if they use similar automated
      tool to locate the bug that they are reporting.
      
      For the record, this is the KASAN splat.
      
      [   85.431824] ==================================================================
      [   85.432901] BUG: KASAN: use-after-free in nf_tables_bind_set+0x81b/0xa20
      [   85.433825] Write of size 8 at addr ffff8880286f0e98 by task poc/776
      [   85.434756]
      [   85.434999] CPU: 1 PID: 776 Comm: poc Tainted: G        W         5.18.0+ #2
      [   85.436023] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
      
      Fixes: 0b2d8a7b ("netfilter: nf_tables: add helper functions for expression handling")
      Reported-and-tested-by: default avatarAaron Adams <edg-e@nccgroup.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      52077804