1. 26 10月, 2022 1 次提交
  2. 25 10月, 2022 2 次提交
  3. 24 10月, 2022 4 次提交
  4. 22 10月, 2022 6 次提交
  5. 21 10月, 2022 7 次提交
  6. 20 10月, 2022 2 次提交
  7. 19 10月, 2022 3 次提交
  8. 17 10月, 2022 4 次提交
  9. 15 10月, 2022 3 次提交
  10. 14 10月, 2022 3 次提交
    • J
      i40e: Fix DMA mappings leak · aae425ef
      Jan Sokolowski 提交于
      During reallocation of RX buffers, new DMA mappings are created for
      those buffers.
      
      steps for reproduction:
      while :
      do
      for ((i=0; i<=8160; i=i+32))
      do
      ethtool -G enp130s0f0 rx $i tx $i
      sleep 0.5
      ethtool -g enp130s0f0
      done
      done
      
      This resulted in crash:
      i40e 0000:01:00.1: Unable to allocate memory for the Rx descriptor ring, size=65536
      Driver BUG
      WARNING: CPU: 0 PID: 4300 at net/core/xdp.c:141 xdp_rxq_info_unreg+0x43/0x50
      Call Trace:
      i40e_free_rx_resources+0x70/0x80 [i40e]
      i40e_set_ringparam+0x27c/0x800 [i40e]
      ethnl_set_rings+0x1b2/0x290
      genl_family_rcv_msg_doit.isra.15+0x10f/0x150
      genl_family_rcv_msg+0xb3/0x160
      ? rings_fill_reply+0x1a0/0x1a0
      genl_rcv_msg+0x47/0x90
      ? genl_family_rcv_msg+0x160/0x160
      netlink_rcv_skb+0x4c/0x120
      genl_rcv+0x24/0x40
      netlink_unicast+0x196/0x230
      netlink_sendmsg+0x204/0x3d0
      sock_sendmsg+0x4c/0x50
      __sys_sendto+0xee/0x160
      ? handle_mm_fault+0xbe/0x1e0
      ? syscall_trace_enter+0x1d3/0x2c0
      __x64_sys_sendto+0x24/0x30
      do_syscall_64+0x5b/0x1a0
      entry_SYSCALL_64_after_hwframe+0x65/0xca
      RIP: 0033:0x7f5eac8b035b
      Missing register, driver bug
      WARNING: CPU: 0 PID: 4300 at net/core/xdp.c:119 xdp_rxq_info_unreg_mem_model+0x69/0x140
      Call Trace:
      xdp_rxq_info_unreg+0x1e/0x50
      i40e_free_rx_resources+0x70/0x80 [i40e]
      i40e_set_ringparam+0x27c/0x800 [i40e]
      ethnl_set_rings+0x1b2/0x290
      genl_family_rcv_msg_doit.isra.15+0x10f/0x150
      genl_family_rcv_msg+0xb3/0x160
      ? rings_fill_reply+0x1a0/0x1a0
      genl_rcv_msg+0x47/0x90
      ? genl_family_rcv_msg+0x160/0x160
      netlink_rcv_skb+0x4c/0x120
      genl_rcv+0x24/0x40
      netlink_unicast+0x196/0x230
      netlink_sendmsg+0x204/0x3d0
      sock_sendmsg+0x4c/0x50
      __sys_sendto+0xee/0x160
      ? handle_mm_fault+0xbe/0x1e0
      ? syscall_trace_enter+0x1d3/0x2c0
      __x64_sys_sendto+0x24/0x30
      do_syscall_64+0x5b/0x1a0
      entry_SYSCALL_64_after_hwframe+0x65/0xca
      RIP: 0033:0x7f5eac8b035b
      
      This was caused because of new buffers with different RX ring count should
      substitute older ones, but those buffers were freed in
      i40e_configure_rx_ring and reallocated again with i40e_alloc_rx_bi,
      thus kfree on rx_bi caused leak of already mapped DMA.
      
      Fix this by reallocating ZC with rx_bi_zc struct when BPF program loads. Additionally
      reallocate back to rx_bi when BPF program unloads.
      
      If BPF program is loaded/unloaded and XSK pools are created, reallocate
      RX queues accordingly in XSP_SETUP_XSK_POOL handler.
      
      Fixes: be1222b5 ("i40e: Separate kernel allocated rx_bi rings from AF_XDP rings")
      Signed-off-by: NJan Sokolowski <jan.sokolowski@intel.com>
      Signed-off-by: NMateusz Palczewski <mateusz.palczewski@intel.com>
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Chandan <chandanx.rout@intel.com> (A Contingent Worker at Intel)
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      aae425ef
    • D
      sunhme: fix an IS_ERR() vs NULL check in probe · 99df45c9
      Dan Carpenter 提交于
      The devm_request_region() function does not return error pointers, it
      returns NULL on error.
      
      Fixes: 914d9b27 ("sunhme: switch to devres")
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: NSean Anderson <seanga2@gmail.com>
      Reviewed-by: NRolf Eike Beer <eike-kernel@sf-tec.de>
      Link: https://lore.kernel.org/r/Y0bWzJL8JknX8MUf@kiliSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      99df45c9
    • D
      net: marvell: prestera: fix a couple NULL vs IS_ERR() checks · 30e9672a
      Dan Carpenter 提交于
      The __prestera_nexthop_group_create() function returns NULL on error
      and the prestera_nexthop_group_get() returns error pointers.  Fix these
      two checks.
      
      Fixes: 0a23ae23 ("net: marvell: prestera: Add router nexthops ABI")
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Link: https://lore.kernel.org/r/Y0bWq+7DoKK465z8@kiliSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      30e9672a
  11. 12 10月, 2022 5 次提交
    • L
      net/mlx5: Make ASO poll CQ usable in atomic context · 739cfa34
      Leon Romanovsky 提交于
      Poll CQ functions shouldn't sleep as they are called in atomic context.
      The following splat appears once the mlx5_aso_poll_cq() is used in such
      flow.
      
       BUG: scheduling while atomic: swapper/17/0/0x00000100
       Modules linked in: sch_ingress openvswitch nsh mlx5_vdpa vringh vhost_iotlb vdpa mlx5_ib mlx5_core xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xt_addrtype iptable_nat nf_nat br_netfilter overlay rpcrdma rdma_ucm ib_iser libiscsi scsi_transport_iscsi ib_umad rdma_cm ib_ipoib iw_cm ib_cm ib_uverbs ib_core fuse [last unloaded: mlx5_core]
       CPU: 17 PID: 0 Comm: swapper/17 Tainted: G        W          6.0.0-rc2+ #13
       Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
       Call Trace:
        <IRQ>
        dump_stack_lvl+0x34/0x44
        __schedule_bug.cold+0x47/0x53
        __schedule+0x4b6/0x670
        ? hrtimer_start_range_ns+0x28d/0x360
        schedule+0x50/0x90
        schedule_hrtimeout_range_clock+0x98/0x120
        ? __hrtimer_init+0xb0/0xb0
        usleep_range_state+0x60/0x90
        mlx5_aso_poll_cq+0xad/0x190 [mlx5_core]
        mlx5e_ipsec_aso_update_curlft+0x81/0xb0 [mlx5_core]
        xfrm_timer_handler+0x6b/0x360
        ? xfrm_find_acq_byseq+0x50/0x50
        __hrtimer_run_queues+0x139/0x290
        hrtimer_run_softirq+0x7d/0xe0
        __do_softirq+0xc7/0x272
        irq_exit_rcu+0x87/0xb0
        sysvec_apic_timer_interrupt+0x72/0x90
        </IRQ>
        <TASK>
        asm_sysvec_apic_timer_interrupt+0x16/0x20
       RIP: 0010:default_idle+0x18/0x20
       Code: ae 7d ff ff cc cc cc cc cc cc cc cc cc cc cc cc cc cc 0f 1f 44 00 00 8b 05 b5 30 0d 01 85 c0 7e 07 0f 00 2d 0a e3 53 00 fb f4 <c3> 0f 1f 80 00 00 00 00 0f 1f 44 00 00 65 48 8b 04 25 80 ad 01 00
       RSP: 0018:ffff888100883ee0 EFLAGS: 00000242
       RAX: 0000000000000001 RBX: ffff888100849580 RCX: 4000000000000000
       RDX: 0000000000000001 RSI: 0000000000000083 RDI: 000000000008863c
       RBP: 0000000000000011 R08: 00000064e6977fa9 R09: 0000000000000001
       R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
       R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
        default_idle_call+0x37/0xb0
        do_idle+0x1cd/0x1e0
        cpu_startup_entry+0x19/0x20
        start_secondary+0xfe/0x120
        secondary_startup_64_no_verify+0xcd/0xdb
        </TASK>
       softirq: huh, entered softirq 8 HRTIMER 00000000a97c08cb with preempt_count 00000100, exited with 00000000?
      Signed-off-by: NLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      739cfa34
    • M
      net: ethernet: ti: am65-cpsw: set correct devlink flavour for unused ports · 7e777b1b
      Matthias Schiffer 提交于
      am65_cpsw_nuss_register_ndevs() skips calling devlink_port_type_eth_set()
      for ports without assigned netdev, triggering the following warning when
      DEVLINK_PORT_TYPE_WARN_TIMEOUT elapses after 3600s:
      
          Type was not set for devlink port.
          WARNING: CPU: 0 PID: 129 at net/core/devlink.c:8095 devlink_port_type_warn+0x18/0x30
      
      Fixes: 0680e20a ("net: ethernet: ti: am65-cpsw: Fix devlink port register sequence")
      Signed-off-by: NMatthias Schiffer <matthias.schiffer@ew.tq-group.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7e777b1b
    • J
      treewide: use get_random_bytes() when possible · 197173db
      Jason A. Donenfeld 提交于
      The prandom_bytes() function has been a deprecated inline wrapper around
      get_random_bytes() for several releases now, and compiles down to the
      exact same code. Replace the deprecated wrapper with a direct call to
      the real function. This was done as a basic find and replace.
      Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Reviewed-by: NYury Norov <yury.norov@gmail.com>
      Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu> # powerpc
      Acked-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NJason A. Donenfeld <Jason@zx2c4.com>
      197173db
    • J
      treewide: use get_random_u32() when possible · a251c17a
      Jason A. Donenfeld 提交于
      The prandom_u32() function has been a deprecated inline wrapper around
      get_random_u32() for several releases now, and compiles down to the
      exact same code. Replace the deprecated wrapper with a direct call to
      the real function. The same also applies to get_random_int(), which is
      just a wrapper around get_random_u32(). This was done as a basic find
      and replace.
      Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Reviewed-by: NYury Norov <yury.norov@gmail.com>
      Reviewed-by: Jan Kara <jack@suse.cz> # for ext4
      Acked-by: Toke Høiland-Jørgensen <toke@toke.dk> # for sch_cake
      Acked-by: Chuck Lever <chuck.lever@oracle.com> # for nfsd
      Acked-by: NJakub Kicinski <kuba@kernel.org>
      Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> # for thunderbolt
      Acked-by: Darrick J. Wong <djwong@kernel.org> # for xfs
      Acked-by: Helge Deller <deller@gmx.de> # for parisc
      Acked-by: Heiko Carstens <hca@linux.ibm.com> # for s390
      Signed-off-by: NJason A. Donenfeld <Jason@zx2c4.com>
      a251c17a
    • J
      treewide: use get_random_{u8,u16}() when possible, part 1 · 7e3cf084
      Jason A. Donenfeld 提交于
      Rather than truncate a 32-bit value to a 16-bit value or an 8-bit value,
      simply use the get_random_{u8,u16}() functions, which are faster than
      wasting the additional bytes from a 32-bit value. This was done
      mechanically with this coccinelle script:
      
      @@
      expression E;
      identifier get_random_u32 =~ "get_random_int|prandom_u32|get_random_u32";
      typedef u16;
      typedef __be16;
      typedef __le16;
      typedef u8;
      @@
      (
      - (get_random_u32() & 0xffff)
      + get_random_u16()
      |
      - (get_random_u32() & 0xff)
      + get_random_u8()
      |
      - (get_random_u32() % 65536)
      + get_random_u16()
      |
      - (get_random_u32() % 256)
      + get_random_u8()
      |
      - (get_random_u32() >> 16)
      + get_random_u16()
      |
      - (get_random_u32() >> 24)
      + get_random_u8()
      |
      - (u16)get_random_u32()
      + get_random_u16()
      |
      - (u8)get_random_u32()
      + get_random_u8()
      |
      - (__be16)get_random_u32()
      + (__be16)get_random_u16()
      |
      - (__le16)get_random_u32()
      + (__le16)get_random_u16()
      |
      - prandom_u32_max(65536)
      + get_random_u16()
      |
      - prandom_u32_max(256)
      + get_random_u8()
      |
      - E->inet_id = get_random_u32()
      + E->inet_id = get_random_u16()
      )
      
      @@
      identifier get_random_u32 =~ "get_random_int|prandom_u32|get_random_u32";
      typedef u16;
      identifier v;
      @@
      - u16 v = get_random_u32();
      + u16 v = get_random_u16();
      
      @@
      identifier get_random_u32 =~ "get_random_int|prandom_u32|get_random_u32";
      typedef u8;
      identifier v;
      @@
      - u8 v = get_random_u32();
      + u8 v = get_random_u8();
      
      @@
      identifier get_random_u32 =~ "get_random_int|prandom_u32|get_random_u32";
      typedef u16;
      u16 v;
      @@
      -  v = get_random_u32();
      +  v = get_random_u16();
      
      @@
      identifier get_random_u32 =~ "get_random_int|prandom_u32|get_random_u32";
      typedef u8;
      u8 v;
      @@
      -  v = get_random_u32();
      +  v = get_random_u8();
      
      // Find a potential literal
      @literal_mask@
      expression LITERAL;
      type T;
      identifier get_random_u32 =~ "get_random_int|prandom_u32|get_random_u32";
      position p;
      @@
      
              ((T)get_random_u32()@p & (LITERAL))
      
      // Examine limits
      @script:python add_one@
      literal << literal_mask.LITERAL;
      RESULT;
      @@
      
      value = None
      if literal.startswith('0x'):
              value = int(literal, 16)
      elif literal[0] in '123456789':
              value = int(literal, 10)
      if value is None:
              print("I don't know how to handle %s" % (literal))
              cocci.include_match(False)
      elif value < 256:
              coccinelle.RESULT = cocci.make_ident("get_random_u8")
      elif value < 65536:
              coccinelle.RESULT = cocci.make_ident("get_random_u16")
      else:
              print("Skipping large mask of %s" % (literal))
              cocci.include_match(False)
      
      // Replace the literal mask with the calculated result.
      @plus_one@
      expression literal_mask.LITERAL;
      position literal_mask.p;
      identifier add_one.RESULT;
      identifier FUNC;
      @@
      
      -       (FUNC()@p & (LITERAL))
      +       (RESULT() & LITERAL)
      Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Reviewed-by: NYury Norov <yury.norov@gmail.com>
      Acked-by: NJakub Kicinski <kuba@kernel.org>
      Acked-by: Toke Høiland-Jørgensen <toke@toke.dk> # for sch_cake
      Signed-off-by: NJason A. Donenfeld <Jason@zx2c4.com>
      7e3cf084