1. Jan 06, 2023
    • Jakub Kicinski's avatar
      devlink: split out netlink code · 623cd13b
      Jakub Kicinski authored
      
      
      Move out the netlink glue into a separate file.
      Leave the ops in the old file because we'd have to export a ton
      of functions. Going forward we should switch to split ops which
      will let us to put the new ops in the netlink.c file.
      
      Pure code move, no functional changes.
      
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      623cd13b
    • Jakub Kicinski's avatar
      devlink: split out core code · 687125b5
      Jakub Kicinski authored
      
      
      Move core code into a separate file. It's spread around the main
      file which makes refactoring and figuring out how devlink works
      harder.
      
      Move the xarray, all the most core devlink instance code out like
      locking, ref counting, alloc, register, etc. Leave port stuff in
      leftover.c, if we want to move port code it'd probably be to its
      own file.
      
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      687125b5
    • Jakub Kicinski's avatar
      devlink: rename devlink_netdevice_event -> devlink_port_netdevice_event · e50ef40f
      Jakub Kicinski authored
      
      
      To make the upcoming change a pure(er?) code move rename
      devlink_netdevice_event -> devlink_port_netdevice_event.
      This makes it clear that it only touches ports and doesn't
      belong cleanly in the core.
      
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e50ef40f
    • Jakub Kicinski's avatar
      devlink: move code to a dedicated directory · f05bd8eb
      Jakub Kicinski authored
      
      
      The devlink code is hard to navigate with 13kLoC in one file.
      I really like the way Michal split the ethtool into per-command
      files and core. It'd probably be too much to split it all up,
      but we can at least separate the core parts out of the per-cmd
      implementations and put it in a directory so that new commands
      can be separate files.
      
      Move the code, subsequent commit will do a partial split.
      
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f05bd8eb
    • Jakub Kicinski's avatar
      Merge branch 'net-ipa-simplify-ipa-interrupt-handling' · 0da68553
      Jakub Kicinski authored
      Alex Elder says:
      
      ====================
      net: ipa: simplify IPA interrupt handling
      
      One of the IPA's two IRQs fires when data on a suspended channel is
      available (to request that the channel--or system--be resumed to
      recieve the pending data).  This interrupt also handles a few
      conditions signaled by the embedded microcontroller.
      
      For this "IPA interrupt", the current code requires a handler to be
      dynamically registered for each interrupt condition.  Any condition
      that has no registered handler is quietly ignored.  This design is
      derived from the downstream IPA driver implementation.
      
      There isn't any need for this complexity.  Even in the downstream
      code, only four of the available 30 or so IPA interrupt conditions
      are ever handled.  So these handlers can pretty easily just be
      called directly in the main IRQ handler function.
      
      This series simplifies the interrupt handling code by having the
      small number of IPA interrupt handlers be called directly, rather
      than having them be registered dynamically.
      
      Version 2 just adds a missing forward-reference, as suggested by
      Caleb.
      ====================
      
      Link: https://lore.kernel.org/r/20230104175233.2862874-1-elder@linaro.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      0da68553
    • Alex Elder's avatar
      net: ipa: don't maintain IPA interrupt handler array · bfb79854
      Alex Elder authored
      
      
      We can call the two IPA interrupt handler functions directly;
      there's no need to maintain the array of handler function pointers
      any more.
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      bfb79854
    • Alex Elder's avatar
      net: ipa: kill ipa_interrupt_add() · 8d8d3f1a
      Alex Elder authored
      
      
      The dynamic assignment of IPA interrupt handlers isn't needed; we
      only handle three IPA interrupt types, and their handler functions
      are now assigned directly.  We can get rid of ipa_interrupt_add()
      and ipa_interrupt_remove() now, because they serve no purpose.
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8d8d3f1a
    • Alex Elder's avatar
      net: ipa: register IPA interrupt handlers directly · 482ae3a9
      Alex Elder authored
      
      
      Declare the microcontroller IPA interrupt handler publicly, and
      assign it directly in ipa_interrupt_config().  Make the SUSPEND IPA
      interrupt handler public, and rename it ipa_power_suspend_handler().
      Assign it directly in ipa_interrupt_config() as well.
      
      This makes it unnecessary to do this in ipa_interrupt_add().  Make
      similar changes for removing IPA interrupt handlers.
      
      The next two patches will finish the cleanup, removing the
      add/remove functions and the handler array entirely.
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      482ae3a9
    • Alex Elder's avatar
      net: ipa: enable IPA interrupt handlers separate from registration · d50ed355
      Alex Elder authored
      
      
      Expose ipa_interrupt_enable() and have functions that register
      IPA interrupt handlers enable them directly, rather than having the
      registration process do that.  Do the same for disabling IPA
      interrupt handlers.
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d50ed355
    • Alex Elder's avatar
      net: ipa: introduce ipa_interrupt_enable() · 8e461e1f
      Alex Elder authored
      
      
      Create new function ipa_interrupt_enable() to encapsulate enabling
      one of the IPA interrupt types.  Introduce ipa_interrupt_disable()
      to reverse that operation.  Add a helper function to factor out the
      common register update used by both.
      
      Use these in ipa_interrupt_add() and ipa_interrupt_remove().
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8e461e1f
    • Alex Elder's avatar
      net: ipa: introduce a common microcontroller interrupt handler · e5709b7c
      Alex Elder authored
      
      
      The prototype for an IPA interrupt handler supplies the IPA
      interrupt ID, so it's possible to use a single function to handle
      any type of microcontroller interrupt.
      
      Introduce ipa_uc_interrupt_handler(), which calls the event or the
      response handler depending on the IRQ ID provided.  Register the new
      function as the handler for both microcontroller IPA interrupt types.
      
      The called functions don't use their "irq_id" arguments, so remove
      them.
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e5709b7c
    • Jakub Kicinski's avatar
      Merge branch 'enetc-unlock-xdp_redirect-for-xdp-non-linear-buffers' · afd50da9
      Jakub Kicinski authored
      Lorenzo Bianconi says:
      
      ====================
      enetc: unlock XDP_REDIRECT for XDP non-linear buffers
      
      Unlock XDP_REDIRECT for S/G XDP buffer and rely on XDP stack to properly
      take care of the frames.
      Rely on XDP_FLAGS_HAS_FRAGS flag to check if it really necessary to access
      non-linear part of the xdp_buff/xdp_frame.
      ====================
      
      Link: https://lore.kernel.org/r/cover.1672840490.git.lorenzo@kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      afd50da9
    • Lorenzo Bianconi's avatar
      net: ethernet: enetc: do not always access skb_shared_info in the XDP path · c7030d14
      Lorenzo Bianconi authored
      
      
      Move XDP skb_shared_info structure initialization in from
      enetc_map_rx_buff_to_xdp() to enetc_add_rx_buff_to_xdp() and do not always
      access skb_shared_info in the xdp_buff/xdp_frame since it is located in a
      different cacheline with respect to hard_start and data xdp pointers.
      Rely on XDP_FLAGS_HAS_FRAGS flag to check if it really necessary to access
      non-linear part of the xdp_buff/xdp_frame.
      
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Tested-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c7030d14
    • Lorenzo Bianconi's avatar
      net: ethernet: enetc: get rid of xdp_redirect_sg counter · 59cc773a
      Lorenzo Bianconi authored
      
      
      Remove xdp_redirect_sg counter and the related ethtool entry since it is
      no longer used.
      
      Tested-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      59cc773a
    • Lorenzo Bianconi's avatar
      net: ethernet: enetc: unlock XDP_REDIRECT for XDP non-linear buffers · 8feb020f
      Lorenzo Bianconi authored
      
      
      Even if full XDP_REDIRECT is not supported yet for non-linear XDP buffers
      since we allow redirecting just into CPUMAPs, unlock XDP_REDIRECT for
      S/G XDP buffer and rely on XDP stack to properly take care of the
      frames.
      
      Tested-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8feb020f
    • Jakub Kicinski's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 4aea86b4
      Jakub Kicinski authored
      
      
      No conflicts.
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      4aea86b4
    • Linus Torvalds's avatar
      Merge tag 'net-6.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 50011c32
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Including fixes from bpf, wifi, and netfilter.
      
        Current release - regressions:
      
         - bpf: fix nullness propagation for reg to reg comparisons, avoid
           null-deref
      
         - inet: control sockets should not use current thread task_frag
      
         - bpf: always use maximal size for copy_array()
      
         - eth: bnxt_en: don't link netdev to a devlink port for VFs
      
        Current release - new code bugs:
      
         - rxrpc: fix a couple of potential use-after-frees
      
         - netfilter: conntrack: fix IPv6 exthdr error check
      
         - wifi: iwlwifi: fw: skip PPAG for JF, avoid FW crashes
      
         - eth: dsa: qca8k: various fixes for the in-band register access
      
         - eth: nfp: fix schedule in atomic context when sync mc address
      
         - eth: renesas: rswitch: fix getting mac address from device tree
      
         - mobile: ipa: use proper endpoint mask for suspend
      
        Previous releases - regressions:
      
         - tcp: add TIME_WAIT sockets in bhash2, fix regression caught by
           Jiri / python tests
      
         - net: tc: don't intepret cls results when asked to drop, fix
           oob-access
      
         - vrf: determine the dst using the original ifindex for multicast
      
         - eth: bnxt_en:
            - fix XDP RX path if BPF adjusted packet length
            - fix HDS (header placement) and jumbo thresholds for RX packets
      
         - eth: ice: xsk: do not use xdp_return_frame() on tx_buf->raw_buf,
           avoid memory corruptions
      
        Previous releases - always broken:
      
         - ulp: prevent ULP without clone op from entering the LISTEN status
      
         - veth: fix race with AF_XDP exposing old or uninitialized
           descriptors
      
         - bpf:
            - pull before calling skb_postpull_rcsum() (fix checksum support
              and avoid a WARN())
            - fix panic due to wrong pageattr of im->image (when livepatch and
              kretfunc coexist)
            - keep a reference to the mm, in case the task is dead
      
         - mptcp: fix deadlock in fastopen error path
      
         - netfilter:
            - nf_tables: perform type checking for existing sets
            - nf_tables: honor set timeout and garbage collection updates
            - ipset: fix hash:net,port,net hang with /0 subnet
            - ipset: avoid hung task warning when adding/deleting entries
      
         - selftests: net:
            - fix cmsg_so_mark.sh test hang on non-x86 systems
            - fix the arp_ndisc_evict_nocarrier test for IPv6
      
         - usb: rndis_host: secure rndis_query check against int overflow
      
         - eth: r8169: fix dmar pte write access during suspend/resume with
           WOL
      
         - eth: lan966x: fix configuration of the PCS
      
         - eth: sparx5: fix reading of the MAC address
      
         - eth: qed: allow sleep in qed_mcp_trace_dump()
      
         - eth: hns3:
            - fix interrupts re-initialization after VF FLR
            - fix handling of promisc when MAC addr table gets full
            - refine the handling for VF heartbeat
      
         - eth: mlx5:
            - properly handle ingress QinQ-tagged packets on VST
            - fix io_eq_size and event_eq_size params validation on big endian
            - fix RoCE setting at HCA level if not supported at all
            - don't turn CQE compression on by default for IPoIB
      
         - eth: ena:
            - fix toeplitz initial hash key value
            - account for the number of XDP-processed bytes in interface stats
            - fix rx_copybreak value update
      
        Misc:
      
         - ethtool: harden phy stat handling against buggy drivers
      
         - docs: netdev: convert maintainer's doc from FAQ to a normal
           document"
      
      * tag 'net-6.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (112 commits)
        caif: fix memory leak in cfctrl_linkup_request()
        inet: control sockets should not use current thread task_frag
        net/ulp: prevent ULP without clone op from entering the LISTEN status
        qed: allow sleep in qed_mcp_trace_dump()
        MAINTAINERS: Update maintainers for ptp_vmw driver
        usb: rndis_host: Secure rndis_query check against int overflow
        net: dpaa: Fix dtsec check for PCS availability
        octeontx2-pf: Fix lmtst ID used in aura free
        drivers/net/bonding/bond_3ad: return when there's no aggregator
        netfilter: ipset: Rework long task execution when adding/deleting entries
        netfilter: ipset: fix hash:net,port,net hang with /0 subnet
        net: sparx5: Fix reading of the MAC address
        vxlan: Fix memory leaks in error path
        net: sched: htb: fix htb_classify() kernel-doc
        net: sched: cbq: dont intepret cls results when asked to drop
        net: sched: atm: dont intepret cls results when asked to drop
        dt-bindings: net: marvell,orion-mdio: Fix examples
        dt-bindings: net: sun8i-emac: Add phy-supply property
        net: ipa: use proper endpoint mask for suspend
        selftests: net: return non-zero for failures reported in arp_ndisc_evict_nocarrier
        ...
      50011c32
    • Linus Torvalds's avatar
      Merge tag 'gpio-fixes-for-v6.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux · aa01a183
      Linus Torvalds authored
      Pull gpio fixes from Bartosz Golaszewski:
       "A reference leak fix, two fixes for using uninitialized variables and
        more drivers converted to using immutable irqchips:
      
         - fix a reference leak in gpio-sifive
      
         - fix a potential use of an uninitialized variable in core gpiolib
      
         - fix a potential use of an uninitialized variable in gpio-pca953x
      
         - make GPIO irqchips immutable in gpio-pmic-eic-sprd, gpio-eic-sprd
           and gpio-sprd"
      
      * tag 'gpio-fixes-for-v6.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
        gpio: sifive: Fix refcount leak in sifive_gpio_probe
        gpio: sprd: Make the irqchip immutable
        gpio: pmic-eic-sprd: Make the irqchip immutable
        gpio: eic-sprd: Make the irqchip immutable
        gpio: pca953x: avoid to use uninitialized value pinctrl
        gpiolib: Fix using uninitialized lookup-flags on ACPI platforms
      aa01a183
    • Linus Torvalds's avatar
      Merge tag 'fbdev-for-6.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev · 5e9af4b4
      Linus Torvalds authored
      Pull fbdev fixes from Helge Deller:
      
       - Fix Matrox G200eW initialization failure
      
       - Fix build failure of offb driver when built as module
      
       - Optimize stack usage in omapfb
      
      * tag 'fbdev-for-6.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev:
        fbdev: omapfb: avoid stack overflow warning
        fbdev: matroxfb: G200eW: Increase max memory from 1 MB to 16 MB
        fbdev: atyfb: use strscpy() to instead of strncpy()
        fbdev: omapfb: use strscpy() to instead of strncpy()
        fbdev: make offb driver tristate
      5e9af4b4
  2. Jan 05, 2023
    • Paolo Abeni's avatar
      Merge branch 'add-support-for-qsgmii-mode-for-j721e-cpsw9g-to-am65-cpsw-driver' · 0471005e
      Paolo Abeni authored
      Siddharth Vadapalli says:
      
      ====================
      Add support for QSGMII mode for J721e CPSW9G to am65-cpsw driver
      
      Add compatible to am65-cpsw driver for J721e CPSW9G, which contains 8
      external ports and 1 internal host port.
      
      Add support to power on and power off the SERDES PHY which is used by the
      CPSW MAC.
      
      =========
      Changelog
      =========
      v5:
      https://lore.kernel.org/r/20221109042203.375042-1-s-vadapalli@ti.com/
      v4:
      https://lore.kernel.org/r/20221108080606.124596-1-s-vadapalli@ti.com/
      v3:
      https://lore.kernel.org/r/20221026090957.180592-1-s-vadapalli@ti.com/
      v2:
      https://lore.kernel.org/r/20221018085810.151327-1-s-vadapalli@ti.com/
      v1:
      https://lore.kernel.org/r/20220914095053.189851-1-s-vadapalli@ti.com/
      ====================
      
      Link: https://lore.kernel.org/r/20230104103432.1126403-1-s-vadapalli@ti.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      0471005e
    • Siddharth Vadapalli's avatar
      net: ethernet: ti: am65-cpsw: Add support for SERDES configuration · dab2b265
      Siddharth Vadapalli authored
      
      
      Use PHY framework APIs to initialize the SERDES PHY connected to CPSW MAC.
      
      Define the functions am65_cpsw_disable_phy(), am65_cpsw_enable_phy(),
      am65_cpsw_disable_serdes_phy() and am65_cpsw_enable_serdes_phy().
      
      Add new member "serdes_phy" to struct "am65_cpsw_slave_data" to store the
      SERDES PHY for each port, if it exists. Use it later while disabling the
      SERDES PHY for each port.
      
      Power on and initialize the SerDes PHY in am65_cpsw_nuss_init_slave_ports()
      by invoking am65_cpsw_enable_serdes_phy().
      
      Power off the SerDes PHY in am65_cpsw_nuss_remove() by invoking
      am65_cpsw_disable_serdes_phy().
      
      Signed-off-by: default avatarSiddharth Vadapalli <s-vadapalli@ti.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      dab2b265
    • Siddharth Vadapalli's avatar
      net: ethernet: ti: am65-cpsw: Enable QSGMII mode for J721e CPSW9G · 944131fa
      Siddharth Vadapalli authored
      
      
      CPSW9G in J721e supports additional modes like QSGMII.
      Add new compatible for J721e in am65-cpsw driver.
      
      Signed-off-by: default avatarSiddharth Vadapalli <s-vadapalli@ti.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      944131fa
    • Siddharth Vadapalli's avatar
      dt-bindings: net: ti: k3-am654-cpsw-nuss: Add J721e CPSW9G support · c85b53e3
      Siddharth Vadapalli authored
      
      
      Update bindings for TI K3 J721e SoC which contains 9 ports (8 external
      ports) CPSW9G module and add compatible for it.
      
      Changes made:
          - Add new compatible ti,j721e-cpswxg-nuss for CPSW9G.
          - Extend pattern properties for new compatible.
          - Change maximum number of CPSW ports to 8 for new compatible.
      
      Signed-off-by: default avatarSiddharth Vadapalli <s-vadapalli@ti.com>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      c85b53e3
    • Arnd Bergmann's avatar
      fbdev: omapfb: avoid stack overflow warning · 634cf6ea
      Arnd Bergmann authored
      
      
      The dsi_irq_stats structure is a little too big to fit on the
      stack of a 32-bit task, depending on the specific gcc options:
      
      fbdev/omap2/omapfb/dss/dsi.c: In function 'dsi_dump_dsidev_irqs':
      fbdev/omap2/omapfb/dss/dsi.c:1621:1: error: the frame size of 1064 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
      
      Since this is only a debugfs file, performance is not critical,
      so just dynamically allocate it, and print an error message
      in there in place of a failure code when the allocation fails.
      
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      634cf6ea
    • Zhengchao Shao's avatar
      caif: fix memory leak in cfctrl_linkup_request() · fe69230f
      Zhengchao Shao authored
      When linktype is unknown or kzalloc failed in cfctrl_linkup_request(),
      pkt is not released. Add release process to error path.
      
      Fixes: b482cd20 ("net-caif: add CAIF core protocol stack")
      Fixes: 8d545c8f
      
       ("caif: Disconnect without waiting for response")
      Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Link: https://lore.kernel.org/r/20230104065146.1153009-1-shaozhengchao@huawei.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      fe69230f
    • Eric Dumazet's avatar
      inet: control sockets should not use current thread task_frag · 1ac88557
      Eric Dumazet authored
      Because ICMP handlers run from softirq contexts,
      they must not use current thread task_frag.
      
      Previously, all sockets allocated by inet_ctl_sock_create()
      would use the per-socket page fragment, with no chance of
      recursion.
      
      Fixes: 98123866
      
       ("Treewide: Stop corrupting socket's task_frag")
      Reported-by: default avatar <syzbot+bebc6f1acdf4cbb79b03@syzkaller.appspotmail.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Benjamin Coddington <bcodding@redhat.com>
      Acked-by: default avatarGuillaume Nault <gnault@redhat.com>
      Link: https://lore.kernel.org/r/20230103192736.454149-1-edumazet@google.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1ac88557
    • Paolo Abeni's avatar
      net/ulp: prevent ULP without clone op from entering the LISTEN status · 2c02d41d
      Paolo Abeni authored
      When an ULP-enabled socket enters the LISTEN status, the listener ULP data
      pointer is copied inside the child/accepted sockets by sk_clone_lock().
      
      The relevant ULP can take care of de-duplicating the context pointer via
      the clone() operation, but only MPTCP and SMC implement such op.
      
      Other ULPs may end-up with a double-free at socket disposal time.
      
      We can't simply clear the ULP data at clone time, as TLS replaces the
      socket ops with custom ones assuming a valid TLS ULP context is
      available.
      
      Instead completely prevent clone-less ULP sockets from entering the
      LISTEN status.
      
      Fixes: 734942cc
      
       ("tcp: ULP infrastructure")
      Reported-by: default avatarslipper <slipper.alive@gmail.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Link: https://lore.kernel.org/r/4b80c3d1dbe3d0ab072f80450c202d9bc88b4b03.1672740602.git.pabeni@redhat.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2c02d41d
    • Caleb Sander's avatar
      qed: allow sleep in qed_mcp_trace_dump() · 5401c3e0
      Caleb Sander authored
      By default, qed_mcp_cmd_and_union() delays 10us at a time in a loop
      that can run 500K times, so calls to qed_mcp_nvm_rd_cmd()
      may block the current thread for over 5s.
      We observed thread scheduling delays over 700ms in production,
      with stacktraces pointing to this code as the culprit.
      
      qed_mcp_trace_dump() is called from ethtool, so sleeping is permitted.
      It already can sleep in qed_mcp_halt(), which calls qed_mcp_cmd().
      Add a "can sleep" parameter to qed_find_nvram_image() and
      qed_nvram_read() so they can sleep during qed_mcp_trace_dump().
      qed_mcp_trace_get_meta_info() and qed_mcp_trace_read_meta(),
      called only by qed_mcp_trace_dump(), allow these functions to sleep.
      I can't tell if the other caller (qed_grc_dump_mcp_hw_dump()) can sleep,
      so keep b_can_sleep set to false when it calls these functions.
      
      An example stacktrace from a custom warning we added to the kernel
      showing a thread that has not scheduled despite long needing resched:
      [ 2745.362925,17] ------------[ cut here ]------------
      [ 2745.362941,17] WARNING: CPU: 23 PID: 5640 at arch/x86/kernel/irq.c:233 do_IRQ+0x15e/0x1a0()
      [ 2745.362946,17] Thread not rescheduled for 744 ms after irq 99
      [ 2745.362956,17] Modules linked in: ...
      [ 2745.363339,17] CPU: 23 PID: 5640 Comm: lldpd Tainted: P           O    4.4.182+ #202104120910+6d1da174272d.61x
      [ 2745.363343,17] Hardware name: FOXCONN MercuryB/Quicksilver Controller, BIOS H11P1N09 07/08/2020
      [ 2745.363346,17]  0000000000000000 ffff885ec07c3ed8 ffffffff8131eb2f ffff885ec07c3f20
      [ 2745.363358,17]  ffffffff81d14f64 ffff885ec07c3f10 ffffffff81072ac2 ffff88be98ed0000
      [ 2745.363369,17]  0000000000000063 0000000000000174 0000000000000074 0000000000000000
      [ 2745.363379,17] Call Trace:
      [ 2745.363382,17]  <IRQ>  [<ffffffff8131eb2f>] dump_stack+0x8e/0xcf
      [ 2745.363393,17]  [<ffffffff81072ac2>] warn_slowpath_common+0x82/0xc0
      [ 2745.363398,17]  [<ffffffff81072b4c>] warn_slowpath_fmt+0x4c/0x50
      [ 2745.363404,17]  [<ffffffff810d5a8e>] ? rcu_irq_exit+0xae/0xc0
      [ 2745.363408,17]  [<ffffffff817c99fe>] do_IRQ+0x15e/0x1a0
      [ 2745.363413,17]  [<ffffffff817c7ac9>] common_interrupt+0x89/0x89
      [ 2745.363416,17]  <EOI>  [<ffffffff8132aa74>] ? delay_tsc+0x24/0x50
      [ 2745.363425,17]  [<ffffffff8132aa04>] __udelay+0x34/0x40
      [ 2745.363457,17]  [<ffffffffa04d45ff>] qed_mcp_cmd_and_union+0x36f/0x7d0 [qed]
      [ 2745.363473,17]  [<ffffffffa04d5ced>] qed_mcp_nvm_rd_cmd+0x4d/0x90 [qed]
      [ 2745.363490,17]  [<ffffffffa04e1dc7>] qed_mcp_trace_dump+0x4a7/0x630 [qed]
      [ 2745.363504,17]  [<ffffffffa04e2556>] ? qed_fw_asserts_dump+0x1d6/0x1f0 [qed]
      [ 2745.363520,17]  [<ffffffffa04e4ea7>] qed_dbg_mcp_trace_get_dump_buf_size+0x37/0x80 [qed]
      [ 2745.363536,17]  [<ffffffffa04ea881>] qed_dbg_feature_size+0x61/0xa0 [qed]
      [ 2745.363551,17]  [<ffffffffa04eb427>] qed_dbg_all_data_size+0x247/0x260 [qed]
      [ 2745.363560,17]  [<ffffffffa0482c10>] qede_get_regs_len+0x30/0x40 [qede]
      [ 2745.363566,17]  [<ffffffff816c9783>] ethtool_get_drvinfo+0xe3/0x190
      [ 2745.363570,17]  [<ffffffff816cc152>] dev_ethtool+0x1362/0x2140
      [ 2745.363575,17]  [<ffffffff8109bcc6>] ? finish_task_switch+0x76/0x260
      [ 2745.363580,17]  [<ffffffff817c2116>] ? __schedule+0x3c6/0x9d0
      [ 2745.363585,17]  [<ffffffff810dbd50>] ? hrtimer_start_range_ns+0x1d0/0x370
      [ 2745.363589,17]  [<ffffffff816c1e5b>] ? dev_get_by_name_rcu+0x6b/0x90
      [ 2745.363594,17]  [<ffffffff816de6a8>] dev_ioctl+0xe8/0x710
      [ 2745.363599,17]  [<ffffffff816a58a8>] sock_do_ioctl+0x48/0x60
      [ 2745.363603,17]  [<ffffffff816a5d87>] sock_ioctl+0x1c7/0x280
      [ 2745.363608,17]  [<ffffffff8111f393>] ? seccomp_phase1+0x83/0x220
      [ 2745.363612,17]  [<ffffffff811e3503>] do_vfs_ioctl+0x2b3/0x4e0
      [ 2745.363616,17]  [<ffffffff811e3771>] SyS_ioctl+0x41/0x70
      [ 2745.363619,17]  [<ffffffff817c6ffe>] entry_SYSCALL_64_fastpath+0x1e/0x79
      [ 2745.363622,17] ---[ end trace f6954aa440266421 ]---
      
      Fixes: c965db44
      
       ("qed: Add support for debug data collection")
      Signed-off-by: default avatarCaleb Sander <csander@purestorage.com>
      Acked-by: default avatarAlok Prasad <palok@marvell.com>
      Link: https://lore.kernel.org/r/20230103233021.1457646-1-csander@purestorage.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5401c3e0
    • Jakub Kicinski's avatar
      Merge tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next · d75858ef
      Jakub Kicinski authored
      Daniel Borkmann says:
      
      ====================
      bpf-next 2023-01-04
      
      We've added 45 non-merge commits during the last 21 day(s) which contain
      a total of 50 files changed, 1454 insertions(+), 375 deletions(-).
      
      The main changes are:
      
      1) Fixes, improvements and refactoring of parts of BPF verifier's
         state equivalence checks, from Andrii Nakryiko.
      
      2) Fix a few corner cases in libbpf's BTF-to-C converter in particular
         around padding handling and enums, also from Andrii Nakryiko.
      
      3) Add BPF_F_NO_TUNNEL_KEY extension to bpf_skb_set_tunnel_key to better
        support decap on GRE tunnel devices not operating in collect metadata,
        from Christian Ehrig.
      
      4) Improve x86 JIT's codegen for PROBE_MEM runtime error checks,
         from Dave Marchevsky.
      
      5) Remove the need for trace_printk_lock for bpf_trace_printk
         and bpf_trace_vprintk helpers, from Jiri Olsa.
      
      6) Add proper documentation for BPF_MAP_TYPE_SOCK{MAP,HASH} maps,
         from Maryam Tahhan.
      
      7) Improvements in libbpf's btf_parse_elf error handling, from Changbin Du.
      
      8) Bigger batch of improvements to BPF tracing code samples,
         from Daniel T. Lee.
      
      9) Add LoongArch support to libbpf's bpf_tracing helper header,
         from Hengqi Chen.
      
      10) Fix a libbpf compiler warning in perf_event_open_probe on arm32,
          from Khem Raj.
      
      11) Optimize bpf_local_storage_elem by removing 56 bytes of padding,
          from Martin KaFai Lau.
      
      12) Use pkg-config to locate libelf for resolve_btfids build,
          from Shen Jiamin.
      
      13) Various libbpf improvements around API documentation and errno
          handling, from Xin Liu.
      
      * tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (45 commits)
        libbpf: Return -ENODATA for missing btf section
        libbpf: Add LoongArch support to bpf_tracing.h
        libbpf: Restore errno after pr_warn.
        libbpf: Added the description of some API functions
        libbpf: Fix invalid return address register in s390
        samples/bpf: Use BPF_KSYSCALL macro in syscall tracing programs
        samples/bpf: Fix tracex2 by using BPF_KSYSCALL macro
        samples/bpf: Change _kern suffix to .bpf with syscall tracing program
        samples/bpf: Use vmlinux.h instead of implicit headers in syscall tracing program
        samples/bpf: Use kyscall instead of kprobe in syscall tracing program
        bpf: rename list_head -> graph_root in field info types
        libbpf: fix errno is overwritten after being closed.
        bpf: fix regs_exact() logic in regsafe() to remap IDs correctly
        bpf: perform byte-by-byte comparison only when necessary in regsafe()
        bpf: reject non-exact register type matches in regsafe()
        bpf: generalize MAYBE_NULL vs non-MAYBE_NULL rule
        bpf: reorganize struct bpf_reg_state fields
        bpf: teach refsafe() to take into account ID remapping
        bpf: Remove unused field initialization in bpf's ctl_table
        selftests/bpf: Add jit probe_mem corner case tests to s390x denylist
        ...
      ====================
      
      Link: https://lore.kernel.org/r/20230105000926.31350-1-daniel@iogearbox.net
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d75858ef
    • Jakub Kicinski's avatar
      Merge tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf · 49d9601b
      Jakub Kicinski authored
      Alexei Starovoitov says:
      
      ====================
      bpf 2023-01-04
      
      We've added 5 non-merge commits during the last 8 day(s) which contain
      a total of 5 files changed, 112 insertions(+), 18 deletions(-).
      
      The main changes are:
      
      1) Always use maximal size for copy_array in the verifier to fix
         KASAN tracking, from Kees.
      
      2) Fix bpf task iterator walking through dead tasks, from Kui-Feng.
      
      3) Make sure livepatch and bpf fexit can coexist, from Chuang.
      
      * tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf:
        bpf: Always use maximal size for copy_array()
        selftests/bpf: add a test for iter/task_vma for short-lived processes
        bpf: keep a reference to the mm, in case the task is dead.
        selftests/bpf: Temporarily disable part of btf_dump:var_data test.
        bpf: Fix panic due to wrong pageattr of im->image
      ====================
      
      Link: https://lore.kernel.org/r/20230104215500.79435-1-alexei.starovoitov@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      49d9601b
    • Linus Torvalds's avatar
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · 41c03ba9
      Linus Torvalds authored
      Pull virtio updates from Michael Tsirkin:
       "Mostly fixes all over the place, a couple of cleanups"
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (32 commits)
        virtio_blk: Fix signedness bug in virtblk_prep_rq()
        vdpa_sim_net: should not drop the multicast/broadcast packet
        vdpasim: fix memory leak when freeing IOTLBs
        vdpa: conditionally fill max max queue pair for stats
        vdpa/vp_vdpa: fix kfree a wrong pointer in vp_vdpa_remove
        vduse: Validate vq_num in vduse_validate_config()
        tools/virtio: remove smp_read_barrier_depends()
        tools/virtio: remove stray characters
        vhost_vdpa: fix the crash in unmap a large memory
        virtio: Implementing attribute show with sysfs_emit
        virtio-crypto: fix memory leak in virtio_crypto_alg_skcipher_close_session()
        tools/virtio: Variable type completion
        vdpa_sim: fix vringh initialization in vdpasim_queue_ready()
        virtio_blk: use UINT_MAX instead of -1U
        vhost-vdpa: fix an iotlb memory leak
        vhost: fix range used in translate_desc()
        vringh: fix range used in iotlb_translate()
        vhost/vsock: Fix error handling in vhost_vsock_init()
        vdpa_sim: fix possible memory leak in vdpasim_net_init() and vdpasim_blk_init()
        tools: Delete the unneeded semicolon after curly braces
        ...
      41c03ba9
    • Linus Torvalds's avatar
      Merge tag 'x86-urgent-2023-01-04' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 512dee0c
      Linus Torvalds authored
      Pull misc x86 fixes from Ingo Molnar:
       "Fix a double-free bug, a binutils warning, a header namespace clash
        and a bug in ib_prctl_set()"
      
      * tag 'x86-urgent-2023-01-04' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/bugs: Flush IBP in ib_prctl_set()
        x86/insn: Avoid namespace clash by separating instruction decoder MMIO type from MMIO trace type
        x86/asm: Fix an assembler warning with current binutils
        x86/kexec: Fix double-free of elf header buffer
      512dee0c
    • Linus Torvalds's avatar
      Merge tag 'f2fs-fix-6.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs · 2ac44821
      Linus Torvalds authored
      Pull f2fs fixes from Jaegeuk Kim:
      
       - fix a null pointer dereference in f2fs_issue_flush, which occurs by
         the combination of mount/remount options.
      
       - fix a bug in per-block age-based extent_cache newly introduced in
         6.2-rc1, which reported a wrong age information in extent_cache.
      
       - fix a kernel panic if extent_tree was not created, which was caught
         by a wrong BUG_ON
      
      * tag 'f2fs-fix-6.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs:
        f2fs: let's avoid panic if extent_tree is not created
        f2fs: should use a temp extent_info for lookup
        f2fs: don't mix to use union values in extent_info
        f2fs: initialize extent_cache parameter
        f2fs: fix to avoid NULL pointer dereference in f2fs_issue_flush()
      2ac44821
    • Linus Torvalds's avatar
      Merge tag 'nfsd-6.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux · b61778fa
      Linus Torvalds authored
      Pull nfsd fixes from Chuck Lever:
      
       - Fix a filecache UAF during NFSD shutdown
      
       - Avoid exposing automounted mounts on NFS re-exports
      
      * tag 'nfsd-6.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux:
        nfsd: fix handling of readdir in v4root vs. mount upcall timeout
        nfsd: shut down the NFSv4 state objects before the filecache
      b61778fa
  3. Jan 04, 2023