1. 03 Oct, 2024 3 commits
  2. 01 Oct, 2024 14 commits
    • Anton Danilov's avatar
      ipv4: ip_gre: Fix drops of small packets in ipgre_xmit · c4a14f6d
      Anton Danilov authored
      Regression Description:
      
      Depending on the options specified for the GRE tunnel device, small
      packets may be dropped. This occurs because the pskb_network_may_pull
      function fails due to the packet's insufficient length.
      
      For example, if only the okey option is specified for the tunnel device,
      original (before encapsulation) packets smaller than 28 bytes (including
      the IPv4 header) will be dropped. This happens because the required
      length is calculated relative to the network header, not the skb->head.
      
      Here is how the required length is computed and checked:
      
      * The pull_len variable is set to 28 bytes, consisting of:
        * IPv4 header: 20 bytes
        * GRE header with Key field: 8 bytes
      
      * The pskb_network_may_pull function adds the network offset, shifting
      the checkable space further to the beginning of the network header and
      extending it to the beginning of the packet. As a result, the end of
      the checkable space occurs beyond the actual end of the packet.
      
      Instead of ensuring that 28 bytes are present in skb->head, the function
      is requesting these 28 bytes starting from the network header. For small
      packets, this requested length exceeds the actual packet size, causing
      the check to fail and the packets to be dropped.
      
      This issue affects both locally originated and forwarded packets in
      DMVPN-like setups.
      
      How to reproduce (for local originated packets):
      
        ip link add dev gre1 type gre ikey 1.9.8.4 okey 1.9.8.4 \
                local <your-ip> remote 0.0.0.0
      
        ip link set mtu 1400 dev gre1
        ip link set up dev gre1
        ip address add 192.168.13.1/24 dev gre1
        ip neighbor add 192.168.13.2 lladdr <remote-ip> dev gre1
        ping -s 1374 -c 10 192.168.13.2
        tcpdump -vni gre1
        tcpdump -vni <your-ext-iface> 'ip proto 47'
        ip -s -s -d link show dev gre1
      
      Solution:
      
      Use the pskb_may_pull function instead the pskb_network_may_pull.
      
      Fixes: 80d875cf ("ipv4: ip_gre: Avoid skb_pull() failure in ipgre_xmit()")
      Signed-off-by: default avatarAnton Danilov <littlesmilingcloud@gmail.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://patch.msgid.link/20240924235158.106062-1-littlesmilingcloud@gmail.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      c4a14f6d
    • Shenwei Wang's avatar
      net: stmmac: dwmac4: extend timeout for VLAN Tag register busy bit check · 4c1b5667
      Shenwei Wang authored
      Increase the timeout for checking the busy bit of the VLAN Tag register
      from 10µs to 500ms. This change is necessary to accommodate scenarios
      where Energy Efficient Ethernet (EEE) is enabled.
      
      Overnight testing revealed that when EEE is active, the busy bit can
      remain set for up to approximately 300ms. The new 500ms timeout provides
      a safety margin.
      
      Fixes: ed64639b ("net: stmmac: Add support for VLAN Rx filtering")
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarShenwei Wang <shenwei.wang@nxp.com>
      Link: https://patch.msgid.link/20240924205424.573913-1-shenwei.wang@nxp.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      4c1b5667
    • Paolo Abeni's avatar
      Merge branch 'net-two-fixes-for-qdisc_pkt_len_init' · 23e19f24
      Paolo Abeni authored
      Eric Dumazet says:
      
      ====================
      net: two fixes for qdisc_pkt_len_init()
      
      Inspired by one syzbot report.
      
      At least one qdisc (fq_codel) depends on qdisc_skb_cb(skb)->pkt_len
      having a sane value (not zero)
      
      With the help of af_packet, syzbot was able to fool qdisc_pkt_len_init()
      to precisely set qdisc_skb_cb(skb)->pkt_len to zero.
      
      First patch fixes this issue.
      
      Second one (a separate one to help future bisections) adds
      more sanity check to SKB_GSO_DODGY users.
      ====================
      
      Link: https://patch.msgid.link/20240924150257.1059524-1-edumazet@google.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      23e19f24
    • Eric Dumazet's avatar
      net: add more sanity checks to qdisc_pkt_len_init() · ab9a9a9e
      Eric Dumazet authored
      One path takes care of SKB_GSO_DODGY, assuming
      skb->len is bigger than hdr_len.
      
      virtio_net_hdr_to_skb() does not fully dissect TCP headers,
      it only make sure it is at least 20 bytes.
      
      It is possible for an user to provide a malicious 'GSO' packet,
      total length of 80 bytes.
      
      - 20 bytes of IPv4 header
      - 60 bytes TCP header
      - a small gso_size like 8
      
      virtio_net_hdr_to_skb() would declare this packet as a normal
      GSO packet, because it would see 40 bytes of payload,
      bigger than gso_size.
      
      We need to make detect this case to not underflow
      qdisc_skb_cb(skb)->pkt_len.
      
      Fixes: 1def9238 ("net_sched: more precise pkt_len computation")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      ab9a9a9e
    • Eric Dumazet's avatar
      net: avoid potential underflow in qdisc_pkt_len_init() with UFO · c20029db
      Eric Dumazet authored
      After commit 7c6d2ecb ("net: be more gentle about silly gso
      requests coming from user") virtio_net_hdr_to_skb() had sanity check
      to detect malicious attempts from user space to cook a bad GSO packet.
      
      Then commit cf9acc90 ("net: virtio_net_hdr_to_skb: count
      transport header in UFO") while fixing one issue, allowed user space
      to cook a GSO packet with the following characteristic :
      
      IPv4 SKB_GSO_UDP, gso_size=3, skb->len = 28.
      
      When this packet arrives in qdisc_pkt_len_init(), we end up
      with hdr_len = 28 (IPv4 header + UDP header), matching skb->len
      
      Then the following sets gso_segs to 0 :
      
      gso_segs = DIV_ROUND_UP(skb->len - hdr_len,
                              shinfo->gso_size);
      
      Then later we set qdisc_skb_cb(skb)->pkt_len to back to zero :/
      
      qdisc_skb_cb(skb)->pkt_len += (gso_segs - 1) * hdr_len;
      
      This leads to the following crash in fq_codel [1]
      
      qdisc_pkt_len_init() is best effort, we only want an estimation
      of the bytes sent on the wire, not crashing the kernel.
      
      This patch is fixing this particular issue, a following one
      adds more sanity checks for another potential bug.
      
      [1]
      [   70.724101] BUG: kernel NULL pointer dereference, address: 0000000000000000
      [   70.724561] #PF: supervisor read access in kernel mode
      [   70.724561] #PF: error_code(0x0000) - not-present page
      [   70.724561] PGD 10ac61067 P4D 10ac61067 PUD 107ee2067 PMD 0
      [   70.724561] Oops: Oops: 0000 [#1] SMP NOPTI
      [   70.724561] CPU: 11 UID: 0 PID: 2163 Comm: b358537762 Not tainted 6.11.0-virtme #991
      [   70.724561] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
      [   70.724561] RIP: 0010:fq_codel_enqueue (net/sched/sch_fq_codel.c:120 net/sched/sch_fq_codel.c:168 net/sched/sch_fq_codel.c:230) sch_fq_codel
      [ 70.724561] Code: 24 08 49 c1 e1 06 44 89 7c 24 18 45 31 ed 45 31 c0 31 ff 89 44 24 14 4c 03 8b 90 01 00 00 eb 04 39 ca 73 37 4d 8b 39 83 c7 01 <49> 8b 17 49 89 11 41 8b 57 28 45 8b 5f 34 49 c7 07 00 00 00 00 49
      All code
      ========
         0:	24 08                	and    $0x8,%al
         2:	49 c1 e1 06          	shl    $0x6,%r9
         6:	44 89 7c 24 18       	mov    %r15d,0x18(%rsp)
         b:	45 31 ed             	xor    %r13d,%r13d
         e:	45 31 c0             	xor    %r8d,%r8d
        11:	31 ff                	xor    %edi,%edi
        13:	89 44 24 14          	mov    %eax,0x14(%rsp)
        17:	4c 03 8b 90 01 00 00 	add    0x190(%rbx),%r9
        1e:	eb 04                	jmp    0x24
        20:	39 ca                	cmp    %ecx,%edx
        22:	73 37                	jae    0x5b
        24:	4d 8b 39             	mov    (%r9),%r15
        27:	83 c7 01             	add    $0x1,%edi
        2a:*	49 8b 17             	mov    (%r15),%rdx		<-- trapping instruction
        2d:	49 89 11             	mov    %rdx,(%r9)
        30:	41 8b 57 28          	mov    0x28(%r15),%edx
        34:	45 8b 5f 34          	mov    0x34(%r15),%r11d
        38:	49 c7 07 00 00 00 00 	movq   $0x0,(%r15)
        3f:	49                   	rex.WB
      
      Code starting with the faulting instruction
      ===========================================
         0:	49 8b 17             	mov    (%r15),%rdx
         3:	49 89 11             	mov    %rdx,(%r9)
         6:	41 8b 57 28          	mov    0x28(%r15),%edx
         a:	45 8b 5f 34          	mov    0x34(%r15),%r11d
         e:	49 c7 07 00 00 00 00 	movq   $0x0,(%r15)
        15:	49                   	rex.WB
      [   70.724561] RSP: 0018:ffff95ae85e6fb90 EFLAGS: 00000202
      [   70.724561] RAX: 0000000002000000 RBX: ffff95ae841de000 RCX: 0000000000000000
      [   70.724561] RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001
      [   70.724561] RBP: ffff95ae85e6fbf8 R08: 0000000000000000 R09: ffff95b710a30000
      [   70.724561] R10: 0000000000000000 R11: bdf289445ce31881 R12: ffff95ae85e6fc58
      [   70.724561] R13: 0000000000000000 R14: 0000000000000040 R15: 0000000000000000
      [   70.724561] FS:  000000002c5c1380(0000) GS:ffff95bd7fcc0000(0000) knlGS:0000000000000000
      [   70.724561] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   70.724561] CR2: 0000000000000000 CR3: 000000010c568000 CR4: 00000000000006f0
      [   70.724561] Call Trace:
      [   70.724561]  <TASK>
      [   70.724561] ? __die (arch/x86/kernel/dumpstack.c:421 arch/x86/kernel/dumpstack.c:434)
      [   70.724561] ? page_fault_oops (arch/x86/mm/fault.c:715)
      [   70.724561] ? exc_page_fault (./arch/x86/include/asm/irqflags.h:26 ./arch/x86/include/asm/irqflags.h:87 ./arch/x86/include/asm/irqflags.h:147 arch/x86/mm/fault.c:1489 arch/x86/mm/fault.c:1539)
      [   70.724561] ? asm_exc_page_fault (./arch/x86/include/asm/idtentry.h:623)
      [   70.724561] ? fq_codel_enqueue (net/sched/sch_fq_codel.c:120 net/sched/sch_fq_codel.c:168 net/sched/sch_fq_codel.c:230) sch_fq_codel
      [   70.724561] dev_qdisc_enqueue (net/core/dev.c:3784)
      [   70.724561] __dev_queue_xmit (net/core/dev.c:3880 (discriminator 2) net/core/dev.c:4390 (discriminator 2))
      [   70.724561] ? irqentry_enter (kernel/entry/common.c:237)
      [   70.724561] ? sysvec_apic_timer_interrupt (./arch/x86/include/asm/hardirq.h:74 (discriminator 2) arch/x86/kernel/apic/apic.c:1043 (discriminator 2) arch/x86/kernel/apic/apic.c:1043 (discriminator 2))
      [   70.724561] ? trace_hardirqs_on (kernel/trace/trace_preemptirq.c:58 (discriminator 4))
      [   70.724561] ? asm_sysvec_apic_timer_interrupt (./arch/x86/include/asm/idtentry.h:702)
      [   70.724561] ? virtio_net_hdr_to_skb.constprop.0 (./include/linux/virtio_net.h:129 (discriminator 1))
      [   70.724561] packet_sendmsg (net/packet/af_packet.c:3145 (discriminator 1) net/packet/af_packet.c:3177 (discriminator 1))
      [   70.724561] ? _raw_spin_lock_bh (./arch/x86/include/asm/atomic.h:107 (discriminator 4) ./include/linux/atomic/atomic-arch-fallback.h:2170 (discriminator 4) ./include/linux/atomic/atomic-instrumented.h:1302 (discriminator 4) ./include/asm-generic/qspinlock.h:111 (discriminator 4) ./include/linux/spinlock.h:187 (discriminator 4) ./include/linux/spinlock_api_smp.h:127 (discriminator 4) kernel/locking/spinlock.c:178 (discriminator 4))
      [   70.724561] ? netdev_name_node_lookup_rcu (net/core/dev.c:325 (discriminator 1))
      [   70.724561] __sys_sendto (net/socket.c:730 (discriminator 1) net/socket.c:745 (discriminator 1) net/socket.c:2210 (discriminator 1))
      [   70.724561] ? __sys_setsockopt (./include/linux/file.h:34 net/socket.c:2355)
      [   70.724561] __x64_sys_sendto (net/socket.c:2222 (discriminator 1) net/socket.c:2218 (discriminator 1) net/socket.c:2218 (discriminator 1))
      [   70.724561] do_syscall_64 (arch/x86/entry/common.c:52 (discriminator 1) arch/x86/entry/common.c:83 (discriminator 1))
      [   70.724561] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
      [   70.724561] RIP: 0033:0x41ae09
      
      Fixes: cf9acc90 ("net: virtio_net_hdr_to_skb: count transport header in UFO")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Jonathan Davies <jonathan.davies@nutanix.com>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Reviewed-by: default avatarJonathan Davies <jonathan.davies@nutanix.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      c20029db
    • Roger Quadros's avatar
      net: ethernet: ti: cpsw_ale: Fix warning on some platforms · e9d591b1
      Roger Quadros authored
      The number of register fields cannot be assumed to be ALE_FIELDS_MAX
      as some platforms can have lesser fields.
      
      Solve this by embedding the actual number of fields available
      in platform data and use that instead of ALE_FIELDS_MAX.
      
      Gets rid of the below warning on BeagleBone Black
      
      [    1.007735] WARNING: CPU: 0 PID: 33 at drivers/base/regmap/regmap.c:1208 regmap_field_init+0x88/0x9c
      [    1.007802] invalid empty mask defined
      [    1.007812] Modules linked in:
      [    1.007842] CPU: 0 UID: 0 PID: 33 Comm: kworker/u4:3 Not tainted 6.11.0-01459-g508403ab7b74-dirty #840
      [    1.007867] Hardware name: Generic AM33XX (Flattened Device Tree)
      [    1.007890] Workqueue: events_unbound deferred_probe_work_func
      [    1.007935] Call trace:
      [    1.007957]  unwind_backtrace from show_stack+0x10/0x14
      [    1.007999]  show_stack from dump_stack_lvl+0x50/0x64
      [    1.008033]  dump_stack_lvl from __warn+0x70/0x124
      [    1.008077]  __warn from warn_slowpath_fmt+0x194/0x1a8
      [    1.008113]  warn_slowpath_fmt from regmap_field_init+0x88/0x9c
      [    1.008154]  regmap_field_init from devm_regmap_field_alloc+0x48/0x64
      [    1.008193]  devm_regmap_field_alloc from cpsw_ale_create+0xfc/0x320
      [    1.008251]  cpsw_ale_create from cpsw_init_common+0x214/0x354
      [    1.008286]  cpsw_init_common from cpsw_probe+0x4ac/0xb88
      Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Closes: https://lore.kernel.org/netdev/CAMuHMdUf-tKRDzkz2_m8qdFTFutefddU0NTratVrEjRTzA3yQQ@mail.gmail.com/
      Fixes: 11cbcfea ("net: ethernet: ti: cpsw_ale: use regfields for number of Entries and Policers")
      Signed-off-by: default avatarRoger Quadros <rogerq@kernel.org>
      Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Link: https://patch.msgid.link/20240924-am65-cpsw-multi-rx-fix-v1-1-0ca3fa9a1398@kernel.orgSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      e9d591b1
    • Geert Uytterhoeven's avatar
      net: microchip: Make FDMA config symbol invisible · 1910bd47
      Geert Uytterhoeven authored
      There is no need to ask the user about enabling Microchip FDMA
      functionality, as all drivers that use it select the FDMA symbol.
      Hence make the symbol invisible, unless when compile-testing.
      
      Fixes: 30e48a75 ("net: microchip: add FDMA library")
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: default avatarDaniel Machon <daniel.machon@microchip.com>
      Link: https://patch.msgid.link/8e2bcd8899c417a962b7ee3f75b29f35b25d7933.1727171879.git.geert+renesas@glider.beSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      1910bd47
    • Csókás, Bence's avatar
      net: fec: Reload PTP registers after link-state change · d9335d02
      Csókás, Bence authored
      On link-state change, the controller gets reset,
      which clears all PTP registers, including PHC time,
      calibrated clock correction values etc. For correct
      IEEE 1588 operation we need to restore these after
      the reset.
      
      Fixes: 6605b730 ("FEC: Add time stamping code and a PTP hardware clock")
      Signed-off-by: default avatarCsókás, Bence <csokas.bence@prolan.hu>
      Reviewed-by: default avatarWei Fang <wei.fang@nxp.com>
      Link: https://patch.msgid.link/20240924093705.2897329-2-csokas.bence@prolan.huSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      d9335d02
    • Csókás, Bence's avatar
      net: fec: Restart PPS after link state change · a1477dc8
      Csókás, Bence authored
      On link state change, the controller gets reset,
      causing PPS to drop out. Re-enable PPS if it was
      enabled before the controller reset.
      
      Fixes: 6605b730 ("FEC: Add time stamping code and a PTP hardware clock")
      Signed-off-by: default avatarCsókás, Bence <csokas.bence@prolan.hu>
      Link: https://patch.msgid.link/20240924093705.2897329-1-csokas.bence@prolan.huSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      a1477dc8
    • Jiawen Wu's avatar
      net: pcs: xpcs: fix the wrong register that was written back · 93ef6ee5
      Jiawen Wu authored
      The value is read from the register TXGBE_RX_GEN_CTL3, and it should be
      written back to TXGBE_RX_GEN_CTL3 when it changes some fields.
      
      Cc: stable@vger.kernel.org
      Fixes: f629acc6 ("net: pcs: xpcs: support to switch mode for Wangxun NICs")
      Signed-off-by: default avatarJiawen Wu <jiawenwu@trustnetic.com>
      Reported-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Link: https://patch.msgid.link/20240924022857.865422-1-jiawenwu@trustnetic.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      93ef6ee5
    • Aleksander Jan Bajkowski's avatar
      net: ethernet: lantiq_etop: fix memory disclosure · 45c0de18
      Aleksander Jan Bajkowski authored
      When applying padding, the buffer is not zeroed, which results in memory
      disclosure. The mentioned data is observed on the wire. This patch uses
      skb_put_padto() to pad Ethernet frames properly. The mentioned function
      zeroes the expanded buffer.
      
      In case the packet cannot be padded it is silently dropped. Statistics
      are also not incremented. This driver does not support statistics in the
      old 32-bit format or the new 64-bit format. These will be added in the
      future. In its current form, the patch should be easily backported to
      stable versions.
      
      Ethernet MACs on Amazon-SE and Danube cannot do padding of the packets
      in hardware, so software padding must be applied.
      
      Fixes: 504d4721 ("MIPS: Lantiq: Add ethernet driver")
      Signed-off-by: default avatarAleksander Jan Bajkowski <olek2@wp.pl>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Link: https://patch.msgid.link/20240923214949.231511-2-olek2@wp.plSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      45c0de18
    • Daniel Borkmann's avatar
      net: Fix gso_features_check to check for both dev->gso_{ipv4_,}max_size · e609c959
      Daniel Borkmann authored
      Commit 24ab059d ("net: check dev->gso_max_size in gso_features_check()")
      added a dev->gso_max_size test to gso_features_check() in order to fall
      back to GSO when needed.
      
      This was added as it was noticed that some drivers could misbehave if TSO
      packets get too big. However, the check doesn't respect dev->gso_ipv4_max_size
      limit. For instance, a device could be configured with BIG TCP for IPv4,
      but not IPv6.
      
      Therefore, add a netif_get_gso_max_size() equivalent to netif_get_gro_max_size()
      and use the helper to respect both limits before falling back to GSO engine.
      
      Fixes: 24ab059d ("net: check dev->gso_max_size in gso_features_check()")
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://patch.msgid.link/20240923212242.15669-2-daniel@iogearbox.netSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      e609c959
    • Daniel Borkmann's avatar
      net: Add netif_get_gro_max_size helper for GRO · e8d4d34d
      Daniel Borkmann authored
      Add a small netif_get_gro_max_size() helper which returns the maximum IPv4
      or IPv6 GRO size of the netdevice.
      
      We later add a netif_get_gso_max_size() equivalent as well for GSO, so that
      these helpers can be used consistently instead of open-coded checks.
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://patch.msgid.link/20240923212242.15669-1-daniel@iogearbox.netSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      e8d4d34d
    • Vladimir Oltean's avatar
      net: dsa: improve shutdown sequence · 6c24a03a
      Vladimir Oltean authored
      Alexander Sverdlin presents 2 problems during shutdown with the
      lan9303 driver. One is specific to lan9303 and the other just happens
      to reproduce there.
      
      The first problem is that lan9303 is unique among DSA drivers in that it
      calls dev_get_drvdata() at "arbitrary runtime" (not probe, not shutdown,
      not remove):
      
      phy_state_machine()
      -> ...
         -> dsa_user_phy_read()
            -> ds->ops->phy_read()
               -> lan9303_phy_read()
                  -> chip->ops->phy_read()
                     -> lan9303_mdio_phy_read()
                        -> dev_get_drvdata()
      
      But we never stop the phy_state_machine(), so it may continue to run
      after dsa_switch_shutdown(). Our common pattern in all DSA drivers is
      to set drvdata to NULL to suppress the remove() method that may come
      afterwards. But in this case it will result in an NPD.
      
      The second problem is that the way in which we set
      dp->conduit->dsa_ptr = NULL; is concurrent with receive packet
      processing. dsa_switch_rcv() checks once whether dev->dsa_ptr is NULL,
      but afterwards, rather than continuing to use that non-NULL value,
      dev->dsa_ptr is dereferenced again and again without NULL checks:
      dsa_conduit_find_user() and many other places. In between dereferences,
      there is no locking to ensure that what was valid once continues to be
      valid.
      
      Both problems have the common aspect that closing the conduit interface
      solves them.
      
      In the first case, dev_close(conduit) triggers the NETDEV_GOING_DOWN
      event in dsa_user_netdevice_event() which closes user ports as well.
      dsa_port_disable_rt() calls phylink_stop(), which synchronously stops
      the phylink state machine, and ds->ops->phy_read() will thus no longer
      call into the driver after this point.
      
      In the second case, dev_close(conduit) should do this, as per
      Documentation/networking/driver.rst:
      
      | Quiescence
      | ----------
      |
      | After the ndo_stop routine has been called, the hardware must
      | not receive or transmit any data.  All in flight packets must
      | be aborted. If necessary, poll or wait for completion of
      | any reset commands.
      
      So it should be sufficient to ensure that later, when we zeroize
      conduit->dsa_ptr, there will be no concurrent dsa_switch_rcv() call
      on this conduit.
      
      The addition of the netif_device_detach() function is to ensure that
      ioctls, rtnetlinks and ethtool requests on the user ports no longer
      propagate down to the driver - we're no longer prepared to handle them.
      
      The race condition actually did not exist when commit 0650bf52
      ("net: dsa: be compatible with masters which unregister on shutdown")
      first introduced dsa_switch_shutdown(). It was created later, when we
      stopped unregistering the user interfaces from a bad spot, and we just
      replaced that sequence with a racy zeroization of conduit->dsa_ptr
      (one which doesn't ensure that the interfaces aren't up).
      Reported-by: default avatarAlexander Sverdlin <alexander.sverdlin@siemens.com>
      Closes: https://lore.kernel.org/netdev/2d2e3bba17203c14a5ffdabc174e3b6bbb9ad438.camel@siemens.com/
      Closes: https://lore.kernel.org/netdev/c1bf4de54e829111e0e4a70e7bd1cf523c9550ff.camel@siemens.com/
      Fixes: ee534378 ("net: dsa: fix panic when DSA master device unbinds on shutdown")
      Reviewed-by: default avatarAlexander Sverdlin <alexander.sverdlin@siemens.com>
      Tested-by: default avatarAlexander Sverdlin <alexander.sverdlin@siemens.com>
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Link: https://patch.msgid.link/20240913203549.3081071-1-vladimir.oltean@nxp.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      6c24a03a
  3. 27 Sep, 2024 7 commits
    • Luiz Augusto von Dentz's avatar
      Bluetooth: hci_event: Align BR/EDR JUST_WORKS paring with LE · b25e11f9
      Luiz Augusto von Dentz authored
      This aligned BR/EDR JUST_WORKS method with LE which since 92516cd9
      ("Bluetooth: Always request for user confirmation for Just Works")
      always request user confirmation with confirm_hint set since the
      likes of bluetoothd have dedicated policy around JUST_WORKS method
      (e.g. main.conf:JustWorksRepairing).
      
      CVE: CVE-2024-8805
      Cc: stable@vger.kernel.org
      Fixes: ba15a58b ("Bluetooth: Fix SSP acceptor just-works confirmation without MITM")
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Tested-by: default avatarKiran K <kiran.k@intel.com>
      b25e11f9
    • Jinjie Ruan's avatar
      Bluetooth: btmrvl: Use IRQF_NO_AUTOEN flag in request_irq() · 7b1ab460
      Jinjie Ruan authored
      disable_irq() after request_irq() still has a time gap in which
      interrupts can come. request_irq() with IRQF_NO_AUTOEN flag will
      disable IRQ auto-enable when request IRQ.
      
      Fixes: bb7f4f0b ("btmrvl: add platform specific wakeup interrupt support")
      Signed-off-by: default avatarJinjie Ruan <ruanjinjie@huawei.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      7b1ab460
    • Luiz Augusto von Dentz's avatar
      Bluetooth: L2CAP: Fix uaf in l2cap_connect · 333b4fd1
      Luiz Augusto von Dentz authored
      [Syzbot reported]
      BUG: KASAN: slab-use-after-free in l2cap_connect.constprop.0+0x10d8/0x1270 net/bluetooth/l2cap_core.c:3949
      Read of size 8 at addr ffff8880241e9800 by task kworker/u9:0/54
      
      CPU: 0 UID: 0 PID: 54 Comm: kworker/u9:0 Not tainted 6.11.0-rc6-syzkaller-00268-g788220ee #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
      Workqueue: hci2 hci_rx_work
      Call Trace:
       <TASK>
       __dump_stack lib/dump_stack.c:93 [inline]
       dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:119
       print_address_description mm/kasan/report.c:377 [inline]
       print_report+0xc3/0x620 mm/kasan/report.c:488
       kasan_report+0xd9/0x110 mm/kasan/report.c:601
       l2cap_connect.constprop.0+0x10d8/0x1270 net/bluetooth/l2cap_core.c:3949
       l2cap_connect_req net/bluetooth/l2cap_core.c:4080 [inline]
       l2cap_bredr_sig_cmd net/bluetooth/l2cap_core.c:4772 [inline]
       l2cap_sig_channel net/bluetooth/l2cap_core.c:5543 [inline]
       l2cap_recv_frame+0xf0b/0x8eb0 net/bluetooth/l2cap_core.c:6825
       l2cap_recv_acldata+0x9b4/0xb70 net/bluetooth/l2cap_core.c:7514
       hci_acldata_packet net/bluetooth/hci_core.c:3791 [inline]
       hci_rx_work+0xaab/0x1610 net/bluetooth/hci_core.c:4028
       process_one_work+0x9c5/0x1b40 kernel/workqueue.c:3231
       process_scheduled_works kernel/workqueue.c:3312 [inline]
       worker_thread+0x6c8/0xed0 kernel/workqueue.c:3389
       kthread+0x2c1/0x3a0 kernel/kthread.c:389
       ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
      ...
      
      Freed by task 5245:
       kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
       kasan_save_track+0x14/0x30 mm/kasan/common.c:68
       kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579
       poison_slab_object+0xf7/0x160 mm/kasan/common.c:240
       __kasan_slab_free+0x32/0x50 mm/kasan/common.c:256
       kasan_slab_free include/linux/kasan.h:184 [inline]
       slab_free_hook mm/slub.c:2256 [inline]
       slab_free mm/slub.c:4477 [inline]
       kfree+0x12a/0x3b0 mm/slub.c:4598
       l2cap_conn_free net/bluetooth/l2cap_core.c:1810 [inline]
       kref_put include/linux/kref.h:65 [inline]
       l2cap_conn_put net/bluetooth/l2cap_core.c:1822 [inline]
       l2cap_conn_del+0x59d/0x730 net/bluetooth/l2cap_core.c:1802
       l2cap_connect_cfm+0x9e6/0xf80 net/bluetooth/l2cap_core.c:7241
       hci_connect_cfm include/net/bluetooth/hci_core.h:1960 [inline]
       hci_conn_failed+0x1c3/0x370 net/bluetooth/hci_conn.c:1265
       hci_abort_conn_sync+0x75a/0xb50 net/bluetooth/hci_sync.c:5583
       abort_conn_sync+0x197/0x360 net/bluetooth/hci_conn.c:2917
       hci_cmd_sync_work+0x1a4/0x410 net/bluetooth/hci_sync.c:328
       process_one_work+0x9c5/0x1b40 kernel/workqueue.c:3231
       process_scheduled_works kernel/workqueue.c:3312 [inline]
       worker_thread+0x6c8/0xed0 kernel/workqueue.c:3389
       kthread+0x2c1/0x3a0 kernel/kthread.c:389
       ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
      
      Reported-by: syzbot+c12e2f941af1feb5632c@syzkaller.appspotmail.com
      Tested-by: syzbot+c12e2f941af1feb5632c@syzkaller.appspotmail.com
      Closes: https://syzkaller.appspot.com/bug?extid=c12e2f941af1feb5632c
      Fixes: 7b064eda ("Bluetooth: Fix authentication if acl data comes before remote feature evt")
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      333b4fd1
    • Luiz Augusto von Dentz's avatar
      Bluetooth: MGMT: Fix possible crash on mgmt_index_removed · f53e1c9c
      Luiz Augusto von Dentz authored
      If mgmt_index_removed is called while there are commands queued on
      cmd_sync it could lead to crashes like the bellow trace:
      
      0x0000053D: __list_del_entry_valid_or_report+0x98/0xdc
      0x0000053D: mgmt_pending_remove+0x18/0x58 [bluetooth]
      0x0000053E: mgmt_remove_adv_monitor_complete+0x80/0x108 [bluetooth]
      0x0000053E: hci_cmd_sync_work+0xbc/0x164 [bluetooth]
      
      So while handling mgmt_index_removed this attempts to dequeue
      commands passed as user_data to cmd_sync.
      
      Fixes: 7cf5c297 ("Bluetooth: hci_sync: Refactor remove Adv Monitor")
      Reported-by: default avatarjiaymao <quic_jiaymao@quicinc.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      f53e1c9c
    • Jinjie Ruan's avatar
      net: wwan: qcom_bam_dmux: Fix missing pm_runtime_disable() · d505d359
      Jinjie Ruan authored
      It's important to undo pm_runtime_use_autosuspend() with
      pm_runtime_dont_use_autosuspend() at driver exit time.
      
      But the pm_runtime_disable() and pm_runtime_dont_use_autosuspend()
      is missing in the error path for bam_dmux_probe(). So add it.
      
      Found by code review. Compile-tested only.
      
      Fixes: 21a0ffd9 ("net: wwan: Add Qualcomm BAM-DMUX WWAN network driver")
      Suggested-by: default avatarStephan Gerhold <stephan.gerhold@linaro.org>
      Signed-off-by: default avatarJinjie Ruan <ruanjinjie@huawei.com>
      Reviewed-by: default avatarStephan Gerhold <stephan.gerhold@linaro.org>
      Reviewed-by: default avatarSergey Ryazanov <ryazanov.s.a@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d505d359
    • Jinjie Ruan's avatar
      net: ieee802154: mcr20a: Use IRQF_NO_AUTOEN flag in request_irq() · 09573b1c
      Jinjie Ruan authored
      disable_irq() after request_irq() still has a time gap in which
      interrupts can come. request_irq() with IRQF_NO_AUTOEN flag will
      disable IRQ auto-enable when request IRQ.
      
      Fixes: 8c6ad9cc ("ieee802154: Add NXP MCR20A IEEE 802.15.4 transceiver driver")
      Reviewed-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Signed-off-by: default avatarJinjie Ruan <ruanjinjie@huawei.com>
      Link: https://lore.kernel.org/20240911094234.1922418-1-ruanjinjie@huawei.comSigned-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
      09573b1c
    • Paolo Abeni's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 3a39d672
      Paolo Abeni authored
      Cross-merge networking fixes after downstream PR.
      
      No conflicts and no adjacent changes.
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      3a39d672
  4. 26 Sep, 2024 16 commits
    • Linus Torvalds's avatar
      Merge tag 'net-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 62a0e2fa
      Linus Torvalds authored
      Pull networking fixes from Paolo Abeni:
       "Including fixes from netfilter.
      
        It looks like that most people are still traveling: both the ML volume
        and the processing capacity are low.
      
        Previous releases - regressions:
      
          - netfilter:
              - nf_reject_ipv6: fix nf_reject_ip6_tcphdr_put()
              - nf_tables: keep deleted flowtable hooks until after RCU
      
          - tcp: check skb is non-NULL in tcp_rto_delta_us()
      
          - phy: aquantia: fix -ETIMEDOUT PHY probe failure when firmware not
            present
      
          - eth: virtio_net: fix mismatched buf address when unmapping for
            small packets
      
          - eth: stmmac: fix zero-division error when disabling tc cbs
      
          - eth: bonding: fix unnecessary warnings and logs from
            bond_xdp_get_xmit_slave()
      
        Previous releases - always broken:
      
          - netfilter:
              - fix clash resolution for bidirectional flows
              - fix allocation with no memcg accounting
      
          - eth: r8169: add tally counter fields added with RTL8125
      
          - eth: ravb: fix rx and tx frame size limit"
      
      * tag 'net-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (35 commits)
        selftests: netfilter: Avoid hanging ipvs.sh
        kselftest: add test for nfqueue induced conntrack race
        netfilter: nfnetlink_queue: remove old clash resolution logic
        netfilter: nf_tables: missing objects with no memcg accounting
        netfilter: nf_tables: use rcu chain hook list iterator from netlink dump path
        netfilter: ctnetlink: compile ctnetlink_label_size with CONFIG_NF_CONNTRACK_EVENTS
        netfilter: nf_reject: Fix build warning when CONFIG_BRIDGE_NETFILTER=n
        netfilter: nf_tables: Keep deleted flowtable hooks until after RCU
        docs: tproxy: ignore non-transparent sockets in iptables
        netfilter: ctnetlink: Guard possible unused functions
        selftests: netfilter: nft_tproxy.sh: add tcp tests
        selftests: netfilter: add reverse-clash resolution test case
        netfilter: conntrack: add clash resolution for reverse collisions
        netfilter: nf_nat: don't try nat source port reallocation for reverse dir clash
        selftests/net: packetdrill: increase timing tolerance in debug mode
        usbnet: fix cyclical race on disconnect with work queue
        net: stmmac: set PP_FLAG_DMA_SYNC_DEV only if XDP is enabled
        virtio_net: Fix mismatched buf address when unmapping for small packets
        bonding: Fix unnecessary warnings and logs from bond_xdp_get_xmit_slave()
        r8169: add missing MODULE_FIRMWARE entry for RTL8126A rev.b
        ...
      62a0e2fa
    • Linus Torvalds's avatar
      Merge tag 'char-misc-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 5e546643
      Linus Torvalds authored
      Pull char / misc driver updates from Greg KH:
       "Here is the "big" set of char/misc and other driver subsystem changes
        for 6.12-rc1.
      
        Lots of changes in here, primarily dominated by the usual IIO driver
        updates and additions, but there are also small driver subsystem
        updates all over the place. Included in here are:
      
         - lots and lots of new IIO drivers and updates to existing ones
      
         - interconnect subsystem updates and new drivers
      
         - nvmem subsystem updates and new drivers
      
         - mhi driver updates
      
         - power supply subsystem updates
      
         - kobj_type const work for many different small subsystems
      
         - comedi driver fix
      
         - coresight subsystem and driver updates
      
         - fpga subsystem improvements
      
         - slimbus fixups
      
         - binder new feature addition for "frozen" notifications
      
         - lots and lots of other small driver updates and cleanups
      
        All of these have been in linux-next for a long time with no reported
        problems"
      
      * tag 'char-misc-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (354 commits)
        greybus: gb-beagleplay: Add firmware upload API
        arm64: dts: ti: k3-am625-beagleplay: Add bootloader-backdoor-gpios to cc1352p7
        dt-bindings: net: ti,cc1352p7: Add bootloader-backdoor-gpios
        MAINTAINERS: Update path for U-Boot environment variables YAML
        nvmem: layouts: add U-Boot env layout
        comedi: ni_routing: tools: Check when the file could not be opened
        ocxl: Remove the unused declarations in headr file
        hpet: Fix the wrong format specifier
        uio: Constify struct kobj_type
        cxl: Constify struct kobj_type
        binder: modify the comment for binder_proc_unlock
        iio: adc: axp20x_adc: add support for AXP717 ADC
        dt-bindings: iio: adc: Add AXP717 compatible
        iio: adc: axp20x_adc: Add adc_en1 and adc_en2 to axp_data
        w1: ds2482: Drop explicit initialization of struct i2c_device_id::driver_data to 0
        tools: iio: rm .*.cmd when make clean
        iio: adc: standardize on formatting for id match tables
        iio: proximity: aw96103: Add support for aw96103/aw96105 proximity sensor
        bus: mhi: host: pci_generic: Enable EDL trigger for Foxconn modems
        bus: mhi: host: pci_generic: Update EDL firmware path for Foxconn modems
        ...
      5e546643
    • Linus Torvalds's avatar
      Merge tag 'staging-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · b707512b
      Linus Torvalds authored
      Pull staging driver updates from Greg KH:
       "Here is the big set of staging driver cleanups and removals for
        6.12-rc1.
      
        Nothing exciting here, just slow, constant, forward progress in
        removing code and cleaning up some old drivers, along with removing
        one of them that was not being used anymore at all. In discussions
        with some developers this past week, even more deletions will be
        happening for the next major merge window, as we seems to have code
        here that obviously no one is using anymore.
      
        Along with the normal cleanups is the good vme_user code forward
        progress, the one major bright spot in the staging subsystem for code
        that people rely on, and is getting good development behind it.
        Hopefully it can graduate out of staging "soon".
      
        All of these changes have been in linux-next for a long time with no
        reported problems"
      
      * tag 'staging-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (141 commits)
        staging: vt6655: Rename variable apTD1Rings
        staging: vt6655: Rename variable apTD0Rings
        staging: rtl8723bs: remove unused 'poll_cnt' from rtw_set_rpwm()
        staging: rtl8723bs: remove unused cnt from recv_func()
        staging: rtl8723bs: remove unused efuseValue from efuse_OneByteWrite()
        staging: rtl8712: remove unused drvinfo_sz from update_recvframe_attrib
        staging: vt6655: mac.h: Fix possible precedence issue in macros
        staging: rtl8723bs: include: Remove spaces before tabs in rtw_security.h
        staging: rtl8723bs: include: Fix trailing */ position in rtw_security.h
        staging: rtl8723bs: include: Fix indent for else block struct in rtw_security.h
        staging: rtl8723bs: include: Fix indent for struct _byte_ in rtw_security.h
        staging: rtl8723bs: include: Fix use of tabs for indent in rtw_security.h
        staging: rtl8723bs: include: Fix indent for switch block in rtw_security.h
        staging: rtl8723bs: include: Fix indent for switch case in rtw_security.h
        staging: rtl8723bs: include: Fix open brace position in rtw_security.h
        staging: nvec: Use IRQF_NO_AUTOEN flag in request_irq()
        staging: rtl8723bs: Remove unused file rtw_rf.c
        staging: rtl8723bs: Remove unused function rtw_ch2freq
        staging: rtl8723bs: Remove unused files rtw_debug.c and rtw_debug.h
        staging: rtl8723bs: Remove unused function dump_4_regs
        ...
      b707512b
    • Linus Torvalds's avatar
      Merge tag 'tty-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · 356a0319
      Linus Torvalds authored
      Pull tty / serial driver updates from Greg KH:
       "Here is the "big" set of tty/serial driver updates for 6.12-rc1.
      
        Nothing major in here, just nice forward progress in the slow cleanup
        of the serial apis, and lots of other driver updates and fixes.
      
        Included in here are:
      
         - serial api updates from Jiri to make things more uniform and sane
      
         - 8250_platform driver cleanups
      
         - samsung serial driver fixes and updates
      
         - qcom-geni serial driver fixes from Johan for the bizarre UART
           engine that that chip seems to have. Hopefully it's in a better
           state now, but hardware designers still seem to come up with more
           ways to make broken UARTS 40+ years after this all should have
           finished.
      
         - sc16is7xx driver updates
      
         - omap 8250 driver updates
      
         - 8250_bcm2835aux driver updates
      
         - a few new serial driver bindings added
      
         - other serial minor driver updates
      
        All of these have been in linux-next for a long time with no reported
        problems"
      
      * tag 'tty-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (65 commits)
        tty: serial: samsung: Fix serial rx on Apple A7-A9
        tty: serial: samsung: Fix A7-A11 serial earlycon SError
        tty: serial: samsung: Use bit manipulation macros for APPLE_S5L_*
        tty: rp2: Fix reset with non forgiving PCIe host bridges
        serial: 8250_aspeed_vuart: Enable module autoloading
        serial: qcom-geni: fix polled console corruption
        serial: qcom-geni: disable interrupts during console writes
        serial: qcom-geni: fix console corruption
        serial: qcom-geni: introduce qcom_geni_serial_poll_bitfield()
        serial: qcom-geni: fix arg types for qcom_geni_serial_poll_bit()
        soc: qcom: geni-se: add GP_LENGTH/IRQ_EN_SET/IRQ_EN_CLEAR registers
        serial: qcom-geni: fix false console tx restart
        serial: qcom-geni: fix fifo polling timeout
        tty: hvc: convert comma to semicolon
        mxser: convert comma to semicolon
        serial: 8250_bcm2835aux: Fix clock imbalance in PM resume
        serial: sc16is7xx: convert bitmask definitions to use BIT() macro
        serial: sc16is7xx: fix copy-paste errors in EFR_SWFLOWx_BIT constants
        serial: sc16is7xx: remove SC16IS7XX_MSR_DELTA_MASK
        serial: xilinx_uartps: Make cdns_rs485_supported static
        ...
      356a0319
    • Linus Torvalds's avatar
      Merge tag 'usb-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 4965ddb1
      Linus Torvalds authored
      Pull USB/Thunderbolt updates from Greg KH:
       "Here is the large set of USB and Thunderbolt changes for 6.12-rc1.
      
        Nothing "major" in here, except for a new 9p network gadget that has
        been worked on for a long time (all of the needed acks are here)
      
        Other than that, it's the usual set of:
      
         - Thunderbolt / USB4 driver updates and additions for new hardware
      
         - dwc3 driver updates and new features added
      
         - xhci driver updates
      
         - typec driver updates
      
         - USB gadget updates and api additions to make some gadgets more
           configurable by userspace
      
         - dwc2 driver updates
      
         - usb phy driver updates
      
         - usbip feature additions
      
         - other minor USB driver updates
      
        All of these have been in linux-next for a long time with no reported
        issues"
      
      * tag 'usb-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (145 commits)
        sub: cdns3: Use predefined PCI vendor ID constant
        sub: cdns2: Use predefined PCI vendor ID constant
        USB: misc: yurex: fix race between read and write
        USB: misc: cypress_cy7c63: check for short transfer
        USB: appledisplay: close race between probe and completion handler
        USB: class: CDC-ACM: fix race between get_serial and set_serial
        usb: r8a66597-hcd: make read-only const arrays static
        usb: typec: ucsi: Fix busy loop on ASUS VivoBooks
        usb: dwc3: rtk: Clean up error code in __get_dwc3_maximum_speed()
        usb: storage: ene_ub6250: Fix right shift warnings
        usb: roles: Improve the fix for a false positive recursive locking complaint
        locking/mutex: Introduce mutex_init_with_key()
        locking/mutex: Define mutex_init() once
        net/9p/usbg: fix CONFIG_USB_GADGET dependency
        usb: xhci: fix loss of data on Cadence xHC
        usb: xHCI: add XHCI_RESET_ON_RESUME quirk for Phytium xHCI host
        usb: dwc3: imx8mp: disable SS_CON and U3 wakeup for system sleep
        usb: dwc3: imx8mp: add 2 software managed quirk properties for host mode
        usb: host: xhci-plat: Parse xhci-missing_cas_quirk and apply quirk
        usb: misc: onboard_usb_dev: add Microchip usb5744 SMBus programming support
        ...
      4965ddb1
    • Linus Torvalds's avatar
      Merge tag 'hid-for-linus-2024092601' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid · 13882369
      Linus Torvalds authored
      Pull HID fix from Jiri Kosina:
       "A revert of Device Tree binding for Goodix SPI HID driver (while
        keeping ACPI still available), as it conflicted with already existing
        binding and the original submitter didn't respond in time with a fix.
      
        We will be looking into ways how to reintroduce it properly (we have
        to agree on a way how to handle cases where vendor uses the very same
        product ID for I2C and SPI parts, leading to this kind conflict). But
        before that is settled, let's revert the to unbreak everybody else
        (Krzysztof Kozlowski)"
      
      * tag 'hid-for-linus-2024092601' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
        dt-bindings: input: Revert "dt-bindings: input: Goodix SPI HID Touchscreen"
        HID: hid-goodix: drop unsupported and undocumented DT part
      13882369
    • Linus Torvalds's avatar
      Merge tag 'v6.12-rc-smb3-client-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6 · ac34bb40
      Linus Torvalds authored
      Pull smb client fixes from Steve French:
       "Most are from the recent SMB3.1.1 test event, and also an important
        netfs fix for a cifs mtime write regression
      
         - fix mode reported by stat of readonly directories and files
      
         - DFS (global namespace) related fixes
      
         - fixes for special file support via reparse points
      
         - mount improvement and reconnect fix
      
         - fix for noisy log message on umount
      
         - two netfs related fixes, one fixing a recent regression, and add
           new write tracepoint"
      
      * tag 'v6.12-rc-smb3-client-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6:
        netfs, cifs: Fix mtime/ctime update for mmapped writes
        cifs: update internal version number
        smb: client: print failed session logoffs with FYI
        cifs: Fix reversion of the iter in cifs_readv_receive().
        smb3: fix incorrect mode displayed for read-only files
        smb: client: fix parsing of device numbers
        smb: client: set correct device number on nfs reparse points
        smb: client: propagate error from cifs_construct_tcon()
        smb: client: fix DFS failover in multiuser mounts
        cifs: Make the write_{enter,done,err} tracepoints display netfs info
        smb: client: fix DFS interlink failover
        smb: client: improve purging of cached referrals
        smb: client: avoid unnecessary reconnects when refreshing referrals
      ac34bb40
    • Linus Torvalds's avatar
      Merge tag 'probes-v6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace · 5159938e
      Linus Torvalds authored
      Pull probes updates from Masami Hiramatsu:
      
       - uprobes: make trace_uprobe->nhit counter a per-CPU one
      
         This makes uprobe event's hit counter per-CPU for improving
         scalability on multi-core environment
      
       - kprobes: Remove obsoleted declaration for init_test_probes
      
         Remove unused init_test_probes() from header
      
       - Raw tracepoint probe supports raw tracepoint events on modules:
           - add a function for iterating over all tracepoints in all modules
           - add a function for iterating over tracepoints in a module
           - support raw tracepoint events on modules
           - support raw tracepoints on future loaded modules
           - add a test for tracepoint events on modules"
      
      * tag 'probes-v6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        sefltests/tracing: Add a test for tracepoint events on modules
        tracing/fprobe: Support raw tracepoints on future loaded modules
        tracing/fprobe: Support raw tracepoint events on modules
        tracepoint: Support iterating tracepoints in a loading module
        tracepoint: Support iterating over tracepoints on modules
        kprobes: Remove obsoleted declaration for init_test_probes
        uprobes: turn trace_uprobe's nhit counter to be per-CPU one
      5159938e
    • Linus Torvalds's avatar
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · 0181f8c8
      Linus Torvalds authored
      Pull virtio updates from Michael Tsirkin:
       "Several new features here:
      
         - virtio-balloon supports new stats
      
         - vdpa supports setting mac address
      
         - vdpa/mlx5 suspend/resume as well as MKEY ops are now faster
      
         - virtio_fs supports new sysfs entries for queue info
      
         - virtio/vsock performance has been improved
      
        And fixes, cleanups all over the place"
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (34 commits)
        vsock/virtio: avoid queuing packets when intermediate queue is empty
        vsock/virtio: refactor virtio_transport_send_pkt_work
        fw_cfg: Constify struct kobj_type
        vdpa/mlx5: Postpone MR deletion
        vdpa/mlx5: Introduce init/destroy for MR resources
        vdpa/mlx5: Rename mr_mtx -> lock
        vdpa/mlx5: Extract mr members in own resource struct
        vdpa/mlx5: Rename function
        vdpa/mlx5: Delete direct MKEYs in parallel
        vdpa/mlx5: Create direct MKEYs in parallel
        MAINTAINERS: add virtio-vsock driver in the VIRTIO CORE section
        virtio_fs: add sysfs entries for queue information
        virtio_fs: introduce virtio_fs_put_locked helper
        vdpa: Remove unused declarations
        vdpa/mlx5: Parallelize VQ suspend/resume for CVQ MQ command
        vdpa/mlx5: Small improvement for change_num_qps()
        vdpa/mlx5: Keep notifiers during suspend but ignore
        vdpa/mlx5: Parallelize device resume
        vdpa/mlx5: Parallelize device suspend
        vdpa/mlx5: Use async API for vq modify commands
        ...
      0181f8c8
    • Paolo Abeni's avatar
      Merge tag 'nf-24-09-26' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf · aef3a58b
      Paolo Abeni authored
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter fixes for net
      
      v2: with kdoc fixes per Paolo Abeni.
      
      The following patchset contains Netfilter fixes for net:
      
      Patch #1 and #2 handle an esoteric scenario: Given two tasks sending UDP
      packets to one another, two packets of the same flow in each direction
      handled by different CPUs that result in two conntrack objects in NEW
      state, where reply packet loses race. Then, patch #3 adds a testcase for
      this scenario. Series from Florian Westphal.
      
      1) NAT engine can falsely detect a port collision if it happens to pick
         up a reply packet as NEW rather than ESTABLISHED. Add extra code to
         detect this and suppress port reallocation in this case.
      
      2) To complete the clash resolution in the reply direction, extend conntrack
         logic to detect clashing conntrack in the reply direction to existing entry.
      
      3) Adds a test case.
      
      Then, an assorted list of fixes follow:
      
      4) Add a selftest for tproxy, from Antonio Ojea.
      
      5) Guard ctnetlink_*_size() functions under
         #if defined(CONFIG_NETFILTER_NETLINK_GLUE_CT) || defined(CONFIG_NF_CONNTRACK_EVENTS)
         From Andy Shevchenko.
      
      6) Use -m socket --transparent in iptables tproxy documentation.
         From XIE Zhibang.
      
      7) Call kfree_rcu() when releasing flowtable hooks to address race with
         netlink dump path, from Phil Sutter.
      
      8) Fix compilation warning in nf_reject with CONFIG_BRIDGE_NETFILTER=n.
         From Simon Horman.
      
      9) Guard ctnetlink_label_size() under CONFIG_NF_CONNTRACK_EVENTS which
         is its only user, to address a compilation warning. From Simon Horman.
      
      10) Use rcu-protected list iteration over basechain hooks from netlink
          dump path.
      
      11) Fix memcg for nf_tables, use GFP_KERNEL_ACCOUNT is not complete.
      
      12) Remove old nfqueue conntrack clash resolution. Instead trying to
          use same destination address consistently which requires double DNAT,
          use the existing clash resolution which allows clashing packets
          go through with different destination. Antonio Ojea originally
          reported an issue from the postrouting chain, I proposed a fix:
          https://lore.kernel.org/netfilter-devel/ZuwSwAqKgCB2a51-@calendula/T/
          which he reported it did not work for him.
      
      13) Adds a selftest for patch 12.
      
      14) Fixes ipvs.sh selftest.
      
      netfilter pull request 24-09-26
      
      * tag 'nf-24-09-26' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf:
        selftests: netfilter: Avoid hanging ipvs.sh
        kselftest: add test for nfqueue induced conntrack race
        netfilter: nfnetlink_queue: remove old clash resolution logic
        netfilter: nf_tables: missing objects with no memcg accounting
        netfilter: nf_tables: use rcu chain hook list iterator from netlink dump path
        netfilter: ctnetlink: compile ctnetlink_label_size with CONFIG_NF_CONNTRACK_EVENTS
        netfilter: nf_reject: Fix build warning when CONFIG_BRIDGE_NETFILTER=n
        netfilter: nf_tables: Keep deleted flowtable hooks until after RCU
        docs: tproxy: ignore non-transparent sockets in iptables
        netfilter: ctnetlink: Guard possible unused functions
        selftests: netfilter: nft_tproxy.sh: add tcp tests
        selftests: netfilter: add reverse-clash resolution test case
        netfilter: conntrack: add clash resolution for reverse collisions
        netfilter: nf_nat: don't try nat source port reallocation for reverse dir clash
      ====================
      
      Link: https://patch.msgid.link/20240926110717.102194-1-pablo@netfilter.orgSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      aef3a58b
    • Phil Sutter's avatar
      selftests: netfilter: Avoid hanging ipvs.sh · fc786304
      Phil Sutter authored
      If the client can't reach the server, the latter remains listening
      forever. Kill it after 5s of waiting.
      
      Fixes: 867d2190 ("selftests: netfilter: add ipvs test script")
      Signed-off-by: default avatarPhil Sutter <phil@nwl.cc>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      fc786304
    • Florian Westphal's avatar
      kselftest: add test for nfqueue induced conntrack race · e306e373
      Florian Westphal authored
      The netfilter race happens when two packets with the same tuple are DNATed
      and enqueued with nfqueue in the postrouting hook.
      
      Once one of the packet is reinjected it may be DNATed again to a different
      destination, but the conntrack entry remains the same and the return packet
      was dropped.
      
      Based on earlier patch from Antonio Ojea.
      
      Link: https://bugzilla.netfilter.org/show_bug.cgi?id=1766Co-developed-by: default avatarAntonio Ojea <aojea@google.com>
      Signed-off-by: default avatarAntonio Ojea <aojea@google.com>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      e306e373
    • Florian Westphal's avatar
      netfilter: nfnetlink_queue: remove old clash resolution logic · 8af79d3e
      Florian Westphal authored
      For historical reasons there are two clash resolution spots in
      netfilter, one in nfnetlink_queue and one in conntrack core.
      
      nfnetlink_queue one was added first: If a colliding entry is found, NAT
      NAT transformation is reversed by calling nat engine again with altered
      tuple.
      
      See commit 368982cd ("netfilter: nfnetlink_queue: resolve clash for
      unconfirmed conntracks") for details.
      
      One problem is that nf_reroute() won't take an action if the queueing
      doesn't occur in the OUTPUT hook, i.e. when queueing in forward or
      postrouting, packet will be sent via the wrong path.
      
      Another problem is that the scenario addressed (2nd UDP packet sent with
      identical addresses while first packet is still being processed) can also
      occur without any nfqueue involvement due to threaded resolvers doing
      A and AAAA requests back-to-back.
      
      This lead us to add clash resolution logic to the conntrack core, see
      commit 6a757c07 ("netfilter: conntrack: allow insertion of clashing
      entries").  Instead of fixing the nfqueue based logic, lets remove it
      and let conntrack core handle this instead.
      
      Retain the ->update hook for sake of nfqueue based conntrack helpers.
      We could axe this hook completely but we'd have to split confirm and
      helper logic again, see commit ee04805f ("netfilter: conntrack: make
      conntrack userspace helpers work again").
      
      This SHOULD NOT be backported to kernels earlier than v5.6; they lack
      adequate clash resolution handling.
      
      Patch was originally written by Pablo Neira Ayuso.
      Reported-by: default avatarAntonio Ojea <aojea@google.com>
      Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1766Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Tested-by: default avatarAntonio Ojea <aojea@google.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      8af79d3e
    • Pablo Neira Ayuso's avatar
      netfilter: nf_tables: missing objects with no memcg accounting · 69e687ce
      Pablo Neira Ayuso authored
      Several ruleset objects are still not using GFP_KERNEL_ACCOUNT for
      memory accounting, update them. This includes:
      
      - catchall elements
      - compat match large info area
      - log prefix
      - meta secctx
      - numgen counters
      - pipapo set backend datastructure
      - tunnel private objects
      
      Fixes: 33758c89 ("memcg: enable accounting for nft objects")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      69e687ce
    • Pablo Neira Ayuso's avatar
      netfilter: nf_tables: use rcu chain hook list iterator from netlink dump path · 4ffcf5ca
      Pablo Neira Ayuso authored
      Lockless iteration over hook list is possible from netlink dump path,
      use rcu variant to iterate over the hook list as is done with flowtable
      hooks.
      
      Fixes: b9703ed4 ("netfilter: nf_tables: support for adding new devices to an existing netdev chain")
      Reported-by: default avatarPhil Sutter <phil@nwl.cc>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      4ffcf5ca
    • Simon Horman's avatar
      netfilter: ctnetlink: compile ctnetlink_label_size with CONFIG_NF_CONNTRACK_EVENTS · e1f1ee0e
      Simon Horman authored
      Only provide ctnetlink_label_size when it is used,
      which is when CONFIG_NF_CONNTRACK_EVENTS is configured.
      
      Flagged by clang-18 W=1 builds as:
      
      .../nf_conntrack_netlink.c:385:19: warning: unused function 'ctnetlink_label_size' [-Wunused-function]
        385 | static inline int ctnetlink_label_size(const struct nf_conn *ct)
            |                   ^~~~~~~~~~~~~~~~~~~~
      
      The condition on CONFIG_NF_CONNTRACK_LABELS being removed by
      this patch guards compilation of non-trivial implementations
      of ctnetlink_dump_labels() and ctnetlink_label_size().
      
      However, this is not necessary as each of these functions
      will always return 0 if CONFIG_NF_CONNTRACK_LABELS is not defined
      as each function starts with the equivalent of:
      
      	struct nf_conn_labels *labels = nf_ct_labels_find(ct);
      
      	if (!labels)
      		return 0;
      
      And nf_ct_labels_find always returns NULL if CONFIG_NF_CONNTRACK_LABELS
      is not enabled.  So I believe that the compiler optimises the code away
      in such cases anyway.
      
      Found by inspection.
      Compile tested only.
      
      Originally splitted in two patches, Pablo Neira Ayuso collapsed them and
      added Fixes: tag.
      
      Fixes: 0ceabd83 ("netfilter: ctnetlink: deliver labels to userspace")
      Link: https://lore.kernel.org/netfilter-devel/20240909151712.GZ2097826@kernel.org/Signed-off-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      e1f1ee0e