1. 08 2月, 2023 2 次提交
  2. 30 1月, 2023 1 次提交
  3. 25 1月, 2023 1 次提交
    • J
      bpf, sockmap: Check for any of tcp_bpf_prots when cloning a listener · ddce1e09
      Jakub Sitnicki 提交于
      A listening socket linked to a sockmap has its sk_prot overridden. It
      points to one of the struct proto variants in tcp_bpf_prots. The variant
      depends on the socket's family and which sockmap programs are attached.
      
      A child socket cloned from a TCP listener initially inherits their sk_prot.
      But before cloning is finished, we restore the child's proto to the
      listener's original non-tcp_bpf_prots one. This happens in
      tcp_create_openreq_child -> tcp_bpf_clone.
      
      Today, in tcp_bpf_clone we detect if the child's proto should be restored
      by checking only for the TCP_BPF_BASE proto variant. This is not
      correct. The sk_prot of listening socket linked to a sockmap can point to
      to any variant in tcp_bpf_prots.
      
      If the listeners sk_prot happens to be not the TCP_BPF_BASE variant, then
      the child socket unintentionally is left if the inherited sk_prot by
      tcp_bpf_clone.
      
      This leads to issues like infinite recursion on close [1], because the
      child state is otherwise not set up for use with tcp_bpf_prot operations.
      
      Adjust the check in tcp_bpf_clone to detect all of tcp_bpf_prots variants.
      
      Note that it wouldn't be sufficient to check the socket state when
      overriding the sk_prot in tcp_bpf_update_proto in order to always use the
      TCP_BPF_BASE variant for listening sockets. Since commit
      b8b8315e ("bpf, sockmap: Remove unhash handler for BPF sockmap usage")
      it is possible for a socket to transition to TCP_LISTEN state while already
      linked to a sockmap, e.g. connect() -> insert into map ->
      connect(AF_UNSPEC) -> listen().
      
      [1]: https://lore.kernel.org/all/00000000000073b14905ef2e7401@google.com/
      
      Fixes: e8025155 ("tcp_bpf: Don't let child socket inherit parent protocol ops on copy")
      Reported-by: syzbot+04c21ed96d861dccc5cd@syzkaller.appspotmail.com
      Signed-off-by: NJakub Sitnicki <jakub@cloudflare.com>
      Acked-by: NJohn Fastabend <john.fastabend@gmail.com>
      Link: https://lore.kernel.org/r/20230113-sockmap-fix-v2-2-1e0ee7ac2f90@cloudflare.comSigned-off-by: NAlexei Starovoitov <ast@kernel.org>
      ddce1e09
  4. 24 1月, 2023 2 次提交
  5. 20 1月, 2023 1 次提交
    • A
      firmware: zynqmp: fix declarations for gcc-13 · d2c86555
      Arnd Bergmann 提交于
      gcc-13.0.1 reports a type mismatch for two functions:
      
      drivers/firmware/xilinx/zynqmp.c:1228:5: error: conflicting types for 'zynqmp_pm_set_rpu_mode' due to enum/integer mismatch; have 'int(u32,  enum rpu_oper_mode)' {aka 'int(unsigned int,  enum rpu_oper_mode)'} [-Werror=enum-int-mismatch]
       1228 | int zynqmp_pm_set_rpu_mode(u32 node_id, enum rpu_oper_mode rpu_mode)
            |     ^~~~~~~~~~~~~~~~~~~~~~
      In file included from drivers/firmware/xilinx/zynqmp.c:25:
      include/linux/firmware/xlnx-zynqmp.h:552:5: note: previous declaration of 'zynqmp_pm_set_rpu_mode' with type 'int(u32,  u32)' {aka 'int(unsigned int,  unsigned int)'}
        552 | int zynqmp_pm_set_rpu_mode(u32 node_id, u32 arg1);
            |     ^~~~~~~~~~~~~~~~~~~~~~
      drivers/firmware/xilinx/zynqmp.c:1246:5: error: conflicting types for 'zynqmp_pm_set_tcm_config' due to enum/integer mismatch; have 'int(u32,  enum rpu_tcm_comb)' {aka 'int(unsigned int,  enum rpu_tcm_comb)'} [-Werror=enum-int-mismatch]
       1246 | int zynqmp_pm_set_tcm_config(u32 node_id, enum rpu_tcm_comb tcm_mode)
            |     ^~~~~~~~~~~~~~~~~~~~~~~~
      include/linux/firmware/xlnx-zynqmp.h:553:5: note: previous declaration of 'zynqmp_pm_set_tcm_config' with type 'int(u32,  u32)' {aka 'int(unsigned int,  unsigned int)'}
        553 | int zynqmp_pm_set_tcm_config(u32 node_id, u32 arg1);
            |     ^~~~~~~~~~~~~~~~~~~~~~~~
      
      Change the declaration in the header to match the function definition.
      Acked-by: NMichal Simek <michal.simek@amd.com>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      d2c86555
  6. 18 1月, 2023 1 次提交
    • J
      USB: fix misleading usb_set_intfdata() kernel doc · 11cefeb2
      Johan Hovold 提交于
      The struct device driver-data pointer is used for any data that a driver
      may need in various callbacks while bound to the device. For
      convenience, subsystems typically provide wrappers such as
      usb_set_intfdata() of the generic accessor functions for use in bus
      callbacks.
      
      There is generally no longer any need for a driver to clear the pointer,
      but since commit 0998d063 ("device-core: Ensure drvdata = NULL when
      no driver is bound") the driver-data pointer is set to NULL by driver
      core post unbind anyway.
      
      For historical reasons, USB core also clears this pointer when an
      explicitly claimed interface is released.
      
      Due to a misunderstanding, a misleading kernel doc comment for
      usb_set_intfdata() was recently added which claimed that the driver data
      pointer must not be cleared during disconnect before "all actions [are]
      completed", which is both imprecise and incorrect.
      
      Specifically, drivers like cdc-acm which claim additional interfaces use
      the driver-data pointer as a flag which is cleared when the first
      interface is unbound. As long as a driver does not do something odd like
      dereference the pointer in, for example, completion callbacks, this can
      be done at any time during disconnect. And in any case this is no
      different than for any other resource, like the driver data itself,
      which may be freed by the disconnect callback.
      
      Note that the comment actually also claimed that the interface itself
      was somehow being set to NULL by driver core.
      
      Fix the kernel doc by removing incorrect, overly specific and misleading
      details and adding a comment about why some drivers do clear the
      driver-data pointer.
      
      Fixes: 27ef1784 ("usb: add usb_set_intfdata() documentation")
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NVincent Mailhol <mailhol.vincent@wanadoo.fr>
      Link: https://lore.kernel.org/r/20221212152035.31806-1-johan@kernel.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      11cefeb2
  7. 17 1月, 2023 1 次提交
  8. 14 1月, 2023 1 次提交
    • A
      efi: tpm: Avoid READ_ONCE() for accessing the event log · d3f45053
      Ard Biesheuvel 提交于
      Nathan reports that recent kernels built with LTO will crash when doing
      EFI boot using Fedora's GRUB and SHIM. The culprit turns out to be a
      misaligned load from the TPM event log, which is annotated with
      READ_ONCE(), and under LTO, this gets translated into a LDAR instruction
      which does not tolerate misaligned accesses.
      
      Interestingly, this does not happen when booting the same kernel
      straight from the UEFI shell, and so the fact that the event log may
      appear misaligned in memory may be caused by a bug in GRUB or SHIM.
      
      However, using READ_ONCE() to access firmware tables is slightly unusual
      in any case, and here, we only need to ensure that 'event' is not
      dereferenced again after it gets unmapped, but this is already taken
      care of by the implicit barrier() semantics of the early_memunmap()
      call.
      
      Cc: <stable@vger.kernel.org>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Jarkko Sakkinen <jarkko@kernel.org>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Reported-by: NNathan Chancellor <nathan@kernel.org>
      Tested-by: NNathan Chancellor <nathan@kernel.org>
      Link: https://github.com/ClangBuiltLinux/linux/issues/1782Signed-off-by: NArd Biesheuvel <ardb@kernel.org>
      d3f45053
  9. 13 1月, 2023 2 次提交
  10. 12 1月, 2023 3 次提交
  11. 11 1月, 2023 1 次提交
    • A
      ARM: omap1: fix !ARCH_OMAP1_ANY link failures · 980a637d
      Arnd Bergmann 提交于
      While compile-testing randconfig builds for the upcoming boardfile
      removal, I noticed that an earlier patch of mine was completely
      broken, and the introduction of CONFIG_ARCH_OMAP1_ANY only replaced
      one set of build failures with another one, now resulting in
      link failures like
      
      ld: drivers/video/fbdev/omap/omapfb_main.o: in function `omapfb_do_probe':
      drivers/video/fbdev/omap/omapfb_main.c:1703: undefined reference to `omap_set_dma_priority'
      ld: drivers/dma/ti/omap-dma.o: in function `omap_dma_free_chan_resources':
      drivers/dma/ti/omap-dma.c:777: undefined reference to `omap_free_dma'
      drivers/dma/ti/omap-dma.c:1685: undefined reference to `omap_get_plat_info'
      ld: drivers/usb/gadget/udc/omap_udc.o: in function `next_in_dma':
      drivers/usb/gadget/udc/omap_udc.c:820: undefined reference to `omap_get_dma_active_status'
      
      I tried reworking it, but the resulting patch ended up much bigger than
      simply avoiding the original problem of unused-function warnings like
      
      arch/arm/mach-omap1/mcbsp.c:76:30: error: unused variable 'omap1_mcbsp_ops' [-Werror,-Wunused-variable]
      
      As a result, revert the previous fix, and rearrange the code that
      produces warnings to hide them. For mcbsp, the #ifdef check can
      simply be removed as the cpu_is_omapxxx() checks already achieve
      the same result, while in the io.c the easiest solution appears to
      be to merge the common map bits into each soc specific portion.
      This gets cleaned in a nicer way after omap7xx support gets dropped,
      as the remaining SoCs all have the exact same I/O map.
      
      Fixes: 615dce5b ("ARM: omap1: fix build with no SoC selected")
      Cc: stable@vger.kernel.org
      Acked-by: NAaro Koskinen <aaro.koskinen@iki.fi>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      980a637d
  12. 10 1月, 2023 2 次提交
    • M
      net/mlx5: Fix command stats access after free · da2e552b
      Moshe Shemesh 提交于
      Command may fail while driver is reloading and can't accept FW commands
      till command interface is reinitialized. Such command failure is being
      logged to command stats. This results in NULL pointer access as command
      stats structure is being freed and reallocated during mlx5 devlink
      reload (see kernel log below).
      
      Fix it by making command stats statically allocated on driver probe.
      
      Kernel log:
      [ 2394.808802] BUG: unable to handle kernel paging request at 000000000002a9c0
      [ 2394.810610] PGD 0 P4D 0
      [ 2394.811811] Oops: 0002 [#1] SMP NOPTI
      ...
      [ 2394.815482] RIP: 0010:native_queued_spin_lock_slowpath+0x183/0x1d0
      ...
      [ 2394.829505] Call Trace:
      [ 2394.830667]  _raw_spin_lock_irq+0x23/0x26
      [ 2394.831858]  cmd_status_err+0x55/0x110 [mlx5_core]
      [ 2394.833020]  mlx5_access_reg+0xe7/0x150 [mlx5_core]
      [ 2394.834175]  mlx5_query_port_ptys+0x78/0xa0 [mlx5_core]
      [ 2394.835337]  mlx5e_ethtool_get_link_ksettings+0x74/0x590 [mlx5_core]
      [ 2394.836454]  ? kmem_cache_alloc_trace+0x140/0x1c0
      [ 2394.837562]  __rh_call_get_link_ksettings+0x33/0x100
      [ 2394.838663]  ? __rtnl_unlock+0x25/0x50
      [ 2394.839755]  __ethtool_get_link_ksettings+0x72/0x150
      [ 2394.840862]  duplex_show+0x6e/0xc0
      [ 2394.841963]  dev_attr_show+0x1c/0x40
      [ 2394.843048]  sysfs_kf_seq_show+0x9b/0x100
      [ 2394.844123]  seq_read+0x153/0x410
      [ 2394.845187]  vfs_read+0x91/0x140
      [ 2394.846226]  ksys_read+0x4f/0xb0
      [ 2394.847234]  do_syscall_64+0x5b/0x1a0
      [ 2394.848228]  entry_SYSCALL_64_after_hwframe+0x65/0xca
      
      Fixes: 34f46ae0 ("net/mlx5: Add command failures data to debugfs")
      Signed-off-by: NMoshe Shemesh <moshe@nvidia.com>
      Reviewed-by: NShay Drory <shayd@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      da2e552b
    • P
      bpf: remove the do_idr_lock parameter from bpf_prog_free_id() · e7895f01
      Paul Moore 提交于
      It was determined that the do_idr_lock parameter to
      bpf_prog_free_id() was not necessary as it should always be true.
      Suggested-by: NStanislav Fomichev <sdf@google.com>
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      Acked-by: NStanislav Fomichev <sdf@google.com>
      Link: https://lore.kernel.org/r/20230106154400.74211-2-paul@paul-moore.comSigned-off-by: NAlexei Starovoitov <ast@kernel.org>
      e7895f01
  13. 05 1月, 2023 5 次提交
  14. 02 1月, 2023 3 次提交
  15. 01 1月, 2023 2 次提交
  16. 29 12月, 2022 3 次提交
  17. 20 12月, 2022 2 次提交
  18. 17 12月, 2022 1 次提交
  19. 16 12月, 2022 6 次提交