1. 18 11月, 2022 10 次提交
    • D
      rxrpc: Fix race between conn bundle lookup and bundle removal [ZDI-CAN-15975] · 3bcd6c7e
      David Howells 提交于
      After rxrpc_unbundle_conn() has removed a connection from a bundle, it
      checks to see if there are any conns with available channels and, if not,
      removes and attempts to destroy the bundle.
      
      Whilst it does check after grabbing client_bundles_lock that there are no
      connections attached, this races with rxrpc_look_up_bundle() retrieving the
      bundle, but not attaching a connection for the connection to be attached
      later.
      
      There is therefore a window in which the bundle can get destroyed before we
      manage to attach a new connection to it.
      
      Fix this by adding an "active" counter to struct rxrpc_bundle:
      
       (1) rxrpc_connect_call() obtains an active count by prepping/looking up a
           bundle and ditches it before returning.
      
       (2) If, during rxrpc_connect_call(), a connection is added to the bundle,
           this obtains an active count, which is held until the connection is
           discarded.
      
       (3) rxrpc_deactivate_bundle() is created to drop an active count on a
           bundle and destroy it when the active count reaches 0.  The active
           count is checked inside client_bundles_lock() to prevent a race with
           rxrpc_look_up_bundle().
      
       (4) rxrpc_unbundle_conn() then calls rxrpc_deactivate_bundle().
      
      Fixes: 245500d8 ("rxrpc: Rewrite the client connection manager")
      Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-15975
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Tested-by: zdi-disclosures@trendmicro.com
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3bcd6c7e
    • W
      selftests/net: fix missing xdp_dummy · 302e57f8
      Wang Yufen 提交于
      After commit afef88e6 ("selftests/bpf: Store BPF object files with
      .bpf.o extension"), we should use xdp_dummy.bpf.o instade of xdp_dummy.o.
      
      In addition, use the BPF_FILE variable to save the BPF object file name,
      which can be better identified and modified.
      
      Fixes: afef88e6 ("selftests/bpf: Store BPF object files with .bpf.o extension")
      Signed-off-by: NWang Yufen <wangyufen@huawei.com>
      Cc: Daniel Müller <deso@posteo.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      302e57f8
    • M
      ipvlan: hold lower dev to avoid possible use-after-free · 40b9d1ab
      Mahesh Bandewar 提交于
      Recently syzkaller discovered the issue of disappearing lower
      device (NETDEV_UNREGISTER) while the virtual device (like
      macvlan) is still having it as a lower device. So it's just
      a matter of time similar discovery will be made for IPvlan
      device setup. So fixing it preemptively. Also while at it,
      add a refcount tracker.
      
      Fixes: 2ad7bf36 ("ipvlan: Initial check-in of the IPVLAN driver.")
      Signed-off-by: NMahesh Bandewar <maheshb@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      40b9d1ab
    • T
      net: neigh: decrement the family specific qlen · 8207f253
      Thomas Zeitlhofer 提交于
      Commit 0ff4eb3d ("neighbour: make proxy_queue.qlen limit
      per-device") introduced the length counter qlen in struct neigh_parms.
      There are separate neigh_parms instances for IPv4/ARP and IPv6/ND, and
      while the family specific qlen is incremented in pneigh_enqueue(), the
      mentioned commit decrements always the IPv4/ARP specific qlen,
      regardless of the currently processed family, in pneigh_queue_purge()
      and neigh_proxy_process().
      
      As a result, with IPv6/ND, the family specific qlen is only incremented
      (and never decremented) until it exceeds PROXY_QLEN, and then, according
      to the check in pneigh_enqueue(), neighbor solicitations are not
      answered anymore. As an example, this is noted when using the
      subnet-router anycast address to access a Linux router. After a certain
      amount of time (in the observed case, qlen exceeded PROXY_QLEN after two
      days), the Linux router stops answering neighbor solicitations for its
      subnet-router anycast address and effectively becomes unreachable.
      
      Another result with IPv6/ND is that the IPv4/ARP specific qlen is
      decremented more often than incremented. This leads to negative qlen
      values, as a signed integer has been used for the length counter qlen,
      and potentially to an integer overflow.
      
      Fix this by introducing the helper function neigh_parms_qlen_dec(),
      which decrements the family specific qlen. Thereby, make use of the
      existing helper function neigh_get_dev_parms_rcu(), whose definition
      therefore needs to be placed earlier in neighbour.c. Take the family
      member from struct neigh_table to determine the currently processed
      family and appropriately call neigh_parms_qlen_dec() from
      pneigh_queue_purge() and neigh_proxy_process().
      
      Additionally, use an unsigned integer for the length counter qlen.
      
      Fixes: 0ff4eb3d ("neighbour: make proxy_queue.qlen limit per-device")
      Signed-off-by: NThomas Zeitlhofer <thomas.zeitlhofer+lkml@ze-it.at>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8207f253
    • L
      net: liquidio: simplify if expression · 733d4bbf
      Leon Romanovsky 提交于
      Fix the warning reported by kbuild:
      
      cocci warnings: (new ones prefixed by >>)
      >> drivers/net/ethernet/cavium/liquidio/lio_main.c:1797:54-56: WARNING !A || A && B is equivalent to !A || B
         drivers/net/ethernet/cavium/liquidio/lio_main.c:1827:54-56: WARNING !A || A && B is equivalent to !A || B
      
      Fixes: 8979f428 ("net: liquidio: release resources when liquidio driver open failed")
      Reported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NLeon Romanovsky <leonro@nvidia.com>
      Reviewed-by: NSaeed Mahameed <saeed@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      733d4bbf
    • J
      Merge branch 'mptcp-selftests-fix-timeouts-and-test-isolation' · 11b64a46
      Jakub Kicinski 提交于
      Mat Martineau says:
      
      ====================
      mptcp: selftests: Fix timeouts and test isolation
      
      Patches 1 and 3 adjust test timeouts to reduce false negatives on slow
      machines.
      
      Patch 2 improves test isolation by running the mptcp_sockopt test in its
      own net namespace.
      ====================
      
      Link: https://lore.kernel.org/r/20221115221046.20370-1-mathew.j.martineau@linux.intel.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      11b64a46
    • M
      selftests: mptcp: fix mibit vs mbit mix up · 3de88b95
      Matthieu Baerts 提交于
      The estimated time was supposing the rate was expressed in mibit
      (bit * 1024^2) but it is in mbit (bit * 1000^2).
      
      This makes the threshold higher but in a more realistic way to avoid
      false positives reported by CI instances.
      
      Before this patch, the thresholds were at 7561/4005ms and now they are
      at 7906/4178ms.
      
      While at it, also fix a typo in the linked comment, spotted by Mat.
      
      Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/310
      Fixes: 1a418cb8 ("mptcp: simult flow self-tests")
      Suggested-by: NPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      3de88b95
    • M
      selftests: mptcp: run mptcp_sockopt from a new netns · 7e68d310
      Matthieu Baerts 提交于
      Not running it from a new netns causes issues if some MPTCP settings are
      modified, e.g. if MPTCP is disabled from the sysctl knob, if multiple
      addresses are available and added to the MPTCP path-manager, etc.
      
      In these cases, the created connection will not behave as expected, e.g.
      unable to create an MPTCP socket, more than one subflow is seen, etc.
      
      A new "sandbox" net namespace is now created and used to run
      mptcp_sockopt from this controlled environment.
      
      Fixes: ce997912 ("selftests: mptcp: add mptcp getsockopt test cases")
      Reviewed-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      7e68d310
    • P
      selftests: mptcp: gives slow test-case more time · 22b29557
      Paolo Abeni 提交于
      On slow or busy VM, some test-cases still fail because the
      data transfer completes before the endpoint manipulation
      actually took effect.
      
      Address the issue by artificially increasing the runtime for
      the relevant test-cases.
      
      Fixes: ef360019 ("selftests: mptcp: signal addresses testcases")
      Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/309Reviewed-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      22b29557
    • L
      Merge tag 'net-6.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 847ccab8
      Linus Torvalds 提交于
      Pull networking fixes from Paolo Abeni:
       "Including fixes from bpf.
      
        Current release - regressions:
      
         - tls: fix memory leak in tls_enc_skb() and tls_sw_fallback_init()
      
        Previous releases - regressions:
      
         - bridge: fix memory leaks when changing VLAN protocol
      
         - dsa: make dsa_master_ioctl() see through port_hwtstamp_get() shims
      
         - dsa: don't leak tagger-owned storage on switch driver unbind
      
         - eth: mlxsw: avoid warnings when not offloaded FDB entry with IPv6
           is removed
      
         - eth: stmmac: ensure tx function is not running in
           stmmac_xdp_release()
      
         - eth: hns3: fix return value check bug of rx copybreak
      
        Previous releases - always broken:
      
         - kcm: close race conditions on sk_receive_queue
      
         - bpf: fix alignment problem in bpf_prog_test_run_skb()
      
         - bpf: fix writing offset in case of fault in
           strncpy_from_kernel_nofault
      
         - eth: macvlan: use built-in RCU list checking
      
         - eth: marvell: add sleep time after enabling the loopback bit
      
         - eth: octeon_ep: fix potential memory leak in octep_device_setup()
      
        Misc:
      
         - tcp: configurable source port perturb table size
      
         - bpf: Convert BPF_DISPATCHER to use static_call() (not ftrace)"
      
      * tag 'net-6.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (51 commits)
        net: use struct_group to copy ip/ipv6 header addresses
        net: usb: smsc95xx: fix external PHY reset
        net: usb: qmi_wwan: add Telit 0x103a composition
        netdevsim: Fix memory leak of nsim_dev->fa_cookie
        tcp: configurable source port perturb table size
        l2tp: Serialize access to sk_user_data with sk_callback_lock
        net: thunderbolt: Fix error handling in tbnet_init()
        net: microchip: sparx5: Fix potential null-ptr-deref in sparx_stats_init() and sparx5_start()
        net: lan966x: Fix potential null-ptr-deref in lan966x_stats_init()
        net: dsa: don't leak tagger-owned storage on switch driver unbind
        net/x25: Fix skb leak in x25_lapb_receive_frame()
        net: ag71xx: call phylink_disconnect_phy if ag71xx_hw_enable() fail in ag71xx_open()
        bridge: switchdev: Fix memory leaks when changing VLAN protocol
        net: hns3: fix setting incorrect phy link ksettings for firmware in resetting process
        net: hns3: fix return value check bug of rx copybreak
        net: hns3: fix incorrect hw rss hash type of rx packet
        net: phy: marvell: add sleep time after enabling the loopback bit
        net: ena: Fix error handling in ena_init()
        kcm: close race conditions on sk_receive_queue
        net: ionic: Fix error handling in ionic_init_module()
        ...
      847ccab8
  2. 17 11月, 2022 7 次提交
    • H
      net: use struct_group to copy ip/ipv6 header addresses · 58e0be1e
      Hangbin Liu 提交于
      kernel test robot reported warnings when build bonding module with
      make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/net/bonding/:
      
                       from ../drivers/net/bonding/bond_main.c:35:
      In function ‘fortify_memcpy_chk’,
          inlined from ‘iph_to_flow_copy_v4addrs’ at ../include/net/ip.h:566:2,
          inlined from ‘bond_flow_ip’ at ../drivers/net/bonding/bond_main.c:3984:3:
      ../include/linux/fortify-string.h:413:25: warning: call to ‘__read_overflow2_field’ declared with attribute warning: detected read beyond size of f
      ield (2nd parameter); maybe use struct_group()? [-Wattribute-warning]
        413 |                         __read_overflow2_field(q_size_field, size);
            |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      In function ‘fortify_memcpy_chk’,
          inlined from ‘iph_to_flow_copy_v6addrs’ at ../include/net/ipv6.h:900:2,
          inlined from ‘bond_flow_ip’ at ../drivers/net/bonding/bond_main.c:3994:3:
      ../include/linux/fortify-string.h:413:25: warning: call to ‘__read_overflow2_field’ declared with attribute warning: detected read beyond size of f
      ield (2nd parameter); maybe use struct_group()? [-Wattribute-warning]
        413 |                         __read_overflow2_field(q_size_field, size);
            |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      This is because we try to copy the whole ip/ip6 address to the flow_key,
      while we only point the to ip/ip6 saddr. Note that since these are UAPI
      headers, __struct_group() is used to avoid the compiler warnings.
      Reported-by: Nkernel test robot <lkp@intel.com>
      Fixes: c3f83241 ("net: Add full IPv6 addresses to flow_keys")
      Signed-off-by: NHangbin Liu <liuhangbin@gmail.com>
      Link: https://lore.kernel.org/r/20221115142400.1204786-1-liuhangbin@gmail.comSigned-off-by: NPaolo Abeni <pabeni@redhat.com>
      58e0be1e
    • A
      net: usb: smsc95xx: fix external PHY reset · 809ff97a
      Alexandru Tachici 提交于
      An external PHY needs settling time after power up or reset.
      In the bind() function an mdio bus is registered. If at this point
      the external PHY is still initialising, no valid PHY ID will be
      read and on phy_find_first() the bind() function will fail.
      
      If an external PHY is present, wait the maximum time specified
      in 802.3 45.2.7.1.1.
      
      Fixes: 05b35e7e ("smsc95xx: add phylib support")
      Signed-off-by: NAlexandru Tachici <alexandru.tachici@analog.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20221115114434.9991-2-alexandru.tachici@analog.comSigned-off-by: NPaolo Abeni <pabeni@redhat.com>
      809ff97a
    • E
      net: usb: qmi_wwan: add Telit 0x103a composition · e103ba33
      Enrico Sau 提交于
      Add the following Telit LE910C4-WWX composition:
      
      0x103a: rmnet
      Signed-off-by: NEnrico Sau <enrico.sau@gmail.com>
      Acked-by: NBjørn Mork <bjorn@mork.no>
      Link: https://lore.kernel.org/r/20221115105859.14324-1-enrico.sau@gmail.comSigned-off-by: NPaolo Abeni <pabeni@redhat.com>
      e103ba33
    • W
      netdevsim: Fix memory leak of nsim_dev->fa_cookie · 064bc731
      Wang Yufen 提交于
      kmemleak reports this issue:
      
      unreferenced object 0xffff8881bac872d0 (size 8):
        comm "sh", pid 58603, jiffies 4481524462 (age 68.065s)
        hex dump (first 8 bytes):
          04 00 00 00 de ad be ef                          ........
        backtrace:
          [<00000000c80b8577>] __kmalloc+0x49/0x150
          [<000000005292b8c6>] nsim_dev_trap_fa_cookie_write+0xc1/0x210 [netdevsim]
          [<0000000093d78e77>] full_proxy_write+0xf3/0x180
          [<000000005a662c16>] vfs_write+0x1c5/0xaf0
          [<000000007aabf84a>] ksys_write+0xed/0x1c0
          [<000000005f1d2e47>] do_syscall_64+0x3b/0x90
          [<000000006001c6ec>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      The issue occurs in the following scenarios:
      
      nsim_dev_trap_fa_cookie_write()
        kmalloc() fa_cookie
        nsim_dev->fa_cookie = fa_cookie
      ..
      nsim_drv_remove()
      
      The fa_cookie allocked in nsim_dev_trap_fa_cookie_write() is not freed. To
      fix, add kfree(nsim_dev->fa_cookie) to nsim_drv_remove().
      
      Fixes: d3cbb907 ("netdevsim: add ACL trap reporting cookie as a metadata")
      Signed-off-by: NWang Yufen <wangyufen@huawei.com>
      Cc: Jiri Pirko <jiri@mellanox.com>
      Link: https://lore.kernel.org/r/1668504625-14698-1-git-send-email-wangyufen@huawei.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      064bc731
    • L
      Merge tag 'for-linus-6.1-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · cc675d22
      Linus Torvalds 提交于
      Pull xen fixes from Juergen Gross:
       "Two trivial cleanups, and three simple fixes"
      
      * tag 'for-linus-6.1-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen/platform-pci: use define instead of literal number
        xen/platform-pci: add missing free_irq() in error path
        xen-pciback: Allow setting PCI_MSIX_FLAGS_MASKALL too
        xen/pcpu: fix possible memory leak in register_pcpu()
        x86/xen: Use kstrtobool() instead of strtobool()
      cc675d22
    • L
      Merge tag 'pinctrl-v6.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · 31c9c4c5
      Linus Torvalds 提交于
      Pull pin control fixes from Linus Walleij:
       "Aere is a hopefully final round of pin control fixes. Nothing special,
        driver fixes and we caught a potential NULL pointer exception.
      
         - Fix a potential NULL dereference in the core!
      
         - Fix all pin mux routes in the Rockchop PX30 driver
      
         - Fix the UFS pins in the Qualcomm SC8280XP driver
      
         - Fix bias disabling in the Mediatek driver
      
         - Fix debounce time settings in the Mediatek driver"
      
      * tag 'pinctrl-v6.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        pinctrl: mediatek: Export debounce time tables
        pinctrl: mediatek: Fix EINT pins input debounce time configuration
        pinctrl: devicetree: fix null pointer dereferencing in pinctrl_dt_to_map
        pinctrl: mediatek: common-v2: Fix bias-disable for PULL_PU_PD_RSEL_TYPE
        pinctrl: qcom: sc8280xp: Rectify UFS reset pins
        pinctrl: rockchip: list all pins in a possible mux route for PX30
      31c9c4c5
    • L
      Merge tag 'platform-drivers-x86-v6.1-4' of... · 941209ef
      Linus Torvalds 提交于
      Merge tag 'platform-drivers-x86-v6.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
      
      Pull x86 platform driver fixes from Hans de Goede:
      
       - Surface Pro 9 and Surface Laptop 5 kbd, battery, etc support (this
         is just a few hw-id additions)
      
       - A couple of other hw-id / DMI-quirk additions
      
       - A few small bug fixes + 1 build fix
      
      * tag 'platform-drivers-x86-v6.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
        platform/x86: ideapad-laptop: Add module parameters to match DMI quirk tables
        platform/x86: ideapad-laptop: Fix interrupt storm on fn-lock toggle on some Yoga laptops
        platform/x86: hp-wmi: Ignore Smart Experience App event
        platform/surface: aggregator_registry: Add support for Surface Laptop 5
        platform/surface: aggregator_registry: Add support for Surface Pro 9
        platform/surface: aggregator: Do not check for repeated unsequenced packets
        platform/x86: acer-wmi: Enable SW_TABLET_MODE on Switch V 10 (SW5-017)
        platform/x86: asus-wmi: add missing pci_dev_put() in asus_wmi_set_xusb2pr()
        platform/x86/intel: pmc: Don't unconditionally attach Intel PMC when virtualized
        platform/x86: thinkpad_acpi: Enable s2idle quirk for 21A1 machine type
        platform/x86/amd: pmc: Add new ACPI ID AMDI0009
        platform/x86/amd: pmc: Remove more CONFIG_DEBUG_FS checks
      941209ef
  3. 16 11月, 2022 22 次提交
  4. 15 11月, 2022 1 次提交