Skip to content
  1. Mar 06, 2024
    • Ard Biesheuvel's avatar
      x86/boot/compressed, efi: Merge multiple definitions of image_offset into one · ef12d049
      Ard Biesheuvel authored
      
      
      commit 4b520162 upstream.
      
      There is no need for head_32.S and head_64.S both declaring a copy of
      the global 'image_offset' variable, so drop those and make the extern C
      declaration the definition.
      
      When image_offset is moved to the .c file, it needs to be placed
      particularly in the .data section because it lands by default in the
      .bss section which is cleared too late, in .Lrelocated, before the first
      access to it and thus garbage gets read, leading to SEV guests exploding
      in early boot.
      
      This happens only when the SEV guest kernel is loaded through grub. If
      supplied with qemu's -kernel command line option, that memory is always
      cleared upfront by qemu and all is fine there.
      
        [ bp: Expand commit message with SEV aspect. ]
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Link: https://lore.kernel.org/r/20221122161017.2426828-8-ardb@kernel.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ef12d049
    • Ard Biesheuvel's avatar
      x86/boot/compressed: Move efi32_pe_entry() out of head_64.S · beeeb465
      Ard Biesheuvel authored
      
      
      commit 7f22ca39 upstream.
      
      Move the implementation of efi32_pe_entry() into efi-mixed.S, which is a
      more suitable location that only gets built if EFI mixed mode is
      actually enabled.
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Link: https://lore.kernel.org/r/20221122161017.2426828-7-ardb@kernel.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      beeeb465
    • Ard Biesheuvel's avatar
      x86/boot/compressed: Move efi32_entry out of head_64.S · 469b8451
      Ard Biesheuvel authored
      
      
      commit 73a6dec8 upstream.
      
      Move the efi32_entry() routine out of head_64.S and into efi-mixed.S,
      which reduces clutter in the complicated startup routines. It also
      permits linkage of some symbols used by code to be made local.
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Link: https://lore.kernel.org/r/20221122161017.2426828-6-ardb@kernel.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      469b8451
    • Ard Biesheuvel's avatar
      x86/boot/compressed: Move efi32_pe_entry into .text section · c577208f
      Ard Biesheuvel authored
      
      
      commit 91592b5c upstream.
      
      Move efi32_pe_entry() into the .text section, so that it can be moved
      out of head_64.S and into a separate compilation unit in a subsequent
      patch.
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Link: https://lore.kernel.org/r/20221122161017.2426828-5-ardb@kernel.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c577208f
    • Ard Biesheuvel's avatar
      x86/boot/compressed: Move bootargs parsing out of 32-bit startup code · d8950e8e
      Ard Biesheuvel authored
      
      
      commit 5c3a85f3 upstream.
      
      Move the logic that chooses between the different EFI entrypoints out of
      the 32-bit boot path, and into a 64-bit helper that can perform the same
      task much more cleanly. While at it, document the mixed mode boot flow
      in a code comment.
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Link: https://lore.kernel.org/r/20221122161017.2426828-4-ardb@kernel.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d8950e8e
    • Ard Biesheuvel's avatar
      x86/boot/compressed: Move 32-bit entrypoint code into .text section · 3bad8dc0
      Ard Biesheuvel authored
      
      
      commit e2ab9eab upstream.
      
      Move the code that stores the arguments passed to the EFI entrypoint
      into the .text section, so that it can be moved into a separate
      compilation unit in a subsequent patch.
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Link: https://lore.kernel.org/r/20221122161017.2426828-3-ardb@kernel.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3bad8dc0
    • Ard Biesheuvel's avatar
      x86/boot/compressed: Rename efi_thunk_64.S to efi-mixed.S · bad6e66d
      Ard Biesheuvel authored
      
      
      commit cb8bda8a upstream.
      
      In preparation for moving the mixed mode specific code out of head_64.S,
      rename the existing file to clarify that it contains more than just the
      mixed mode thunk.
      
      While at it, clean up the Makefile rules that add it to the build.
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Link: https://lore.kernel.org/r/20221122161017.2426828-2-ardb@kernel.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bad6e66d
    • Ard Biesheuvel's avatar
      efi: libstub: use EFI_LOADER_CODE region when moving the kernel in memory · e7945d93
      Ard Biesheuvel authored
      
      
      commit 9cf42bca upstream.
      
      The EFI spec is not very clear about which permissions are being given
      when allocating pages of a certain type. However, it is quite obvious
      that EFI_LOADER_CODE is more likely to permit execution than
      EFI_LOADER_DATA, which becomes relevant once we permit booting the
      kernel proper with the firmware's 1:1 mapping still active.
      
      Ostensibly, recent systems such as the Surface Pro X grant executable
      permissions to EFI_LOADER_CODE regions but not EFI_LOADER_DATA regions.
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e7945d93
    • Shiraz Saleem's avatar
      RDMA/core: Update CMA destination address on rdma_resolve_addr · 2d9b3e1a
      Shiraz Saleem authored
      
      
      commit 0e158630 upstream.
      
      8d037973 ("RDMA/core: Refactor rdma_bind_addr") intoduces as regression
      on irdma devices on certain tests which uses rdma CM, such as cmtime.
      
      No connections can be established with the MAD QP experiences a fatal
      error on the active side.
      
      The cma destination address is not updated with the dst_addr when ULP
      on active side calls rdma_bind_addr followed by rdma_resolve_addr.
      The id_priv state is 'bound' in resolve_prepare_src and update is skipped.
      
      This leaves the dgid passed into irdma driver to create an Address Handle
      (AH) for the MAD QP at 0. The create AH descriptor as well as the ARP cache
      entry is invalid and HW throws an asynchronous events as result.
      
      [ 1207.656888] resolve_prepare_src caller: ucma_resolve_addr+0xff/0x170 [rdma_ucm] daddr=200.0.4.28 id_priv->state=7
      [....]
      [ 1207.680362] ice 0000:07:00.1 rocep7s0f1: caller: irdma_create_ah+0x3e/0x70 [irdma] ah_id=0 arp_idx=0 dest_ip=0.0.0.0
      destMAC=00:00:64:ca:b7:52 ipvalid=1 raw=0000:0000:0000:0000:0000:ffff:0000:0000
      [ 1207.682077] ice 0000:07:00.1 rocep7s0f1: abnormal ae_id = 0x401 bool qp=1 qp_id = 1, ae_src=5
      [ 1207.691657] infiniband rocep7s0f1: Fatal error (1) on MAD QP (1)
      
      Fix this by updating the CMA destination address when the ULP calls
      a resolve address with the CM state already bound.
      
      Fixes: 8d037973 ("RDMA/core: Refactor rdma_bind_addr")
      Signed-off-by: default avatarShiraz Saleem <shiraz.saleem@intel.com>
      Link: https://lore.kernel.org/r/20230712234133.1343-1-shiraz.saleem@intel.com
      
      
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2d9b3e1a
    • Patrisious Haddad's avatar
      RDMA/core: Refactor rdma_bind_addr · 88067197
      Patrisious Haddad authored
      
      
      commit 8d037973 upstream.
      
      Refactor rdma_bind_addr function so that it doesn't require that the
      cma destination address be changed before calling it.
      
      So now it will update the destination address internally only when it is
      really needed and after passing all the required checks.
      
      Which in turn results in a cleaner and more sensible call and error
      handling flows for the functions that call it directly or indirectly.
      
      Signed-off-by: default avatarPatrisious Haddad <phaddad@nvidia.com>
      Reported-by: default avatarWei Chen <harperchen1110@gmail.com>
      Reviewed-by: default avatarMark Zhang <markzhang@nvidia.com>
      Link: https://lore.kernel.org/r/3d0e9a2fd62bc10ba02fed1c7c48a48638952320.1672819273.git.leonro@nvidia.com
      
      
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      88067197
    • Paolo Abeni's avatar
      mptcp: fix possible deadlock in subflow diag · f27d319d
      Paolo Abeni authored
      
      
      commit d6a9608a upstream.
      
      Syzbot and Eric reported a lockdep splat in the subflow diag:
      
         WARNING: possible circular locking dependency detected
         6.8.0-rc4-syzkaller-00212-g40b9385dd8e6 #0 Not tainted
      
         syz-executor.2/24141 is trying to acquire lock:
         ffff888045870130 (k-sk_lock-AF_INET6){+.+.}-{0:0}, at:
         tcp_diag_put_ulp net/ipv4/tcp_diag.c:100 [inline]
         ffff888045870130 (k-sk_lock-AF_INET6){+.+.}-{0:0}, at:
         tcp_diag_get_aux+0x738/0x830 net/ipv4/tcp_diag.c:137
      
         but task is already holding lock:
         ffffc9000135e488 (&h->lhash2[i].lock){+.+.}-{2:2}, at: spin_lock
         include/linux/spinlock.h:351 [inline]
         ffffc9000135e488 (&h->lhash2[i].lock){+.+.}-{2:2}, at:
         inet_diag_dump_icsk+0x39f/0x1f80 net/ipv4/inet_diag.c:1038
      
         which lock already depends on the new lock.
      
         the existing dependency chain (in reverse order) is:
      
         -> #1 (&h->lhash2[i].lock){+.+.}-{2:2}:
         lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754
         __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
         _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
         spin_lock include/linux/spinlock.h:351 [inline]
         __inet_hash+0x335/0xbe0 net/ipv4/inet_hashtables.c:743
         inet_csk_listen_start+0x23a/0x320 net/ipv4/inet_connection_sock.c:1261
         __inet_listen_sk+0x2a2/0x770 net/ipv4/af_inet.c:217
         inet_listen+0xa3/0x110 net/ipv4/af_inet.c:239
         rds_tcp_listen_init+0x3fd/0x5a0 net/rds/tcp_listen.c:316
         rds_tcp_init_net+0x141/0x320 net/rds/tcp.c:577
         ops_init+0x352/0x610 net/core/net_namespace.c:136
         __register_pernet_operations net/core/net_namespace.c:1214 [inline]
         register_pernet_operations+0x2cb/0x660 net/core/net_namespace.c:1283
         register_pernet_device+0x33/0x80 net/core/net_namespace.c:1370
         rds_tcp_init+0x62/0xd0 net/rds/tcp.c:735
         do_one_initcall+0x238/0x830 init/main.c:1236
         do_initcall_level+0x157/0x210 init/main.c:1298
         do_initcalls+0x3f/0x80 init/main.c:1314
         kernel_init_freeable+0x42f/0x5d0 init/main.c:1551
         kernel_init+0x1d/0x2a0 init/main.c:1441
         ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
         ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:242
      
         -> #0 (k-sk_lock-AF_INET6){+.+.}-{0:0}:
         check_prev_add kernel/locking/lockdep.c:3134 [inline]
         check_prevs_add kernel/locking/lockdep.c:3253 [inline]
         validate_chain+0x18ca/0x58e0 kernel/locking/lockdep.c:3869
         __lock_acquire+0x1345/0x1fd0 kernel/locking/lockdep.c:5137
         lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754
         lock_sock_fast include/net/sock.h:1723 [inline]
         subflow_get_info+0x166/0xd20 net/mptcp/diag.c:28
         tcp_diag_put_ulp net/ipv4/tcp_diag.c:100 [inline]
         tcp_diag_get_aux+0x738/0x830 net/ipv4/tcp_diag.c:137
         inet_sk_diag_fill+0x10ed/0x1e00 net/ipv4/inet_diag.c:345
         inet_diag_dump_icsk+0x55b/0x1f80 net/ipv4/inet_diag.c:1061
         __inet_diag_dump+0x211/0x3a0 net/ipv4/inet_diag.c:1263
         inet_diag_dump_compat+0x1c1/0x2d0 net/ipv4/inet_diag.c:1371
         netlink_dump+0x59b/0xc80 net/netlink/af_netlink.c:2264
         __netlink_dump_start+0x5df/0x790 net/netlink/af_netlink.c:2370
         netlink_dump_start include/linux/netlink.h:338 [inline]
         inet_diag_rcv_msg_compat+0x209/0x4c0 net/ipv4/inet_diag.c:1405
         sock_diag_rcv_msg+0xe7/0x410
         netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2543
         sock_diag_rcv+0x2a/0x40 net/core/sock_diag.c:280
         netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline]
         netlink_unicast+0x7ea/0x980 net/netlink/af_netlink.c:1367
         netlink_sendmsg+0xa3b/0xd70 net/netlink/af_netlink.c:1908
         sock_sendmsg_nosec net/socket.c:730 [inline]
         __sock_sendmsg+0x221/0x270 net/socket.c:745
         ____sys_sendmsg+0x525/0x7d0 net/socket.c:2584
         ___sys_sendmsg net/socket.c:2638 [inline]
         __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2667
         do_syscall_64+0xf9/0x240
         entry_SYSCALL_64_after_hwframe+0x6f/0x77
      
      As noted by Eric we can break the lock dependency chain avoid
      dumping any extended info for the mptcp subflow listener:
      nothing actually useful is presented there.
      
      Fixes: b8adb69a ("mptcp: fix lockless access in subflow ULP diag")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarEric Dumazet <edumazet@google.com>
      Closes: https://lore.kernel.org/netdev/CANn89iJ=Oecw6OZDwmSYc9HJKQ_G32uN11L+oUcMu+TOD5Xiaw@mail.gmail.com/
      
      
      Suggested-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://lore.kernel.org/r/20240223-upstream-net-20240223-misc-fixes-v1-9-162e87e48497@kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f27d319d
    • Davide Caratti's avatar
      mptcp: fix double-free on socket dismantle · d93fd40c
      Davide Caratti authored
      
      
      commit 10048689 upstream.
      
      when MPTCP server accepts an incoming connection, it clones its listener
      socket. However, the pointer to 'inet_opt' for the new socket has the same
      value as the original one: as a consequence, on program exit it's possible
      to observe the following splat:
      
        BUG: KASAN: double-free in inet_sock_destruct+0x54f/0x8b0
        Free of addr ffff888485950880 by task swapper/25/0
      
        CPU: 25 PID: 0 Comm: swapper/25 Kdump: loaded Not tainted 6.8.0-rc1+ #609
        Hardware name: Supermicro SYS-6027R-72RF/X9DRH-7TF/7F/iTF/iF, BIOS 3.0  07/26/2013
        Call Trace:
         <IRQ>
         dump_stack_lvl+0x32/0x50
         print_report+0xca/0x620
         kasan_report_invalid_free+0x64/0x90
         __kasan_slab_free+0x1aa/0x1f0
         kfree+0xed/0x2e0
         inet_sock_destruct+0x54f/0x8b0
         __sk_destruct+0x48/0x5b0
         rcu_do_batch+0x34e/0xd90
         rcu_core+0x559/0xac0
         __do_softirq+0x183/0x5a4
         irq_exit_rcu+0x12d/0x170
         sysvec_apic_timer_interrupt+0x6b/0x80
         </IRQ>
         <TASK>
         asm_sysvec_apic_timer_interrupt+0x16/0x20
        RIP: 0010:cpuidle_enter_state+0x175/0x300
        Code: 30 00 0f 84 1f 01 00 00 83 e8 01 83 f8 ff 75 e5 48 83 c4 18 44 89 e8 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc fb 45 85 ed <0f> 89 60 ff ff ff 48 c1 e5 06 48 c7 43 18 00 00 00 00 48 83 44 2b
        RSP: 0018:ffff888481cf7d90 EFLAGS: 00000202
        RAX: 0000000000000000 RBX: ffff88887facddc8 RCX: 0000000000000000
        RDX: 1ffff1110ff588b1 RSI: 0000000000000019 RDI: ffff88887fac4588
        RBP: 0000000000000004 R08: 0000000000000002 R09: 0000000000043080
        R10: 0009b02ea273363f R11: ffff88887fabf42b R12: ffffffff932592e0
        R13: 0000000000000004 R14: 0000000000000000 R15: 00000022c880ec80
         cpuidle_enter+0x4a/0xa0
         do_idle+0x310/0x410
         cpu_startup_entry+0x51/0x60
         start_secondary+0x211/0x270
         secondary_startup_64_no_verify+0x184/0x18b
         </TASK>
      
        Allocated by task 6853:
         kasan_save_stack+0x1c/0x40
         kasan_save_track+0x10/0x30
         __kasan_kmalloc+0xa6/0xb0
         __kmalloc+0x1eb/0x450
         cipso_v4_sock_setattr+0x96/0x360
         netlbl_sock_setattr+0x132/0x1f0
         selinux_netlbl_socket_post_create+0x6c/0x110
         selinux_socket_post_create+0x37b/0x7f0
         security_socket_post_create+0x63/0xb0
         __sock_create+0x305/0x450
         __sys_socket_create.part.23+0xbd/0x130
         __sys_socket+0x37/0xb0
         __x64_sys_socket+0x6f/0xb0
         do_syscall_64+0x83/0x160
         entry_SYSCALL_64_after_hwframe+0x6e/0x76
      
        Freed by task 6858:
         kasan_save_stack+0x1c/0x40
         kasan_save_track+0x10/0x30
         kasan_save_free_info+0x3b/0x60
         __kasan_slab_free+0x12c/0x1f0
         kfree+0xed/0x2e0
         inet_sock_destruct+0x54f/0x8b0
         __sk_destruct+0x48/0x5b0
         subflow_ulp_release+0x1f0/0x250
         tcp_cleanup_ulp+0x6e/0x110
         tcp_v4_destroy_sock+0x5a/0x3a0
         inet_csk_destroy_sock+0x135/0x390
         tcp_fin+0x416/0x5c0
         tcp_data_queue+0x1bc8/0x4310
         tcp_rcv_state_process+0x15a3/0x47b0
         tcp_v4_do_rcv+0x2c1/0x990
         tcp_v4_rcv+0x41fb/0x5ed0
         ip_protocol_deliver_rcu+0x6d/0x9f0
         ip_local_deliver_finish+0x278/0x360
         ip_local_deliver+0x182/0x2c0
         ip_rcv+0xb5/0x1c0
         __netif_receive_skb_one_core+0x16e/0x1b0
         process_backlog+0x1e3/0x650
         __napi_poll+0xa6/0x500
         net_rx_action+0x740/0xbb0
         __do_softirq+0x183/0x5a4
      
        The buggy address belongs to the object at ffff888485950880
         which belongs to the cache kmalloc-64 of size 64
        The buggy address is located 0 bytes inside of
         64-byte region [ffff888485950880, ffff8884859508c0)
      
        The buggy address belongs to the physical page:
        page:0000000056d1e95e refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888485950700 pfn:0x485950
        flags: 0x57ffffc0000800(slab|node=1|zone=2|lastcpupid=0x1fffff)
        page_type: 0xffffffff()
        raw: 0057ffffc0000800 ffff88810004c640 ffffea00121b8ac0 dead000000000006
        raw: ffff888485950700 0000000000200019 00000001ffffffff 0000000000000000
        page dumped because: kasan: bad access detected
      
        Memory state around the buggy address:
         ffff888485950780: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
         ffff888485950800: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
        >ffff888485950880: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                           ^
         ffff888485950900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
         ffff888485950980: 00 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc
      
      Something similar (a refcount underflow) happens with CALIPSO/IPv6. Fix
      this by duplicating IP / IPv6 options after clone, so that
      ip{,6}_sock_destruct() doesn't end up freeing the same memory area twice.
      
      Fixes: cf7da0d6 ("mptcp: Create SUBFLOW socket for incoming connections")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDavide Caratti <dcaratti@redhat.com>
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://lore.kernel.org/r/20240223-upstream-net-20240223-misc-fixes-v1-8-162e87e48497@kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d93fd40c
    • Paolo Abeni's avatar
      mptcp: fix snd_wnd initialization for passive socket · a8722cec
      Paolo Abeni authored
      
      
      commit adf1bb78 upstream.
      
      Such value should be inherited from the first subflow, but
      passive sockets always used 'rsk_rcv_wnd'.
      
      Fixes: 6f8a612a ("mptcp: keep track of advertised windows right edge")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://lore.kernel.org/r/20240223-upstream-net-20240223-misc-fixes-v1-5-162e87e48497@kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a8722cec
    • Geliang Tang's avatar
      selftests: mptcp: join: add ss mptcp support check · 03ad085e
      Geliang Tang authored
      
      
      commit 9480f388 upstream.
      
      Commands 'ss -M' are used in script mptcp_join.sh to display only MPTCP
      sockets. So it must be checked if ss tool supports MPTCP in this script.
      
      Fixes: e274f715 ("selftests: mptcp: add subflow limits test-cases")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGeliang Tang <tanggeliang@kylinos.cn>
      Reviewed-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://lore.kernel.org/r/20240223-upstream-net-20240223-misc-fixes-v1-7-162e87e48497@kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      03ad085e
    • Paolo Abeni's avatar
      mptcp: push at DSS boundaries · 84a3c10a
      Paolo Abeni authored
      
      
      commit b9cd26f6 upstream.
      
      when inserting not contiguous data in the subflow write queue,
      the protocol creates a new skb and prevent the TCP stack from
      merging it later with already queued skbs by setting the EOR marker.
      
      Still no push flag is explicitly set at the end of previous GSO
      packet, making the aggregation on the receiver side sub-optimal -
      and packetdrill self-tests less predictable.
      
      Explicitly mark the end of not contiguous DSS with the push flag.
      
      Fixes: 6d0060f6 ("mptcp: Write MPTCP DSS headers to outgoing data packets")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://lore.kernel.org/r/20240223-upstream-net-20240223-misc-fixes-v1-4-162e87e48497@kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      84a3c10a
    • Geliang Tang's avatar
      mptcp: map v4 address to v6 when destroying subflow · fb7be5e5
      Geliang Tang authored
      commit 535d620e upstream.
      
      Address family of server side mismatches with that of client side, like
      in "userspace pm add & remove address" test:
      
          userspace_pm_add_addr $ns1 10.0.2.1 10
          userspace_pm_rm_sf $ns1 "::ffff:10.0.2.1" $SUB_ESTABLISHED
      
      That's because on the server side, the family is set to AF_INET6 and the
      v4 address is mapped in a v6 one.
      
      This patch fixes this issue. In mptcp_pm_nl_subflow_destroy_doit(), before
      checking local address family with remote address family, map an IPv4
      address to an IPv6 address if the pair is a v4-mapped address.
      
      Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/387
      
      
      Fixes: 702c2f64 ("mptcp: netlink: allow userspace-driven subflow establishment")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGeliang Tang <tanggeliang@kylinos.cn>
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Reviewed-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://lore.kernel.org/r/20240223-upstream-net-20240223-misc-fixes-v1-1-162e87e48497@kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fb7be5e5
    • Matthieu Baerts (NGI0)'s avatar
      mptcp: continue marking the first subflow as UNCONNECTED · 53e3f2ee
      Matthieu Baerts (NGI0) authored
      
      
      After the 'Fixes' commit mentioned below, which is a partial backport,
      the MPTCP worker was no longer marking the first subflow as "UNCONNECTED"
      when the socket was transitioning to TCP_CLOSE state.
      
      As a result, in v6.1, it was no longer possible to reconnect to the just
      disconnected socket. Continue to do that like before, only for the first
      subflow.
      
      A few refactoring have been done around the 'msk->subflow' in later
      versions, and it looks like this is not needed to do that there, but
      still needed in v6.1. Without that, the 'disconnect' tests from the
      mptcp_connect.sh selftest fail: they repeat the transfer 3 times by
      reconnecting to the server each time.
      
      Fixes: 7857e35e ("mptcp: get rid of msk->subflow")
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      53e3f2ee
    • Paolo Abeni's avatar
      mptcp: fix duplicate subflow creation · fbccc5eb
      Paolo Abeni authored
      commit 045e9d81 upstream.
      
      Fullmesh endpoints could end-up unexpectedly generating duplicate
      subflows - same local and remote addresses - when multiple incoming
      ADD_ADDR are processed before the PM creates the subflow for the local
      endpoints.
      
      Address the issue explicitly checking for duplicates at subflow
      creation time.
      
      To avoid a quadratic computational complexity, track the unavailable
      remote address ids in a temporary bitmap and initialize such bitmap
      with the remote ids of all the existing subflows matching the local
      address currently processed.
      
      The above allows additionally replacing the existing code checking
      for duplicate entry in the current set with a simple bit test
      operation.
      
      Fixes: 2843ff6f ("mptcp: remote addresses fullmesh")
      Cc: stable@vger.kernel.org
      Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/435
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fbccc5eb
    • Paolo Abeni's avatar
      mptcp: fix data races on remote_id · e6414863
      Paolo Abeni authored
      
      
      commit 967d3c27 upstream.
      
      Similar to the previous patch, address the data race on
      remote_id, adding the suitable ONCE annotations.
      
      Fixes: bedee0b5 ("mptcp: address lookup improvements")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e6414863
    • Paolo Abeni's avatar
      mptcp: fix data races on local_id · e6e04845
      Paolo Abeni authored
      
      
      commit a7cfe776 upstream.
      
      The local address id is accessed lockless by the NL PM, add
      all the required ONCE annotation. There is a caveat: the local
      id can be initialized late in the subflow life-cycle, and its
      validity is controlled by the local_id_valid flag.
      
      Remove such flag and encode the validity in the local_id field
      itself with negative value before initialization. That allows
      accessing the field consistently with a single read operation.
      
      Fixes: 0ee4261a ("mptcp: implement mptcp_pm_remove_subflow")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e6e04845
    • Paolo Bonzini's avatar
      x86/cpu/intel: Detect TME keyid bits before setting MTRR mask registers · 65742f4b
      Paolo Bonzini authored
      
      
      commit 6890cb1a upstream.
      
      MKTME repurposes the high bit of physical address to key id for encryption
      key and, even though MAXPHYADDR in CPUID[0x80000008] remains the same,
      the valid bits in the MTRR mask register are based on the reduced number
      of physical address bits.
      
      detect_tme() in arch/x86/kernel/cpu/intel.c detects TME and subtracts
      it from the total usable physical bits, but it is called too late.
      Move the call to early_init_intel() so that it is called in setup_arch(),
      before MTRRs are setup.
      
      This fixes boot on TDX-enabled systems, which until now only worked with
      "disable_mtrr_cleanup".  Without the patch, the values written to the
      MTRRs mask registers were 52-bit wide (e.g. 0x000fffff_80000800) and
      the writes failed; with the patch, the values are 46-bit wide, which
      matches the reduced MAXPHYADDR that is shown in /proc/cpuinfo.
      
      Reported-by: default avatarZixi Chen <zixchen@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Cc:stable@vger.kernel.org
      Link: https://lore.kernel.org/all/20240131230902.1867092-3-pbonzini%40redhat.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      65742f4b
    • Jiri Bohac's avatar
      x86/e820: Don't reserve SETUP_RNG_SEED in e820 · c9fa51d4
      Jiri Bohac authored
      
      
      commit 7fd817c9 upstream.
      
      SETUP_RNG_SEED in setup_data is supplied by kexec and should
      not be reserved in the e820 map.
      
      Doing so reserves 16 bytes of RAM when booting with kexec.
      (16 bytes because data->len is zeroed by parse_setup_data so only
      sizeof(setup_data) is reserved.)
      
      When kexec is used repeatedly, each boot adds two entries in the
      kexec-provided e820 map as the 16-byte range splits a larger
      range of usable memory. Eventually all of the 128 available entries
      get used up. The next split will result in losing usable memory
      as the new entries cannot be added to the e820 map.
      
      Fixes: 68b8e971 ("x86/setup: Use rng seeds from setup_data")
      Signed-off-by: default avatarJiri Bohac <jbohac@suse.cz>
      Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Cc: <stable@kernel.org>
      Link: https://lore.kernel.org/r/ZbmOjKnARGiaYBd5@dwarf.suse.cz
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c9fa51d4
    • Bjorn Andersson's avatar
      pmdomain: qcom: rpmhpd: Fix enabled_corner aggregation · 396a4120
      Bjorn Andersson authored
      
      
      commit 2a93c6cb upstream.
      
      Commit 'e3e56c05 ("soc: qcom: rpmhpd: Make power_on actually enable
      the domain")' aimed to make sure that a power-domain that is being
      enabled without any particular performance-state requested will at least
      turn the rail on, to avoid filling DeviceTree with otherwise unnecessary
      required-opps properties.
      
      But in the event that aggregation happens on a disabled power-domain, with
      an enabled peer without performance-state, both the local and peer
      corner are 0. The peer's enabled_corner is not considered, with the
      result that the underlying (shared) resource is disabled.
      
      One case where this can be observed is when the display stack keeps mmcx
      enabled (but without a particular performance-state vote) in order to
      access registers and sync_state happens in the rpmhpd driver. As mmcx_ao
      is flushed the state of the peer (mmcx) is not considered and mmcx_ao
      ends up turning off "mmcx.lvl" underneath mmcx. This has been observed
      several times, but has been painted over in DeviceTree by adding an
      explicit vote for the lowest non-disabled performance-state.
      
      Fixes: e3e56c05 ("soc: qcom: rpmhpd: Make power_on actually enable the domain")
      Reported-by: default avatarJohan Hovold <johan@kernel.org>
      Closes: https://lore.kernel.org/linux-arm-msm/ZdMwZa98L23mu3u6@hovoldconsulting.com/
      
      
      Cc:  <stable@vger.kernel.org>
      Signed-off-by: default avatarBjorn Andersson <quic_bjorande@quicinc.com>
      Reviewed-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
      Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Tested-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Reviewed-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
      Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
      Tested-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Link: https://lore.kernel.org/r/20240226-rpmhpd-enable-corner-fix-v1-1-68c004cec48c@quicinc.com
      
      
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      396a4120
    • Tim Schumacher's avatar
      efivarfs: Request at most 512 bytes for variable names · 249d6ca4
      Tim Schumacher authored
      
      
      commit f45812cc upstream.
      
      Work around a quirk in a few old (2011-ish) UEFI implementations, where
      a call to `GetNextVariableName` with a buffer size larger than 512 bytes
      will always return EFI_INVALID_PARAMETER.
      
      There is some lore around EFI variable names being up to 1024 bytes in
      size, but this has no basis in the UEFI specification, and the upper
      bounds are typically platform specific, and apply to the entire variable
      (name plus payload).
      
      Given that Linux does not permit creating files with names longer than
      NAME_MAX (255) bytes, 512 bytes (== 256 UTF-16 characters) is a
      reasonable limit.
      
      Cc: <stable@vger.kernel.org> # 6.1+
      Signed-off-by: default avatarTim Schumacher <timschumi@gmx.de>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      249d6ca4
    • Zong Li's avatar
      riscv: add CALLER_ADDRx support · 76109a22
      Zong Li authored
      
      
      commit 68034138 upstream.
      
      CALLER_ADDRx returns caller's address at specified level, they are used
      for several tracers. These macros eventually use
      __builtin_return_address(n) to get the caller's address if arch doesn't
      define their own implementation.
      
      In RISC-V, __builtin_return_address(n) only works when n == 0, we need
      to walk the stack frame to get the caller's address at specified level.
      
      data.level started from 'level + 3' due to the call flow of getting
      caller's address in RISC-V implementation. If we don't have additional
      three iteration, the level is corresponding to follows:
      
      callsite -> return_address -> arch_stack_walk -> walk_stackframe
      |           |                 |                  |
      level 3     level 2           level 1            level 0
      
      Fixes: 10626c32 ("riscv/ftrace: Add basic support")
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarAlexandre Ghiti <alexghiti@rivosinc.com>
      Signed-off-by: default avatarZong Li <zong.li@sifive.com>
      Link: https://lore.kernel.org/r/20240202015102.26251-1-zong.li@sifive.com
      
      
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      76109a22
    • Elad Nachman's avatar
      mmc: sdhci-xenon: fix PHY init clock stability · 4974d928
      Elad Nachman authored
      
      
      commit 8e9f25a2 upstream.
      
      Each time SD/mmc phy is initialized, at times, in some of
      the attempts, phy fails to completes its initialization
      which results into timeout error. Per the HW spec, it is
      a pre-requisite to ensure a stable SD clock before a phy
      initialization is attempted.
      
      Fixes: 06c8b667 ("mmc: sdhci-xenon: Add support to PHYs of Marvell Xenon SDHC")
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarElad Nachman <enachman@marvell.com>
      Link: https://lore.kernel.org/r/20240222200930.1277665-1-enachman@marvell.com
      
      
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4974d928
    • Elad Nachman's avatar
      mmc: sdhci-xenon: add timeout for PHY init complete · c65c4755
      Elad Nachman authored
      
      
      commit 09e23823 upstream.
      
      AC5X spec says PHY init complete bit must be polled until zero.
      We see cases in which timeout can take longer than the standard
      calculation on AC5X, which is expected following the spec comment above.
      According to the spec, we must wait as long as it takes for that bit to
      toggle on AC5X.
      Cap that with 100 delay loops so we won't get stuck forever.
      
      Fixes: 06c8b667 ("mmc: sdhci-xenon: Add support to PHYs of Marvell Xenon SDHC")
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarElad Nachman <enachman@marvell.com>
      Link: https://lore.kernel.org/r/20240222191714.1216470-3-enachman@marvell.com
      
      
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c65c4755
    • Ivan Semenov's avatar
      mmc: core: Fix eMMC initialization with 1-bit bus connection · bc9f87a4
      Ivan Semenov authored
      
      
      commit ff3206d2 upstream.
      
      Initializing an eMMC that's connected via a 1-bit bus is current failing,
      if the HW (DT) informs that 4-bit bus is supported. In fact this is a
      regression, as we were earlier capable of falling back to 1-bit mode, when
      switching to 4/8-bit bus failed. Therefore, let's restore the behaviour.
      
      Log for Samsung eMMC 5.1 chip connected via 1bit bus (only D0 pin)
      Before patch:
      [134509.044225] mmc0: switch to bus width 4 failed
      [134509.044509] mmc0: new high speed MMC card at address 0001
      [134509.054594] mmcblk0: mmc0:0001 BGUF4R 29.1 GiB
      [134509.281602] mmc0: switch to bus width 4 failed
      [134509.282638] I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2
      [134509.282657] Buffer I/O error on dev mmcblk0, logical block 0, async page read
      [134509.284598] I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2
      [134509.284602] Buffer I/O error on dev mmcblk0, logical block 0, async page read
      [134509.284609] ldm_validate_partition_table(): Disk read failed.
      [134509.286495] I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2
      [134509.286500] Buffer I/O error on dev mmcblk0, logical block 0, async page read
      [134509.288303] I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2
      [134509.288308] Buffer I/O error on dev mmcblk0, logical block 0, async page read
      [134509.289540] I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2
      [134509.289544] Buffer I/O error on dev mmcblk0, logical block 0, async page read
      [134509.289553]  mmcblk0: unable to read partition table
      [134509.289728] mmcblk0boot0: mmc0:0001 BGUF4R 31.9 MiB
      [134509.290283] mmcblk0boot1: mmc0:0001 BGUF4R 31.9 MiB
      [134509.294577] I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 2
      [134509.295835] I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2
      [134509.295841] Buffer I/O error on dev mmcblk0, logical block 0, async page read
      
      After patch:
      
      [134551.089613] mmc0: switch to bus width 4 failed
      [134551.090377] mmc0: new high speed MMC card at address 0001
      [134551.102271] mmcblk0: mmc0:0001 BGUF4R 29.1 GiB
      [134551.113365]  mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20 p21
      [134551.114262] mmcblk0boot0: mmc0:0001 BGUF4R 31.9 MiB
      [134551.114925] mmcblk0boot1: mmc0:0001 BGUF4R 31.9 MiB
      
      Fixes: 577fb131 ("mmc: rework selection of bus speed mode")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarIvan Semenov <ivan@semenov.dev>
      Link: https://lore.kernel.org/r/20240206172845.34316-1-ivan@semenov.dev
      
      
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bc9f87a4
    • Christophe Kerello's avatar
      mmc: mmci: stm32: fix DMA API overlapping mappings warning · 70af82bb
      Christophe Kerello authored
      
      
      commit 6b1ba3f9 upstream.
      
      Turning on CONFIG_DMA_API_DEBUG_SG results in the following warning:
      
      DMA-API: mmci-pl18x 48220000.mmc: cacheline tracking EEXIST,
      overlapping mappings aren't supported
      WARNING: CPU: 1 PID: 51 at kernel/dma/debug.c:568
      add_dma_entry+0x234/0x2f4
      Modules linked in:
      CPU: 1 PID: 51 Comm: kworker/1:2 Not tainted 6.1.28 #1
      Hardware name: STMicroelectronics STM32MP257F-EV1 Evaluation Board (DT)
      Workqueue: events_freezable mmc_rescan
      Call trace:
      add_dma_entry+0x234/0x2f4
      debug_dma_map_sg+0x198/0x350
      __dma_map_sg_attrs+0xa0/0x110
      dma_map_sg_attrs+0x10/0x2c
      sdmmc_idma_prep_data+0x80/0xc0
      mmci_prep_data+0x38/0x84
      mmci_start_data+0x108/0x2dc
      mmci_request+0xe4/0x190
      __mmc_start_request+0x68/0x140
      mmc_start_request+0x94/0xc0
      mmc_wait_for_req+0x70/0x100
      mmc_send_tuning+0x108/0x1ac
      sdmmc_execute_tuning+0x14c/0x210
      mmc_execute_tuning+0x48/0xec
      mmc_sd_init_uhs_card.part.0+0x208/0x464
      mmc_sd_init_card+0x318/0x89c
      mmc_attach_sd+0xe4/0x180
      mmc_rescan+0x244/0x320
      
      DMA API debug brings to light leaking dma-mappings as dma_map_sg and
      dma_unmap_sg are not correctly balanced.
      
      If an error occurs in mmci_cmd_irq function, only mmci_dma_error
      function is called and as this API is not managed on stm32 variant,
      dma_unmap_sg is never called in this error path.
      
      Signed-off-by: default avatarChristophe Kerello <christophe.kerello@foss.st.com>
      Fixes: 46b723dd ("mmc: mmci: add stm32 sdmmc variant")
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20240207143951.938144-1-christophe.kerello@foss.st.com
      
      
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      70af82bb
    • Curtis Klein's avatar
      dmaengine: fsl-qdma: init irq after reg initialization · 474d521d
      Curtis Klein authored
      
      
      commit 87a39071 upstream.
      
      Initialize the qDMA irqs after the registers are configured so that
      interrupts that may have been pending from a primary kernel don't get
      processed by the irq handler before it is ready to and cause panic with
      the following trace:
      
        Call trace:
         fsl_qdma_queue_handler+0xf8/0x3e8
         __handle_irq_event_percpu+0x78/0x2b0
         handle_irq_event_percpu+0x1c/0x68
         handle_irq_event+0x44/0x78
         handle_fasteoi_irq+0xc8/0x178
         generic_handle_irq+0x24/0x38
         __handle_domain_irq+0x90/0x100
         gic_handle_irq+0x5c/0xb8
         el1_irq+0xb8/0x180
         _raw_spin_unlock_irqrestore+0x14/0x40
         __setup_irq+0x4bc/0x798
         request_threaded_irq+0xd8/0x190
         devm_request_threaded_irq+0x74/0xe8
         fsl_qdma_probe+0x4d4/0xca8
         platform_drv_probe+0x50/0xa0
         really_probe+0xe0/0x3f8
         driver_probe_device+0x64/0x130
         device_driver_attach+0x6c/0x78
         __driver_attach+0xbc/0x158
         bus_for_each_dev+0x5c/0x98
         driver_attach+0x20/0x28
         bus_add_driver+0x158/0x220
         driver_register+0x60/0x110
         __platform_driver_register+0x44/0x50
         fsl_qdma_driver_init+0x18/0x20
         do_one_initcall+0x48/0x258
         kernel_init_freeable+0x1a4/0x23c
         kernel_init+0x10/0xf8
         ret_from_fork+0x10/0x18
      
      Cc: stable@vger.kernel.org
      Fixes: b092529e ("dmaengine: fsl-qdma: Add qDMA controller driver for Layerscape SoCs")
      Signed-off-by: default avatarCurtis Klein <curtis.klein@hpe.com>
      Signed-off-by: default avatarYi Zhao <yi.zhao@nxp.com>
      Signed-off-by: default avatarFrank Li <Frank.Li@nxp.com>
      Link: https://lore.kernel.org/r/20240201220406.440145-1-Frank.Li@nxp.com
      
      
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      474d521d
    • Tadeusz Struk's avatar
      dmaengine: ptdma: use consistent DMA masks · 300111cd
      Tadeusz Struk authored
      
      
      commit df2515a1 upstream.
      
      The PTDMA driver sets DMA masks in two different places for the same
      device inconsistently. First call is in pt_pci_probe(), where it uses
      48bit mask. The second call is in pt_dmaengine_register(), where it
      uses a 64bit mask. Using 64bit dma mask causes IO_PAGE_FAULT errors
      on DMA transfers between main memory and other devices.
      Without the extra call it works fine. Additionally the second call
      doesn't check the return value so it can silently fail.
      Remove the superfluous dma_set_mask() call and only use 48bit mask.
      
      Cc: stable@vger.kernel.org
      Fixes: b0b4a6b1 ("dmaengine: ptdma: register PTDMA controller as a DMA resource")
      Reviewed-by: default avatarBasavaraj Natikar <Basavaraj.Natikar@amd.com>
      Signed-off-by: default avatarTadeusz Struk <tstruk@gigaio.com>
      Link: https://lore.kernel.org/r/20240222163053.13842-1-tstruk@gigaio.com
      
      
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      300111cd
    • Ard Biesheuvel's avatar
      crypto: arm64/neonbs - fix out-of-bounds access on short input · 034e2d70
      Ard Biesheuvel authored
      
      
      commit 1c0cf6d1 upstream.
      
      The bit-sliced implementation of AES-CTR operates on blocks of 128
      bytes, and will fall back to the plain NEON version for tail blocks or
      inputs that are shorter than 128 bytes to begin with.
      
      It will call straight into the plain NEON asm helper, which performs all
      memory accesses in granules of 16 bytes (the size of a NEON register).
      For this reason, the associated plain NEON glue code will copy inputs
      shorter than 16 bytes into a temporary buffer, given that this is a rare
      occurrence and it is not worth the effort to work around this in the asm
      code.
      
      The fallback from the bit-sliced NEON version fails to take this into
      account, potentially resulting in out-of-bounds accesses. So clone the
      same workaround, and use a temp buffer for short in/outputs.
      
      Fixes: fc074e13 ("crypto: arm64/aes-neonbs-ctr - fallback to plain NEON for final chunk")
      Cc: <stable@vger.kernel.org>
      Reported-by: default avatar <syzbot+f1ceaa1a09ab891e1934@syzkaller.appspotmail.com>
      Reviewed-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      034e2d70
    • Peng Ma's avatar
      dmaengine: fsl-qdma: fix SoC may hang on 16 byte unaligned read · 237ecf1a
      Peng Ma authored
      
      
      commit 9d739bcc upstream.
      
      There is chip (ls1028a) errata:
      
      The SoC may hang on 16 byte unaligned read transactions by QDMA.
      
      Unaligned read transactions initiated by QDMA may stall in the NOC
      (Network On-Chip), causing a deadlock condition. Stalled transactions will
      trigger completion timeouts in PCIe controller.
      
      Workaround:
      Enable prefetch by setting the source descriptor prefetchable bit
      ( SD[PF] = 1 ).
      
      Implement this workaround.
      
      Cc: stable@vger.kernel.org
      Fixes: b092529e ("dmaengine: fsl-qdma: Add qDMA controller driver for Layerscape SoCs")
      Signed-off-by: default avatarPeng Ma <peng.ma@nxp.com>
      Signed-off-by: default avatarFrank Li <Frank.Li@nxp.com>
      Link: https://lore.kernel.org/r/20240201215007.439503-1-Frank.Li@nxp.com
      
      
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      237ecf1a
    • Matthew Auld's avatar
      drm/buddy: fix range bias · 8dafc066
      Matthew Auld authored
      
      
      commit f41900e4 upstream.
      
      There is a corner case here where start/end is after/before the block
      range we are currently checking. If so we need to be sure that splitting
      the block will eventually give use the block size we need. To do that we
      should adjust the block range to account for the start/end, and only
      continue with the split if the size/alignment will fit the requested
      size. Not doing so can result in leaving split blocks unmerged when it
      eventually fails.
      
      Fixes: afea229f ("drm: improve drm_buddy_alloc function")
      Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
      Cc: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
      Cc: Christian König <christian.koenig@amd.com>
      Cc: <stable@vger.kernel.org> # v5.18+
      Reviewed-by: default avatarArunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20240219121851.25774-4-matthew.auld@intel.com
      
      
      Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8dafc066
    • Alex Deucher's avatar
      Revert "drm/amd/pm: resolve reboot exception for si oland" · 2e443ed5
      Alex Deucher authored
      commit 95555803 upstream.
      
      This reverts commit e490d60a.
      
      This causes hangs on SI when DC is enabled and errors on driver
      reboot and power off cycles.
      
      Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3216
      Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2755
      
      
      Reviewed-by: default avatarYang Wang <kevinyang.wang@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2e443ed5
    • Filipe Manana's avatar
      btrfs: send: don't issue unnecessary zero writes for trailing hole · 444d7088
      Filipe Manana authored
      
      
      commit 5897710b upstream.
      
      If we have a sparse file with a trailing hole (from the last extent's end
      to i_size) and then create an extent in the file that ends before the
      file's i_size, then when doing an incremental send we will issue a write
      full of zeroes for the range that starts immediately after the new extent
      ends up to i_size. While this isn't incorrect because the file ends up
      with exactly the same data, it unnecessarily results in using extra space
      at the destination with one or more extents full of zeroes instead of
      having a hole. In same cases this results in using megabytes or even
      gigabytes of unnecessary space.
      
      Example, reproducer:
      
         $ cat test.sh
         #!/bin/bash
      
         DEV=/dev/sdh
         MNT=/mnt/sdh
      
         mkfs.btrfs -f $DEV
         mount $DEV $MNT
      
         # Create 1G sparse file.
         xfs_io -f -c "truncate 1G" $MNT/foobar
      
         # Create base snapshot.
         btrfs subvolume snapshot -r $MNT $MNT/mysnap1
      
         # Create send stream (full send) for the base snapshot.
         btrfs send -f /tmp/1.snap $MNT/mysnap1
      
         # Now write one extent at the beginning of the file and one somewhere
         # in the middle, leaving a gap between the end of this second extent
         # and the file's size.
         xfs_io -c "pwrite -S 0xab 0 128K" \
                -c "pwrite -S 0xcd 512M 128K" \
                $MNT/foobar
      
         # Now create a second snapshot which is going to be used for an
         # incremental send operation.
         btrfs subvolume snapshot -r $MNT $MNT/mysnap2
      
         # Create send stream (incremental send) for the second snapshot.
         btrfs send -p $MNT/mysnap1 -f /tmp/2.snap $MNT/mysnap2
      
         # Now recreate the filesystem by receiving both send streams and
         # verify we get the same content that the original filesystem had
         # and file foobar has only two extents with a size of 128K each.
         umount $MNT
         mkfs.btrfs -f $DEV
         mount $DEV $MNT
      
         btrfs receive -f /tmp/1.snap $MNT
         btrfs receive -f /tmp/2.snap $MNT
      
         echo -e "\nFile fiemap in the second snapshot:"
         # Should have:
         #
         # 128K extent at file range [0, 128K[
         # hole at file range [128K, 512M[
         # 128K extent file range [512M, 512M + 128K[
         # hole at file range [512M + 128K, 1G[
         xfs_io -r -c "fiemap -v" $MNT/mysnap2/foobar
      
         # File should be using 256K of data (two 128K extents).
         echo -e "\nSpace used by the file: $(du -h $MNT/mysnap2/foobar | cut -f 1)"
      
         umount $MNT
      
      Running the test, we can see with fiemap that we get an extent for the
      range [512M, 1G[, while in the source filesystem we have an extent for
      the range [512M, 512M + 128K[ and a hole for the rest of the file (the
      range [512M + 128K, 1G[):
      
         $ ./test.sh
         (...)
         File fiemap in the second snapshot:
         /mnt/sdh/mysnap2/foobar:
          EXT: FILE-OFFSET        BLOCK-RANGE        TOTAL FLAGS
            0: [0..255]:          26624..26879         256   0x0
            1: [256..1048575]:    hole             1048320
            2: [1048576..2097151]: 2156544..3205119 1048576   0x1
      
         Space used by the file: 513M
      
      This happens because once we finish processing an inode, at
      finish_inode_if_needed(), we always issue a hole (write operations full
      of zeros) if there's a gap between the end of the last processed extent
      and the file's size, even if that range is already a hole in the parent
      snapshot. Fix this by issuing the hole only if the range is not already
      a hole.
      
      After this change, running the test above, we get the expected layout:
      
         $ ./test.sh
         (...)
         File fiemap in the second snapshot:
         /mnt/sdh/mysnap2/foobar:
          EXT: FILE-OFFSET        BLOCK-RANGE      TOTAL FLAGS
            0: [0..255]:          26624..26879       256   0x0
            1: [256..1048575]:    hole             1048320
            2: [1048576..1048831]: 26880..27135       256   0x1
            3: [1048832..2097151]: hole             1048320
      
         Space used by the file: 256K
      
      A test case for fstests will follow soon.
      
      CC: stable@vger.kernel.org # 6.1+
      Reported-by: default avatarDorai Ashok S A <dash.btrfs@inix.me>
      Link: https://lore.kernel.org/linux-btrfs/c0bf7818-9c45-46a8-b3d3-513230d0c86e@inix.me/
      
      
      Reviewed-by: default avatarSweet Tea Dorminy <sweettea-kernel@dorminy.me>
      Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      444d7088
    • David Sterba's avatar
      btrfs: dev-replace: properly validate device names · f590040c
      David Sterba authored
      commit 9845664b upstream.
      
      There's a syzbot report that device name buffers passed to device
      replace are not properly checked for string termination which could lead
      to a read out of bounds in getname_kernel().
      
      Add a helper that validates both source and target device name buffers.
      For devid as the source initialize the buffer to empty string in case
      something tries to read it later.
      
      This was originally analyzed and fixed in a different way by Edward Adam
      Davis (see links).
      
      Link: https://lore.kernel.org/linux-btrfs/000000000000d1a1d1060cc9c5e7@google.com/
      Link: https://lore.kernel.org/linux-btrfs/tencent_44CA0665C9836EF9EEC80CB9E7E206DF5206@qq.com/
      
      
      CC: stable@vger.kernel.org # 4.19+
      CC: Edward Adam Davis <eadavis@qq.com>
      Reported-and-tested-by: default avatar <syzbot+33f23b49ac24f986c9e8@syzkaller.appspotmail.com>
      Reviewed-by: default avatarBoris Burkov <boris@bur.io>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f590040c
    • Filipe Manana's avatar
      btrfs: fix double free of anonymous device after snapshot creation failure · c34adc20
      Filipe Manana authored
      commit e2b54eaf upstream.
      
      When creating a snapshot we may do a double free of an anonymous device
      in case there's an error committing the transaction. The second free may
      result in freeing an anonymous device number that was allocated by some
      other subsystem in the kernel or another btrfs filesystem.
      
      The steps that lead to this:
      
      1) At ioctl.c:create_snapshot() we allocate an anonymous device number
         and assign it to pending_snapshot->anon_dev;
      
      2) Then we call btrfs_commit_transaction() and end up at
         transaction.c:create_pending_snapshot();
      
      3) There we call btrfs_get_new_fs_root() and pass it the anonymous device
         number stored in pending_snapshot->anon_dev;
      
      4) btrfs_get_new_fs_root() frees that anonymous device number because
         btrfs_lookup_fs_root() returned a root - someone else did a lookup
         of the new root already, which could some task doing backref walking;
      
      5) After that some error happens in the transaction commit path, and at
         ioctl.c:create_snapshot() we jump to the 'fail' label, and after
         that we free again the same anonymous device number, which in the
         meanwhile may have been reallocated somewhere else, because
         pending_snapshot->anon_dev still has the same value as in step 1.
      
      Recently syzbot ran into this and reported the following trace:
      
        ------------[ cut here ]------------
        ida_free called for id=51 which is not allocated.
        WARNING: CPU: 1 PID: 31038 at lib/idr.c:525 ida_free+0x370/0x420 lib/idr.c:525
        Modules linked in:
        CPU: 1 PID: 31038 Comm: syz-executor.2 Not tainted 6.8.0-rc4-syzkaller-00410-gc02197fc9076 #0
        Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
        RIP: 0010:ida_free+0x370/0x420 lib/idr.c:525
        Code: 10 42 80 3c 28 (...)
        RSP: 0018:ffffc90015a67300 EFLAGS: 00010246
        RAX: be5130472f5dd000 RBX: 0000000000000033 RCX: 0000000000040000
        RDX: ffffc90009a7a000 RSI: 000000000003ffff RDI: 0000000000040000
        RBP: ffffc90015a673f0 R08: ffffffff81577992 R09: 1ffff92002b4cdb4
        R10: dffffc0000000000 R11: fffff52002b4cdb5 R12: 0000000000000246
        R13: dffffc0000000000 R14: ffffffff8e256b80 R15: 0000000000000246
        FS:  00007fca3f4b46c0(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 00007f167a17b978 CR3: 000000001ed26000 CR4: 0000000000350ef0
        Call Trace:
         <TASK>
         btrfs_get_root_ref+0xa48/0xaf0 fs/btrfs/disk-io.c:1346
         create_pending_snapshot+0xff2/0x2bc0 fs/btrfs/transaction.c:1837
         create_pending_snapshots+0x195/0x1d0 fs/btrfs/transaction.c:1931
         btrfs_commit_transaction+0xf1c/0x3740 fs/btrfs/transaction.c:2404
         create_snapshot+0x507/0x880 fs/btrfs/ioctl.c:848
         btrfs_mksubvol+0x5d0/0x750 fs/btrfs/ioctl.c:998
         btrfs_mksnapshot+0xb5/0xf0 fs/btrfs/ioctl.c:1044
         __btrfs_ioctl_snap_create+0x387/0x4b0 fs/btrfs/ioctl.c:1306
         btrfs_ioctl_snap_create_v2+0x1ca/0x400 fs/btrfs/ioctl.c:1393
         btrfs_ioctl+0xa74/0xd40
         vfs_ioctl fs/ioctl.c:51 [inline]
         __do_sys_ioctl fs/ioctl.c:871 [inline]
         __se_sys_ioctl+0xfe/0x170 fs/ioctl.c:857
         do_syscall_64+0xfb/0x240
         entry_SYSCALL_64_after_hwframe+0x6f/0x77
        RIP: 0033:0x7fca3e67dda9
        Code: 28 00 00 00 (...)
        RSP: 002b:00007fca3f4b40c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
        RAX: ffffffffffffffda RBX: 00007fca3e7abf80 RCX: 00007fca3e67dda9
        RDX: 00000000200005c0 RSI: 0000000050009417 RDI: 0000000000000003
        RBP: 00007fca3e6ca47a R08: 0000000000000000 R09: 0000000000000000
        R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
        R13: 000000000000000b R14: 00007fca3e7abf80 R15: 00007fff6bf95658
         </TASK>
      
      Where we get an explicit message where we attempt to free an anonymous
      device number that is not currently allocated. It happens in a different
      code path from the example below, at btrfs_get_root_ref(), so this change
      may not fix the case triggered by syzbot.
      
      To fix at least the code path from the example above, change
      btrfs_get_root_ref() and its callers to receive a dev_t pointer argument
      for the anonymous device number, so that in case it frees the number, it
      also resets it to 0, so that up in the call chain we don't attempt to do
      the double free.
      
      CC: stable@vger.kernel.org # 5.10+
      Link: https://lore.kernel.org/linux-btrfs/000000000000f673a1061202f630@google.com/
      
      
      Fixes: e03ee2fe ("btrfs: do not ASSERT() if the newly created subvolume already got read")
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c34adc20
    • Johannes Berg's avatar
      wifi: nl80211: reject iftype change with mesh ID change · 930e8269
      Johannes Berg authored
      
      
      commit f78c1375 upstream.
      
      It's currently possible to change the mesh ID when the
      interface isn't yet in mesh mode, at the same time as
      changing it into mesh mode. This leads to an overwrite
      of data in the wdev->u union for the interface type it
      currently has, causing cfg80211_change_iface() to do
      wrong things when switching.
      
      We could probably allow setting an interface to mesh
      while setting the mesh ID at the same time by doing a
      different order of operations here, but realistically
      there's no userspace that's going to do this, so just
      disallow changes in iftype when setting mesh ID.
      
      Cc: stable@vger.kernel.org
      Fixes: 29cbe68c ("cfg80211/mac80211: add mesh join/leave commands")
      Reported-by: default avatar <syzbot+dd4779978217b1973180@syzkaller.appspotmail.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      930e8269
    • Alexander Ofitserov's avatar
      gtp: fix use-after-free and null-ptr-deref in gtp_newlink() · abd32d7f
      Alexander Ofitserov authored
      
      
      commit 616d82c3 upstream.
      
      The gtp_link_ops operations structure for the subsystem must be
      registered after registering the gtp_net_ops pernet operations structure.
      
      Syzkaller hit 'general protection fault in gtp_genl_dump_pdp' bug:
      
      [ 1010.702740] gtp: GTP module unloaded
      [ 1010.715877] general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI
      [ 1010.715888] KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
      [ 1010.715895] CPU: 1 PID: 128616 Comm: a.out Not tainted 6.8.0-rc6-std-def-alt1 #1
      [ 1010.715899] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.0-alt1 04/01/2014
      [ 1010.715908] RIP: 0010:gtp_newlink+0x4d7/0x9c0 [gtp]
      [ 1010.715915] Code: 80 3c 02 00 0f 85 41 04 00 00 48 8b bb d8 05 00 00 e8 ed f6 ff ff 48 89 c2 48 89 c5 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80> 3c 02 00 0f 85 4f 04 00 00 4c 89 e2 4c 8b 6d 00 48 b8 00 00 00
      [ 1010.715920] RSP: 0018:ffff888020fbf180 EFLAGS: 00010203
      [ 1010.715929] RAX: dffffc0000000000 RBX: ffff88800399c000 RCX: 0000000000000000
      [ 1010.715933] RDX: 0000000000000001 RSI: ffffffff84805280 RDI: 0000000000000282
      [ 1010.715938] RBP: 000000000000000d R08: 0000000000000001 R09: 0000000000000000
      [ 1010.715942] R10: 0000000000000001 R11: 0000000000000001 R12: ffff88800399cc80
      [ 1010.715947] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000400
      [ 1010.715953] FS:  00007fd1509ab5c0(0000) GS:ffff88805b300000(0000) knlGS:0000000000000000
      [ 1010.715958] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [ 1010.715962] CR2: 0000000000000000 CR3: 000000001c07a000 CR4: 0000000000750ee0
      [ 1010.715968] PKRU: 55555554
      [ 1010.715972] Call Trace:
      [ 1010.715985]  ? __die_body.cold+0x1a/0x1f
      [ 1010.715995]  ? die_addr+0x43/0x70
      [ 1010.716002]  ? exc_general_protection+0x199/0x2f0
      [ 1010.716016]  ? asm_exc_general_protection+0x1e/0x30
      [ 1010.716026]  ? gtp_newlink+0x4d7/0x9c0 [gtp]
      [ 1010.716034]  ? gtp_net_exit+0x150/0x150 [gtp]
      [ 1010.716042]  __rtnl_newlink+0x1063/0x1700
      [ 1010.716051]  ? rtnl_setlink+0x3c0/0x3c0
      [ 1010.716063]  ? is_bpf_text_address+0xc0/0x1f0
      [ 1010.716070]  ? kernel_text_address.part.0+0xbb/0xd0
      [ 1010.716076]  ? __kernel_text_address+0x56/0xa0
      [ 1010.716084]  ? unwind_get_return_address+0x5a/0xa0
      [ 1010.716091]  ? create_prof_cpu_mask+0x30/0x30
      [ 1010.716098]  ? arch_stack_walk+0x9e/0xf0
      [ 1010.716106]  ? stack_trace_save+0x91/0xd0
      [ 1010.716113]  ? stack_trace_consume_entry+0x170/0x170
      [ 1010.716121]  ? __lock_acquire+0x15c5/0x5380
      [ 1010.716139]  ? mark_held_locks+0x9e/0xe0
      [ 1010.716148]  ? kmem_cache_alloc_trace+0x35f/0x3c0
      [ 1010.716155]  ? __rtnl_newlink+0x1700/0x1700
      [ 1010.716160]  rtnl_newlink+0x69/0xa0
      [ 1010.716166]  rtnetlink_rcv_msg+0x43b/0xc50
      [ 1010.716172]  ? rtnl_fdb_dump+0x9f0/0x9f0
      [ 1010.716179]  ? lock_acquire+0x1fe/0x560
      [ 1010.716188]  ? netlink_deliver_tap+0x12f/0xd50
      [ 1010.716196]  netlink_rcv_skb+0x14d/0x440
      [ 1010.716202]  ? rtnl_fdb_dump+0x9f0/0x9f0
      [ 1010.716208]  ? netlink_ack+0xab0/0xab0
      [ 1010.716213]  ? netlink_deliver_tap+0x202/0xd50
      [ 1010.716220]  ? netlink_deliver_tap+0x218/0xd50
      [ 1010.716226]  ? __virt_addr_valid+0x30b/0x590
      [ 1010.716233]  netlink_unicast+0x54b/0x800
      [ 1010.716240]  ? netlink_attachskb+0x870/0x870
      [ 1010.716248]  ? __check_object_size+0x2de/0x3b0
      [ 1010.716254]  netlink_sendmsg+0x938/0xe40
      [ 1010.716261]  ? netlink_unicast+0x800/0x800
      [ 1010.716269]  ? __import_iovec+0x292/0x510
      [ 1010.716276]  ? netlink_unicast+0x800/0x800
      [ 1010.716284]  __sock_sendmsg+0x159/0x190
      [ 1010.716290]  ____sys_sendmsg+0x712/0x880
      [ 1010.716297]  ? sock_write_iter+0x3d0/0x3d0
      [ 1010.716304]  ? __ia32_sys_recvmmsg+0x270/0x270
      [ 1010.716309]  ? lock_acquire+0x1fe/0x560
      [ 1010.716315]  ? drain_array_locked+0x90/0x90
      [ 1010.716324]  ___sys_sendmsg+0xf8/0x170
      [ 1010.716331]  ? sendmsg_copy_msghdr+0x170/0x170
      [ 1010.716337]  ? lockdep_init_map_type+0x2c7/0x860
      [ 1010.716343]  ? lockdep_hardirqs_on_prepare+0x430/0x430
      [ 1010.716350]  ? debug_mutex_init+0x33/0x70
      [ 1010.716360]  ? percpu_counter_add_batch+0x8b/0x140
      [ 1010.716367]  ? lock_acquire+0x1fe/0x560
      [ 1010.716373]  ? find_held_lock+0x2c/0x110
      [ 1010.716384]  ? __fd_install+0x1b6/0x6f0
      [ 1010.716389]  ? lock_downgrade+0x810/0x810
      [ 1010.716396]  ? __fget_light+0x222/0x290
      [ 1010.716403]  __sys_sendmsg+0xea/0x1b0
      [ 1010.716409]  ? __sys_sendmsg_sock+0x40/0x40
      [ 1010.716419]  ? lockdep_hardirqs_on_prepare+0x2b3/0x430
      [ 1010.716425]  ? syscall_enter_from_user_mode+0x1d/0x60
      [ 1010.716432]  do_syscall_64+0x30/0x40
      [ 1010.716438]  entry_SYSCALL_64_after_hwframe+0x62/0xc7
      [ 1010.716444] RIP: 0033:0x7fd1508cbd49
      [ 1010.716452] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d ef 70 0d 00 f7 d8 64 89 01 48
      [ 1010.716456] RSP: 002b:00007fff18872348 EFLAGS: 00000202 ORIG_RAX: 000000000000002e
      [ 1010.716463] RAX: ffffffffffffffda RBX: 000055f72bf0eac0 RCX: 00007fd1508cbd49
      [ 1010.716468] RDX: 0000000000000000 RSI: 0000000020000280 RDI: 0000000000000006
      [ 1010.716473] RBP: 00007fff18872360 R08: 00007fff18872360 R09: 00007fff18872360
      [ 1010.716478] R10: 00007fff18872360 R11: 0000000000000202 R12: 000055f72bf0e1b0
      [ 1010.716482] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
      [ 1010.716491] Modules linked in: gtp(+) udp_tunnel ib_core uinput af_packet rfkill qrtr joydev hid_generic usbhid hid kvm_intel iTCO_wdt intel_pmc_bxt iTCO_vendor_support kvm snd_hda_codec_generic ledtrig_audio irqbypass crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel snd_hda_intel nls_utf8 snd_intel_dspcfg nls_cp866 psmouse aesni_intel vfat crypto_simd fat cryptd glue_helper snd_hda_codec pcspkr snd_hda_core i2c_i801 snd_hwdep i2c_smbus xhci_pci snd_pcm lpc_ich xhci_pci_renesas xhci_hcd qemu_fw_cfg tiny_power_button button sch_fq_codel vboxvideo drm_vram_helper drm_ttm_helper ttm vboxsf vboxguest snd_seq_midi snd_seq_midi_event snd_seq snd_rawmidi snd_seq_device snd_timer snd soundcore msr fuse efi_pstore dm_mod ip_tables x_tables autofs4 virtio_gpu virtio_dma_buf drm_kms_helper cec rc_core drm virtio_rng virtio_scsi rng_core virtio_balloon virtio_blk virtio_net virtio_console net_failover failover ahci libahci libata evdev scsi_mod input_leds serio_raw virtio_pci intel_agp
      [ 1010.716674]  virtio_ring intel_gtt virtio [last unloaded: gtp]
      [ 1010.716693] ---[ end trace 04990a4ce61e174b ]---
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAlexander Ofitserov <oficerovas@altlinux.org>
      Fixes: 459aa660 ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)")
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Link: https://lore.kernel.org/r/20240228114703.465107-1-oficerovas@altlinux.org
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      abd32d7f