1. 24 Aug, 2022 1 commit
  2. 23 Aug, 2022 16 commits
  3. 22 Aug, 2022 7 commits
    • Maciej Fijalkowski's avatar
      ice: xsk: use Rx ring's XDP ring when picking NAPI context · 9ead7e74
      Maciej Fijalkowski authored
      Ice driver allocates per cpu XDP queues so that redirect path can safely
      use smp_processor_id() as an index to the array. At the same time
      though, XDP rings are used to pick NAPI context to call napi_schedule()
      or set NAPIF_STATE_MISSED. When user reduces queue count, say to 8, and
      num_possible_cpus() of underlying platform is 44, then this means queue
      vectors with correlated NAPI contexts will carry several XDP queues.
      
      This in turn can result in a broken behavior where NAPI context of
      interest will never be scheduled and AF_XDP socket will not process any
      traffic.
      
      To fix this, let us change the way how XDP rings are assigned to Rx
      rings and use this information later on when setting
      ice_tx_ring::xsk_pool pointer. For each Rx ring, grab the associated
      queue vector and walk through Tx ring's linked list. Once we stumble
      upon XDP ring in it, assign this ring to ice_rx_ring::xdp_ring.
      
      Previous [0] approach of fixing this issue was for txonly scenario
      because of the described grouping of XDP rings across queue vectors. So,
      relying on Rx ring meant that NAPI context could be scheduled with a
      queue vector without XDP ring with associated XSK pool.
      
      [0]: https://lore.kernel.org/netdev/20220707161128.54215-1-maciej.fijalkowski@intel.com/
      
      Fixes: 2d4238f5 ("ice: Add support for AF_XDP")
      Fixes: 22bf877e ("ice: introduce XDP_TX fallback path")
      Signed-off-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Tested-by: default avatarGeorge Kuruvinakunnel <george.kuruvinakunnel@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      9ead7e74
    • Maciej Fijalkowski's avatar
      ice: xsk: prohibit usage of non-balanced queue id · 5a42f112
      Maciej Fijalkowski authored
      Fix the following scenario:
      1. ethtool -L $IFACE rx 8 tx 96
      2. xdpsock -q 10 -t -z
      
      Above refers to a case where user would like to attach XSK socket in
      txonly mode at a queue id that does not have a corresponding Rx queue.
      At this moment ice's XSK logic is tightly bound to act on a "queue pair",
      e.g. both Tx and Rx queues at a given queue id are disabled/enabled and
      both of them will get XSK pool assigned, which is broken for the presented
      queue configuration. This results in the splat included at the bottom,
      which is basically an OOB access to Rx ring array.
      
      To fix this, allow using the ids only in scope of "combined" queues
      reported by ethtool. However, logic should be rewritten to allow such
      configurations later on, which would end up as a complete rewrite of the
      control path, so let us go with this temporary fix.
      
      [420160.558008] BUG: kernel NULL pointer dereference, address: 0000000000000082
      [420160.566359] #PF: supervisor read access in kernel mode
      [420160.572657] #PF: error_code(0x0000) - not-present page
      [420160.579002] PGD 0 P4D 0
      [420160.582756] Oops: 0000 [#1] PREEMPT SMP NOPTI
      [420160.588396] CPU: 10 PID: 21232 Comm: xdpsock Tainted: G           OE     5.19.0-rc7+ #10
      [420160.597893] Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.02.01.0008.031920191559 03/19/2019
      [420160.609894] RIP: 0010:ice_xsk_pool_setup+0x44/0x7d0 [ice]
      [420160.616968] Code: f3 48 83 ec 40 48 8b 4f 20 48 8b 3f 65 48 8b 04 25 28 00 00 00 48 89 44 24 38 31 c0 48 8d 04 ed 00 00 00 00 48 01 c1 48 8b 11 <0f> b7 92 82 00 00 00 48 85 d2 0f 84 2d 75 00 00 48 8d 72 ff 48 85
      [420160.639421] RSP: 0018:ffffc9002d2afd48 EFLAGS: 00010282
      [420160.646650] RAX: 0000000000000050 RBX: ffff88811d8bdd00 RCX: ffff888112c14ff8
      [420160.655893] RDX: 0000000000000000 RSI: ffff88811d8bdd00 RDI: ffff888109861000
      [420160.665166] RBP: 000000000000000a R08: 000000000000000a R09: 0000000000000000
      [420160.674493] R10: 000000000000889f R11: 0000000000000000 R12: 000000000000000a
      [420160.683833] R13: 000000000000000a R14: 0000000000000000 R15: ffff888117611828
      [420160.693211] FS:  00007fa869fc1f80(0000) GS:ffff8897e0880000(0000) knlGS:0000000000000000
      [420160.703645] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [420160.711783] CR2: 0000000000000082 CR3: 00000001d076c001 CR4: 00000000007706e0
      [420160.721399] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [420160.731045] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [420160.740707] PKRU: 55555554
      [420160.745960] Call Trace:
      [420160.750962]  <TASK>
      [420160.755597]  ? kmalloc_large_node+0x79/0x90
      [420160.762703]  ? __kmalloc_node+0x3f5/0x4b0
      [420160.769341]  xp_assign_dev+0xfd/0x210
      [420160.775661]  ? shmem_file_read_iter+0x29a/0x420
      [420160.782896]  xsk_bind+0x152/0x490
      [420160.788943]  __sys_bind+0xd0/0x100
      [420160.795097]  ? exit_to_user_mode_prepare+0x20/0x120
      [420160.802801]  __x64_sys_bind+0x16/0x20
      [420160.809298]  do_syscall_64+0x38/0x90
      [420160.815741]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
      [420160.823731] RIP: 0033:0x7fa86a0dd2fb
      [420160.830264] Code: c3 66 0f 1f 44 00 00 48 8b 15 69 8b 0c 00 f7 d8 64 89 02 b8 ff ff ff ff eb bc 0f 1f 44 00 00 f3 0f 1e fa b8 31 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 3d 8b 0c 00 f7 d8 64 89 01 48
      [420160.855410] RSP: 002b:00007ffc1146f618 EFLAGS: 00000246 ORIG_RAX: 0000000000000031
      [420160.866366] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fa86a0dd2fb
      [420160.876957] RDX: 0000000000000010 RSI: 00007ffc1146f680 RDI: 0000000000000003
      [420160.887604] RBP: 000055d7113a0520 R08: 00007fa868fb8000 R09: 0000000080000000
      [420160.898293] R10: 0000000000008001 R11: 0000000000000246 R12: 000055d7113a04e0
      [420160.909038] R13: 000055d7113a0320 R14: 000000000000000a R15: 0000000000000000
      [420160.919817]  </TASK>
      [420160.925659] Modules linked in: ice(OE) af_packet binfmt_misc nls_iso8859_1 ipmi_ssif intel_rapl_msr intel_rapl_common x86_pkg_temp_thermal intel_powerclamp mei_me coretemp ioatdma mei ipmi_si wmi ipmi_msghandler acpi_pad acpi_power_meter ip_tables x_tables autofs4 ixgbe i40e crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel crypto_simd cryptd ahci mdio dca libahci lpc_ich [last unloaded: ice]
      [420160.977576] CR2: 0000000000000082
      [420160.985037] ---[ end trace 0000000000000000 ]---
      [420161.097724] RIP: 0010:ice_xsk_pool_setup+0x44/0x7d0 [ice]
      [420161.107341] Code: f3 48 83 ec 40 48 8b 4f 20 48 8b 3f 65 48 8b 04 25 28 00 00 00 48 89 44 24 38 31 c0 48 8d 04 ed 00 00 00 00 48 01 c1 48 8b 11 <0f> b7 92 82 00 00 00 48 85 d2 0f 84 2d 75 00 00 48 8d 72 ff 48 85
      [420161.134741] RSP: 0018:ffffc9002d2afd48 EFLAGS: 00010282
      [420161.144274] RAX: 0000000000000050 RBX: ffff88811d8bdd00 RCX: ffff888112c14ff8
      [420161.155690] RDX: 0000000000000000 RSI: ffff88811d8bdd00 RDI: ffff888109861000
      [420161.168088] RBP: 000000000000000a R08: 000000000000000a R09: 0000000000000000
      [420161.179295] R10: 000000000000889f R11: 0000000000000000 R12: 000000000000000a
      [420161.190420] R13: 000000000000000a R14: 0000000000000000 R15: ffff888117611828
      [420161.201505] FS:  00007fa869fc1f80(0000) GS:ffff8897e0880000(0000) knlGS:0000000000000000
      [420161.213628] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [420161.223413] CR2: 0000000000000082 CR3: 00000001d076c001 CR4: 00000000007706e0
      [420161.234653] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [420161.245893] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [420161.257052] PKRU: 55555554
      
      Fixes: 2d4238f5 ("ice: Add support for AF_XDP")
      Signed-off-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Tested-by: default avatarGeorge Kuruvinakunnel <george.kuruvinakunnel@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      5a42f112
    • Duoming Zhou's avatar
      nfc: pn533: Fix use-after-free bugs caused by pn532_cmd_timeout · f1e941db
      Duoming Zhou authored
      When the pn532 uart device is detaching, the pn532_uart_remove()
      is called. But there are no functions in pn532_uart_remove() that
      could delete the cmd_timeout timer, which will cause use-after-free
      bugs. The process is shown below:
      
          (thread 1)                  |        (thread 2)
                                      |  pn532_uart_send_frame
      pn532_uart_remove               |    mod_timer(&pn532->cmd_timeout,...)
        ...                           |    (wait a time)
        kfree(pn532) //FREE           |    pn532_cmd_timeout
                                      |      pn532_uart_send_frame
                                      |        pn532->... //USE
      
      This patch adds del_timer_sync() in pn532_uart_remove() in order to
      prevent the use-after-free bugs. What's more, the pn53x_unregister_nfc()
      is well synchronized, it sets nfc_dev->shutting_down to true and there
      are no syscalls could restart the cmd_timeout timer.
      
      Fixes: c656aa4c ("nfc: pn533: add UART phy driver")
      Signed-off-by: default avatarDuoming Zhou <duoming@zju.edu.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f1e941db
    • David S. Miller's avatar
      Merge branch 'r8152-fixes' · 6e10001c
      David S. Miller authored
      Hayes Wang says:
      
      ====================
      r8152: fix flow control settings
      
      These patches fix the settings of RX FIFO about flow control.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6e10001c
    • Hayes Wang's avatar
      r8152: fix the RX FIFO settings when suspending · b75d6120
      Hayes Wang authored
      The RX FIFO would be changed when suspending, so the related settings
      have to be modified, too. Otherwise, the flow control would work
      abnormally.
      
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=216333Reported-by: default avatarMark Blakeney <mark.blakeney@bullet-systems.net>
      Fixes: cdf0b86b ("r8152: fix a WOL issue")
      Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b75d6120
    • Hayes Wang's avatar
      r8152: fix the units of some registers for RTL8156A · 6dc4df12
      Hayes Wang authored
      The units of PLA_RX_FIFO_FULL and PLA_RX_FIFO_EMPTY are 16 bytes.
      
      Fixes: 195aae32 ("r8152: support new chips")
      Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6dc4df12
    • Bernard Pidoux's avatar
      rose: check NULL rose_loopback_neigh->loopback · 3c53cd65
      Bernard Pidoux authored
      Commit 3b3fd068 added NULL check for
      `rose_loopback_neigh->dev` in rose_loopback_timer() but omitted to
      check rose_loopback_neigh->loopback.
      
      It thus prevents *all* rose connect.
      
      The reason is that a special rose_neigh loopback has a NULL device.
      
      /proc/net/rose_neigh illustrates it via rose_neigh_show() function :
      [...]
      seq_printf(seq, "%05d %-9s %-4s   %3d %3d  %3s     %3s %3lu %3lu",
      	   rose_neigh->number,
      	   (rose_neigh->loopback) ? "RSLOOP-0" : ax2asc(buf, &rose_neigh->callsign),
      	   rose_neigh->dev ? rose_neigh->dev->name : "???",
      	   rose_neigh->count,
      
      /proc/net/rose_neigh displays special rose_loopback_neigh->loopback as
      callsign RSLOOP-0:
      
      addr  callsign  dev  count use mode restart  t0  tf digipeaters
      00001 RSLOOP-0  ???      1   2  DCE     yes   0   0
      
      By checking rose_loopback_neigh->loopback, rose_rx_call_request() is called
      even in case rose_loopback_neigh->dev is NULL. This repairs rose connections.
      
      Verification with rose client application FPAC:
      
      FPAC-Node v 4.1.3 (built Aug  5 2022) for LINUX (help = h)
      F6BVP-4 (Commands = ?) : u
      Users - AX.25 Level 2 sessions :
      Port   Callsign     Callsign  AX.25 state  ROSE state  NetRom status
      axudp  F6BVP-5   -> F6BVP-9   Connected    Connected   ---------
      
      Fixes: 3b3fd068 ("rose: Fix Null pointer dereference in rose_send_frame()")
      Signed-off-by: default avatarBernard Pidoux <f6bvp@free.fr>
      Suggested-by: default avatarFrancois Romieu <romieu@fr.zoreil.com>
      Cc: Thomas DL9SAU Osterried <thomas@osterried.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3c53cd65
  4. 19 Aug, 2022 5 commits
    • Sabrina Dubroca's avatar
      Revert "net: macsec: update SCI upon MAC address change." · e82c649e
      Sabrina Dubroca authored
      This reverts commit 6fc498bc.
      
      Commit 6fc498bc states:
      
          SCI should be updated, because it contains MAC in its first 6
          octets.
      
      That's not entirely correct. The SCI can be based on the MAC address,
      but doesn't have to be. We can also use any 64-bit number as the
      SCI. When the SCI based on the MAC address, it uses a 16-bit "port
      number" provided by userspace, which commit 6fc498bc overwrites
      with 1.
      
      In addition, changing the SCI after macsec has been setup can just
      confuse the receiver. If we configure the RXSC on the peer based on
      the original SCI, we should keep the same SCI on TX.
      
      When the macsec device is being managed by a userspace key negotiation
      daemon such as wpa_supplicant, commit 6fc498bc would also
      overwrite the SCI defined by userspace.
      
      Fixes: 6fc498bc ("net: macsec: update SCI upon MAC address change.")
      Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
      Link: https://lore.kernel.org/r/9b1a9d28327e7eb54550a92eebda45d25e54dd0d.1660667033.git.sd@queasysnail.netSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e82c649e
    • Sean Anderson's avatar
      net: dpaa: Fix <1G ethernet on LS1046ARDB · 9dbdfd4a
      Sean Anderson authored
      As discussed in commit 73a21fa8 ("dpaa_eth: support all modes with
      rate adapting PHYs"), we must add a workaround for Aquantia phys with
      in-tree support in order to keep 1G support working. Update this
      workaround for the AQR113C phy found on revision C LS1046ARDB boards.
      
      Fixes: 12cf1b89 ("net: phy: Add support for AQR113C EPHY")
      Signed-off-by: default avatarSean Anderson <sean.anderson@seco.com>
      Acked-by: default avatarCamelia Groza <camelia.groza@nxp.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20220818164029.2063293-1-sean.anderson@seco.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9dbdfd4a
    • Linus Torvalds's avatar
      Merge tag 'net-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 4c2d0b03
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Including fixes from netfilter.
      
        Current release - regressions:
      
         - tcp: fix cleanup and leaks in tcp_read_skb() (the new way BPF
           socket maps get data out of the TCP stack)
      
         - tls: rx: react to strparser initialization errors
      
         - netfilter: nf_tables: fix scheduling-while-atomic splat
      
         - net: fix suspicious RCU usage in bpf_sk_reuseport_detach()
      
        Current release - new code bugs:
      
         - mlxsw: ptp: fix a couple of races, static checker warnings and
           error handling
      
        Previous releases - regressions:
      
         - netfilter:
            - nf_tables: fix possible module reference underflow in error path
            - make conntrack helpers deal with BIG TCP (skbs > 64kB)
            - nfnetlink: re-enable conntrack expectation events
      
         - net: fix potential refcount leak in ndisc_router_discovery()
      
        Previous releases - always broken:
      
         - sched: cls_route: disallow handle of 0
      
         - neigh: fix possible local DoS due to net iface start/stop loop
      
         - rtnetlink: fix module refcount leak in rtnetlink_rcv_msg
      
         - sched: fix adding qlen to qcpu->backlog in gnet_stats_add_queue_cpu
      
         - virtio_net: fix endian-ness for RSS
      
         - dsa: mv88e6060: prevent crash on an unused port
      
         - fec: fix timer capture timing in `fec_ptp_enable_pps()`
      
         - ocelot: stats: fix races, integer wrapping and reading incorrect
           registers (the change of register definitions here accounts for
           bulk of the changed LoC in this PR)"
      
      * tag 'net-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (77 commits)
        net: moxa: MAC address reading, generating, validity checking
        tcp: handle pure FIN case correctly
        tcp: refactor tcp_read_skb() a bit
        tcp: fix tcp_cleanup_rbuf() for tcp_read_skb()
        tcp: fix sock skb accounting in tcp_read_skb()
        igb: Add lock to avoid data race
        dt-bindings: Fix incorrect "the the" corrections
        net: genl: fix error path memory leak in policy dumping
        stmmac: intel: Add a missing clk_disable_unprepare() call in intel_eth_pci_remove()
        net: ethernet: mtk_eth_soc: fix possible NULL pointer dereference in mtk_xdp_run
        net/mlx5e: Allocate flow steering storage during uplink initialization
        net: mscc: ocelot: report ndo_get_stats64 from the wraparound-resistant ocelot->stats
        net: mscc: ocelot: keep ocelot_stat_layout by reg address, not offset
        net: mscc: ocelot: make struct ocelot_stat_layout array indexable
        net: mscc: ocelot: fix race between ndo_get_stats64 and ocelot_check_stats_work
        net: mscc: ocelot: turn stats_lock into a spinlock
        net: mscc: ocelot: fix address of SYS_COUNT_TX_AGING counter
        net: mscc: ocelot: fix incorrect ndo_get_stats64 packet counters
        net: dsa: felix: fix ethtool 256-511 and 512-1023 TX packet counters
        net: dsa: don't warn in dsa_port_set_state_now() when driver doesn't support it
        ...
      4c2d0b03
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-next-6.0-rc2' of... · 90b6b686
      Linus Torvalds authored
      Merge tag 'linux-kselftest-next-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull Kselftest fix from Shuah Khan:
      
       - fix landlock test build regression
      
      * tag 'linux-kselftest-next-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        selftests/landlock: fix broken include of linux/landlock.h
      90b6b686
    • Linus Torvalds's avatar
      Merge tag 'trace-rtla-v6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · 0de277d4
      Linus Torvalds authored
      Pull rtla tool fixes from Steven Rostedt:
       "Fixes for the Real-Time Linux Analysis tooling:
      
         - Fix tracer name in comments and prints
      
         - Fix setting up symlinks
      
         - Allow extra flags to be set in build
      
         - Consolidate and show all necessary libraries not found in build
           error"
      
      * tag 'trace-rtla-v6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        rtla: Consolidate and show all necessary libraries that failed for building
        tools/rtla: Build with EXTRA_{C,LD}FLAGS
        tools/rtla: Fix command symlinks
        rtla: Fix tracer name
      0de277d4
  5. 18 Aug, 2022 11 commits