Skip to content
  1. Feb 23, 2024
    • Kuniyuki Iwashima's avatar
      af_unix: Fix task hung while purging oob_skb in GC. · 36f7371d
      Kuniyuki Iwashima authored
      commit 25236c91
      
       upstream.
      
      syzbot reported a task hung; at the same time, GC was looping infinitely
      in list_for_each_entry_safe() for OOB skb.  [0]
      
      syzbot demonstrated that the list_for_each_entry_safe() was not actually
      safe in this case.
      
      A single skb could have references for multiple sockets.  If we free such
      a skb in the list_for_each_entry_safe(), the current and next sockets could
      be unlinked in a single iteration.
      
      unix_notinflight() uses list_del_init() to unlink the socket, so the
      prefetched next socket forms a loop itself and list_for_each_entry_safe()
      never stops.
      
      Here, we must use while() and make sure we always fetch the first socket.
      
      [0]:
      Sending NMI from CPU 0 to CPUs 1:
      NMI backtrace for cpu 1
      CPU: 1 PID: 5065 Comm: syz-executor236 Not tainted 6.8.0-rc3-syzkaller-00136-g1f719a2f3fa6 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
      RIP: 0010:preempt_count arch/x86/include/asm/preempt.h:26 [inline]
      RIP: 0010:check_kcov_mode kernel/kcov.c:173 [inline]
      RIP: 0010:__sanitizer_cov_trace_pc+0xd/0x60 kernel/kcov.c:207
      Code: cc cc cc cc 66 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 65 48 8b 14 25 40 c2 03 00 <65> 8b 05 b4 7c 78 7e a9 00 01 ff 00 48 8b 34 24 74 0f f6 c4 01 74
      RSP: 0018:ffffc900033efa58 EFLAGS: 00000283
      RAX: ffff88807b077800 RBX: ffff88807b077800 RCX: 1ffffffff27b1189
      RDX: ffff88802a5a3b80 RSI: ffffffff8968488d RDI: ffff88807b077f70
      RBP: ffffc900033efbb0 R08: 0000000000000001 R09: fffffbfff27a900c
      R10: ffffffff93d48067 R11: ffffffff8ae000eb R12: ffff88807b077800
      R13: dffffc0000000000 R14: ffff88807b077e40 R15: 0000000000000001
      FS:  0000000000000000(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000564f4fc1e3a8 CR3: 000000000d57a000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <NMI>
       </NMI>
       <TASK>
       unix_gc+0x563/0x13b0 net/unix/garbage.c:319
       unix_release_sock+0xa93/0xf80 net/unix/af_unix.c:683
       unix_release+0x91/0xf0 net/unix/af_unix.c:1064
       __sock_release+0xb0/0x270 net/socket.c:659
       sock_close+0x1c/0x30 net/socket.c:1421
       __fput+0x270/0xb80 fs/file_table.c:376
       task_work_run+0x14f/0x250 kernel/task_work.c:180
       exit_task_work include/linux/task_work.h:38 [inline]
       do_exit+0xa8a/0x2ad0 kernel/exit.c:871
       do_group_exit+0xd4/0x2a0 kernel/exit.c:1020
       __do_sys_exit_group kernel/exit.c:1031 [inline]
       __se_sys_exit_group kernel/exit.c:1029 [inline]
       __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1029
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xd5/0x270 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x6f/0x77
      RIP: 0033:0x7f9d6cbdac09
      Code: Unable to access opcode bytes at 0x7f9d6cbdabdf.
      RSP: 002b:00007fff5952feb8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
      RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f9d6cbdac09
      RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000
      RBP: 00007f9d6cc552b0 R08: ffffffffffffffb8 R09: 0000000000000006
      R10: 0000000000000006 R11: 0000000000000246 R12: 00007f9d6cc552b0
      R13: 0000000000000000 R14: 00007f9d6cc55d00 R15: 00007f9d6cbabe70
       </TASK>
      
      Reported-by: default avatar <syzbot+4fa4a2d1f5a5ee06f006@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=4fa4a2d1f5a5ee06f006
      Fixes: 1279f9d9
      
       ("af_unix: Call kfree_skb() for dead unix_(sk)->oob_skb in GC.")
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Link: https://lore.kernel.org/r/20240209220453.96053-1-kuniyu@amazon.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      36f7371d
    • Steven Rostedt (Google)'s avatar
      tracing: Inform kmemleak of saved_cmdlines allocation · ff2f35f5
      Steven Rostedt (Google) authored
      commit 2394ac41 upstream.
      
      The allocation of the struct saved_cmdlines_buffer structure changed from:
      
              s = kmalloc(sizeof(*s), GFP_KERNEL);
      	s->saved_cmdlines = kmalloc_array(TASK_COMM_LEN, val, GFP_KERNEL);
      
      to:
      
      	orig_size = sizeof(*s) + val * TASK_COMM_LEN;
      	order = get_order(orig_size);
      	size = 1 << (order + PAGE_SHIFT);
      	page = alloc_pages(GFP_KERNEL, order);
      	if (!page)
      		return NULL;
      
      	s = page_address(page);
      	memset(s, 0, sizeof(*s));
      
      	s->saved_cmdlines = kmalloc_array(TASK_COMM_LEN, val, GFP_KERNEL);
      
      Where that s->saved_cmdlines allocation looks to be a dangling allocation
      to kmemleak. That's because kmemleak only keeps track of kmalloc()
      allocations. For allocations that use page_alloc() directly, the kmemleak
      needs to be explicitly informed about it.
      
      Add kmemleak_alloc() and kmemleak_free() around the page allocation so
      that it doesn't give the following false positive:
      
      unreferenced object 0xffff8881010c8000 (size 32760):
        comm "swapper", pid 0, jiffies 4294667296
        hex dump (first 32 bytes):
          ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
          ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
        backtrace (crc ae6ec1b9):
          [<ffffffff86722405>] kmemleak_alloc+0x45/0x80
          [<ffffffff8414028d>] __kmalloc_large_node+0x10d/0x190
          [<ffffffff84146ab1>] __kmalloc+0x3b1/0x4c0
          [<ffffffff83ed7103>] allocate_cmdlines_buffer+0x113/0x230
          [<ffffffff88649c34>] tracer_alloc_buffers.isra.0+0x124/0x460
          [<ffffffff8864a174>] early_trace_init+0x14/0xa0
          [<ffffffff885dd5ae>] start_kernel+0x12e/0x3c0
          [<ffffffff885f5758>] x86_64_start_reservations+0x18/0x30
          [<ffffffff885f582b>] x86_64_start_kernel+0x7b/0x80
          [<ffffffff83a001c3>] secondary_startup_64_no_verify+0x15e/0x16b
      
      Link: https://lore.kernel.org/linux-trace-kernel/87r0hfnr9r.fsf@kernel.org/
      Link: https://lore.kernel.org/linux-trace-kernel/20240214112046.09a322d6@gandalf.local.home
      
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Fixes: 44dc5c41
      
       ("tracing: Fix wasted memory in saved_cmdlines logic")
      Reported-by: default avatarKalle Valo <kvalo@kernel.org>
      Tested-by: default avatarKalle Valo <kvalo@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ff2f35f5
    • Konrad Dybcio's avatar
      pmdomain: core: Move the unused cleanup to a _sync initcall · 579cb4ff
      Konrad Dybcio authored
      commit 741ba013 upstream.
      
      The unused clock cleanup uses the _sync initcall to give all users at
      earlier initcalls time to probe. Do the same to avoid leaving some PDs
      dangling at "on" (which actually happened on qcom!).
      
      Fixes: 2fe71dcd
      
       ("PM / domains: Add late_initcall to disable unused PM domains")
      Signed-off-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20231227-topic-pmdomain_sync_cleanup-v1-1-5f36769d538b@linaro.org
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      579cb4ff
    • Oleksij Rempel's avatar
      can: j1939: Fix UAF in j1939_sk_match_filter during setsockopt(SO_J1939_FILTER) · 41ccb5bc
      Oleksij Rempel authored
      commit efe7cf82 upstream.
      
      Lock jsk->sk to prevent UAF when setsockopt(..., SO_J1939_FILTER, ...)
      modifies jsk->filters while receiving packets.
      
      Following trace was seen on affected system:
       ==================================================================
       BUG: KASAN: slab-use-after-free in j1939_sk_recv_match_one+0x1af/0x2d0 [can_j1939]
       Read of size 4 at addr ffff888012144014 by task j1939/350
      
       CPU: 0 PID: 350 Comm: j1939 Tainted: G        W  OE      6.5.0-rc5 #1
       Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
       Call Trace:
        print_report+0xd3/0x620
        ? kasan_complete_mode_report_info+0x7d/0x200
        ? j1939_sk_recv_match_one+0x1af/0x2d0 [can_j1939]
        kasan_report+0xc2/0x100
        ? j1939_sk_recv_match_one+0x1af/0x2d0 [can_j1939]
        __asan_load4+0x84/0xb0
        j1939_sk_recv_match_one+0x1af/0x2d0 [can_j1939]
        j1939_sk_recv+0x20b/0x320 [can_j1939]
        ? __kasan_check_write+0x18/0x20
        ? __pfx_j1939_sk_recv+0x10/0x10 [can_j1939]
        ? j1939_simple_recv+0x69/0x280 [can_j1939]
        ? j1939_ac_recv+0x5e/0x310 [can_j1939]
        j1939_can_recv+0x43f/0x580 [can_j1939]
        ? __pfx_j1939_can_recv+0x10/0x10 [can_j1939]
        ? raw_rcv+0x42/0x3c0 [can_raw]
        ? __pfx_j1939_can_recv+0x10/0x10 [can_j1939]
        can_rcv_filter+0x11f/0x350 [can]
        can_receive+0x12f/0x190 [can]
        ? __pfx_can_rcv+0x10/0x10 [can]
        can_rcv+0xdd/0x130 [can]
        ? __pfx_can_rcv+0x10/0x10 [can]
        __netif_receive_skb_one_core+0x13d/0x150
        ? __pfx___netif_receive_skb_one_core+0x10/0x10
        ? __kasan_check_write+0x18/0x20
        ? _raw_spin_lock_irq+0x8c/0xe0
        __netif_receive_skb+0x23/0xb0
        process_backlog+0x107/0x260
        __napi_poll+0x69/0x310
        net_rx_action+0x2a1/0x580
        ? __pfx_net_rx_action+0x10/0x10
        ? __pfx__raw_spin_lock+0x10/0x10
        ? handle_irq_event+0x7d/0xa0
        __do_softirq+0xf3/0x3f8
        do_softirq+0x53/0x80
        </IRQ>
        <TASK>
        __local_bh_enable_ip+0x6e/0x70
        netif_rx+0x16b/0x180
        can_send+0x32b/0x520 [can]
        ? __pfx_can_send+0x10/0x10 [can]
        ? __check_object_size+0x299/0x410
        raw_sendmsg+0x572/0x6d0 [can_raw]
        ? __pfx_raw_sendmsg+0x10/0x10 [can_raw]
        ? apparmor_socket_sendmsg+0x2f/0x40
        ? __pfx_raw_sendmsg+0x10/0x10 [can_raw]
        sock_sendmsg+0xef/0x100
        sock_write_iter+0x162/0x220
        ? __pfx_sock_write_iter+0x10/0x10
        ? __rtnl_unlock+0x47/0x80
        ? security_file_permission+0x54/0x320
        vfs_write+0x6ba/0x750
        ? __pfx_vfs_write+0x10/0x10
        ? __fget_light+0x1ca/0x1f0
        ? __rcu_read_unlock+0x5b/0x280
        ksys_write+0x143/0x170
        ? __pfx_ksys_write+0x10/0x10
        ? __kasan_check_read+0x15/0x20
        ? fpregs_assert_state_consistent+0x62/0x70
        __x64_sys_write+0x47/0x60
        do_syscall_64+0x60/0x90
        ? do_syscall_64+0x6d/0x90
        ? irqentry_exit+0x3f/0x50
        ? exc_page_fault+0x79/0xf0
        entry_SYSCALL_64_after_hwframe+0x6e/0xd8
      
       Allocated by task 348:
        kasan_save_stack+0x2a/0x50
        kasan_set_track+0x29/0x40
        kasan_save_alloc_info+0x1f/0x30
        __kasan_kmalloc+0xb5/0xc0
        __kmalloc_node_track_caller+0x67/0x160
        j1939_sk_setsockopt+0x284/0x450 [can_j1939]
        __sys_setsockopt+0x15c/0x2f0
        __x64_sys_setsockopt+0x6b/0x80
        do_syscall_64+0x60/0x90
        entry_SYSCALL_64_after_hwframe+0x6e/0xd8
      
       Freed by task 349:
        kasan_save_stack+0x2a/0x50
        kasan_set_track+0x29/0x40
        kasan_save_free_info+0x2f/0x50
        __kasan_slab_free+0x12e/0x1c0
        __kmem_cache_free+0x1b9/0x380
        kfree+0x7a/0x120
        j1939_sk_setsockopt+0x3b2/0x450 [can_j1939]
        __sys_setsockopt+0x15c/0x2f0
        __x64_sys_setsockopt+0x6b/0x80
        do_syscall_64+0x60/0x90
        entry_SYSCALL_64_after_hwframe+0x6e/0xd8
      
      Fixes: 9d71dd0c
      
       ("can: add support of SAE J1939 protocol")
      Reported-by: default avatarSili Luo <rootlab@huawei.com>
      Suggested-by: default avatarSili Luo <rootlab@huawei.com>
      Acked-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Link: https://lore.kernel.org/all/20231020133814.383996-1-o.rempel@pengutronix.de
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      41ccb5bc
    • Ziqi Zhao's avatar
      can: j1939: prevent deadlock by changing j1939_socks_lock to rwlock · 03358aba
      Ziqi Zhao authored
      commit 6cdedc18
      
       upstream.
      
      The following 3 locks would race against each other, causing the
      deadlock situation in the Syzbot bug report:
      
      - j1939_socks_lock
      - active_session_list_lock
      - sk_session_queue_lock
      
      A reasonable fix is to change j1939_socks_lock to an rwlock, since in
      the rare situations where a write lock is required for the linked list
      that j1939_socks_lock is protecting, the code does not attempt to
      acquire any more locks. This would break the circular lock dependency,
      where, for example, the current thread already locks j1939_socks_lock
      and attempts to acquire sk_session_queue_lock, and at the same time,
      another thread attempts to acquire j1939_socks_lock while holding
      sk_session_queue_lock.
      
      NOTE: This patch along does not fix the unregister_netdevice bug
      reported by Syzbot; instead, it solves a deadlock situation to prepare
      for one or more further patches to actually fix the Syzbot bug, which
      appears to be a reference counting problem within the j1939 codebase.
      
      Reported-by: default avatar <syzbot+1591462f226d9cbf0564@syzkaller.appspotmail.com>
      Signed-off-by: default avatarZiqi Zhao <astrajoan@yahoo.com>
      Reviewed-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Acked-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Link: https://lore.kernel.org/all/20230721162226.8639-1-astrajoan@yahoo.com
      [mkl: remove unrelated newline change]
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      03358aba
    • Nuno Sa's avatar
      of: property: fix typo in io-channels · 6315697f
      Nuno Sa authored
      commit 8f7e9179 upstream.
      
      The property is io-channels and not io-channel. This was effectively
      preventing the devlink creation.
      
      Fixes: 8e12257d
      
       ("of: property: Add device link support for iommus, mboxes and io-channels")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNuno Sa <nuno.sa@analog.com>
      Reviewed-by: default avatarSaravana Kannan <saravanak@google.com>
      Acked-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Link: https://lore.kernel.org/r/20240123-iio-backend-v7-1-1bff236b8693@analog.com
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6315697f
    • Prakash Sangappa's avatar
      mm: hugetlb pages should not be reserved by shmat() if SHM_NORESERVE · 310c7d98
      Prakash Sangappa authored
      commit e656c7a9
      
       upstream.
      
      For shared memory of type SHM_HUGETLB, hugetlb pages are reserved in
      shmget() call.  If SHM_NORESERVE flags is specified then the hugetlb pages
      are not reserved.  However when the shared memory is attached with the
      shmat() call the hugetlb pages are getting reserved incorrectly for
      SHM_HUGETLB shared memory created with SHM_NORESERVE which is a bug.
      
      -------------------------------
      Following test shows the issue.
      
      $cat shmhtb.c
      
      int main()
      {
      	int shmflags = 0660 | IPC_CREAT | SHM_HUGETLB | SHM_NORESERVE;
      	int shmid;
      
      	shmid = shmget(SKEY, SHMSZ, shmflags);
      	if (shmid < 0)
      	{
      		printf("shmat: shmget() failed, %d\n", errno);
      		return 1;
      	}
      	printf("After shmget()\n");
      	system("cat /proc/meminfo | grep -i hugepages_");
      
      	shmat(shmid, NULL, 0);
      	printf("\nAfter shmat()\n");
      	system("cat /proc/meminfo | grep -i hugepages_");
      
      	shmctl(shmid, IPC_RMID, NULL);
      	return 0;
      }
      
       #sysctl -w vm.nr_hugepages=20
       #./shmhtb
      
      After shmget()
      HugePages_Total:      20
      HugePages_Free:       20
      HugePages_Rsvd:        0
      HugePages_Surp:        0
      
      After shmat()
      HugePages_Total:      20
      HugePages_Free:       20
      HugePages_Rsvd:        5 <--
      HugePages_Surp:        0
      --------------------------------
      
      Fix is to ensure that hugetlb pages are not reserved for SHM_HUGETLB shared
      memory in the shmat() call.
      
      Link: https://lkml.kernel.org/r/1706040282-12388-1-git-send-email-prakash.sangappa@oracle.com
      Signed-off-by: default avatarPrakash Sangappa <prakash.sangappa@oracle.com>
      Acked-by: default avatarMuchun Song <muchun.song@linux.dev>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      310c7d98
    • Rishabh Dave's avatar
      ceph: prevent use-after-free in encode_cap_msg() · 70e329b4
      Rishabh Dave authored
      commit cda4672d
      
       upstream.
      
      In fs/ceph/caps.c, in encode_cap_msg(), "use after free" error was
      caught by KASAN at this line - 'ceph_buffer_get(arg->xattr_buf);'. This
      implies before the refcount could be increment here, it was freed.
      
      In same file, in "handle_cap_grant()" refcount is decremented by this
      line - 'ceph_buffer_put(ci->i_xattrs.blob);'. It appears that a race
      occurred and resource was freed by the latter line before the former
      line could increment it.
      
      encode_cap_msg() is called by __send_cap() and __send_cap() is called by
      ceph_check_caps() after calling __prep_cap(). __prep_cap() is where
      arg->xattr_buf is assigned to ci->i_xattrs.blob. This is the spot where
      the refcount must be increased to prevent "use after free" error.
      
      Cc: stable@vger.kernel.org
      Link: https://tracker.ceph.com/issues/59259
      Signed-off-by: default avatarRishabh Dave <ridave@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      Reviewed-by: default avatarXiubo Li <xiubli@redhat.com>
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      70e329b4
    • Sinthu Raja's avatar
      net: ethernet: ti: cpsw_new: enable mac_managed_pm to fix mdio · 99fa6d45
      Sinthu Raja authored
      commit 9def04e7 upstream.
      
      The below commit  introduced a WARN when phy state is not in the states:
      PHY_HALTED, PHY_READY and PHY_UP.
      commit 744d23c7 ("net: phy: Warn about incorrect mdio_bus_phy_resume() state")
      
      When cpsw_new resumes, there have port in PHY_NOLINK state, so the below
      warning comes out. Set mac_managed_pm be true to tell mdio that the phy
      resume/suspend is managed by the mac, to fix the following warning:
      
      WARNING: CPU: 0 PID: 965 at drivers/net/phy/phy_device.c:326 mdio_bus_phy_resume+0x140/0x144
      CPU: 0 PID: 965 Comm: sh Tainted: G           O       6.1.46-g247b2535b2 #1
      Hardware name: Generic AM33XX (Flattened Device Tree)
       unwind_backtrace from show_stack+0x18/0x1c
       show_stack from dump_stack_lvl+0x24/0x2c
       dump_stack_lvl from __warn+0x84/0x15c
       __warn from warn_slowpath_fmt+0x1a8/0x1c8
       warn_slowpath_fmt from mdio_bus_phy_resume+0x140/0x144
       mdio_bus_phy_resume from dpm_run_callback+0x3c/0x140
       dpm_run_callback from device_resume+0xb8/0x2b8
       device_resume from dpm_resume+0x144/0x314
       dpm_resume from dpm_resume_end+0x14/0x20
       dpm_resume_end from suspend_devices_and_enter+0xd0/0x924
       suspend_devices_and_enter from pm_suspend+0x2e0/0x33c
       pm_suspend from state_store+0x74/0xd0
       state_store from kernfs_fop_write_iter+0x104/0x1ec
       kernfs_fop_write_iter from vfs_write+0x1b8/0x358
       vfs_write from ksys_write+0x78/0xf8
       ksys_write from ret_fast_syscall+0x0/0x54
      Exception stack(0xe094dfa8 to 0xe094dff0)
      dfa0:                   00000004 005c3fb8 00000001 005c3fb8 00000004 00000001
      dfc0: 00000004 005c3fb8 b6f6bba0 00000004 00000004 0059edb8 00000000 00000000
      dfe0: 00000004 bed918f0 b6f09bd3 b6e89a66
      
      Cc: <stable@vger.kernel.org> # v6.0+
      Fixes: 744d23c7 ("net: phy: Warn about incorrect mdio_bus_phy_resume() state")
      Fixes: fba863b8
      
       ("net: phy: make PHY PM ops a no-op if MAC driver manages PHY PM")
      Signed-off-by: default avatarSinthu Raja <sinthu.raja@ti.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      99fa6d45
    • Alexandra Winter's avatar
      s390/qeth: Fix potential loss of L3-IP@ in case of network issues · ff42d99e
      Alexandra Winter authored
      commit 2fe8a236 upstream.
      
      Symptom:
      In case of a bad cable connection (e.g. dirty optics) a fast sequence of
      network DOWN-UP-DOWN-UP could happen. UP triggers recovery of the qeth
      interface. In case of a second DOWN while recovery is still ongoing, it
      can happen that the IP@ of a Layer3 qeth interface is lost and will not
      be recovered by the second UP.
      
      Problem:
      When registration of IP addresses with Layer 3 qeth devices fails, (e.g.
      because of bad address format) the respective IP address is deleted from
      its hash-table in the driver. If registration fails because of a ENETDOWN
      condition, the address should stay in the hashtable, so a subsequent
      recovery can restore it.
      
      3caa4af8 ("qeth: keep ip-address after LAN_OFFLINE failure")
      fixes this for registration failures during normal operation, but not
      during recovery.
      
      Solution:
      Keep L3-IP address in case of ENETDOWN in qeth_l3_recover_ip(). For
      consistency with qeth_l3_add_ip() we also keep it in case of EADDRINUSE,
      i.e. for some reason the card already/still has this address registered.
      
      Fixes: 4a71df50
      
       ("qeth: new qeth device driver")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAlexandra Winter <wintera@linux.ibm.com>
      Link: https://lore.kernel.org/r/20240206085849.2902775-1-wintera@linux.ibm.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ff42d99e
    • Sinthu Raja's avatar
      net: ethernet: ti: cpsw: enable mac_managed_pm to fix mdio · ddb4be0e
      Sinthu Raja authored
      commit bc4ce46b upstream.
      
      The below commit  introduced a WARN when phy state is not in the states:
      PHY_HALTED, PHY_READY and PHY_UP.
      commit 744d23c7 ("net: phy: Warn about incorrect mdio_bus_phy_resume() state")
      
      When cpsw resumes, there have port in PHY_NOLINK state, so the below
      warning comes out. Set mac_managed_pm be true to tell mdio that the phy
      resume/suspend is managed by the mac, to fix the following warning:
      
      WARNING: CPU: 0 PID: 965 at drivers/net/phy/phy_device.c:326 mdio_bus_phy_resume+0x140/0x144
      CPU: 0 PID: 965 Comm: sh Tainted: G           O       6.1.46-g247b2535b2 #1
      Hardware name: Generic AM33XX (Flattened Device Tree)
       unwind_backtrace from show_stack+0x18/0x1c
       show_stack from dump_stack_lvl+0x24/0x2c
       dump_stack_lvl from __warn+0x84/0x15c
       __warn from warn_slowpath_fmt+0x1a8/0x1c8
       warn_slowpath_fmt from mdio_bus_phy_resume+0x140/0x144
       mdio_bus_phy_resume from dpm_run_callback+0x3c/0x140
       dpm_run_callback from device_resume+0xb8/0x2b8
       device_resume from dpm_resume+0x144/0x314
       dpm_resume from dpm_resume_end+0x14/0x20
       dpm_resume_end from suspend_devices_and_enter+0xd0/0x924
       suspend_devices_and_enter from pm_suspend+0x2e0/0x33c
       pm_suspend from state_store+0x74/0xd0
       state_store from kernfs_fop_write_iter+0x104/0x1ec
       kernfs_fop_write_iter from vfs_write+0x1b8/0x358
       vfs_write from ksys_write+0x78/0xf8
       ksys_write from ret_fast_syscall+0x0/0x54
      Exception stack(0xe094dfa8 to 0xe094dff0)
      dfa0:                   00000004 005c3fb8 00000001 005c3fb8 00000004 00000001
      dfc0: 00000004 005c3fb8 b6f6bba0 00000004 00000004 0059edb8 00000000 00000000
      dfe0: 00000004 bed918f0 b6f09bd3 b6e89a66
      
      Cc: <stable@vger.kernel.org> # v6.0+
      Fixes: 744d23c7 ("net: phy: Warn about incorrect mdio_bus_phy_resume() state")
      Fixes: fba863b8
      
       ("net: phy: make PHY PM ops a no-op if MAC driver manages PHY PM")
      Signed-off-by: default avatarSinthu Raja <sinthu.raja@ti.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ddb4be0e
    • Marc Zyngier's avatar
      irqchip/gic-v3-its: Fix GICv4.1 VPE affinity update · 86244ae7
      Marc Zyngier authored
      commit af9acbfc upstream.
      
      When updating the affinity of a VPE, the VMOVP command is currently skipped
      if the two CPUs are part of the same VPE affinity.
      
      But this is wrong, as the doorbell corresponding to this VPE is still
      delivered on the 'old' CPU, which screws up the balancing.  Furthermore,
      offlining that 'old' CPU results in doorbell interrupts generated for this
      VPE being discarded.
      
      The harsh reality is that VMOVP cannot be elided when a set_affinity()
      request occurs. It needs to be obeyed, and if an optimisation is to be
      made, it is at the point where the affinity change request is made (such as
      in KVM).
      
      Drop the VMOVP elision altogether, and only use the vpe_table_mask
      to try and stay within the same ITS affinity group if at all possible.
      
      Fixes: dd3f050a
      
       (irqchip/gic-v4.1: Implement the v4.1 flavour of VMOVP)
      Reported-by: default avatarKunkun Jiang <jiangkunkun@huawei.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20240213101206.2137483-4-maz@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      86244ae7
    • Doug Berger's avatar
      irqchip/irq-brcmstb-l2: Add write memory barrier before exit · 27a2af91
      Doug Berger authored
      commit b0344d68 upstream.
      
      It was observed on Broadcom devices that use GIC v3 architecture L1
      interrupt controllers as the parent of brcmstb-l2 interrupt controllers
      that the deactivation of the parent interrupt could happen before the
      brcmstb-l2 deasserted its output. This would lead the GIC to reactivate the
      interrupt only to find that no L2 interrupt was pending. The result was a
      spurious interrupt invoking handle_bad_irq() with its associated
      messaging. While this did not create a functional problem it is a waste of
      cycles.
      
      The hazard exists because the memory mapped bus writes to the brcmstb-l2
      registers are buffered and the GIC v3 architecture uses a very efficient
      system register write to deactivate the interrupt.
      
      Add a write memory barrier prior to invoking chained_irq_exit() to
      introduce a dsb(st) on those systems to ensure the system register write
      cannot be executed until the memory mapped writes are visible to the
      system.
      
      [ florian: Added Fixes tag ]
      
      Fixes: 7f646e92
      
       ("irqchip: brcmstb-l2: Add Broadcom Set Top Box  Level-2 interrupt controller")
      Signed-off-by: default avatarDoug Berger <opendmb@gmail.com>
      Signed-off-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Acked-by: default avatarMarc Zyngier <maz@kernel.org>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20240210012449.3009125-1-florian.fainelli@broadcom.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      27a2af91
    • Johannes Berg's avatar
      wifi: mac80211: reload info pointer in ieee80211_tx_dequeue() · b10c8883
      Johannes Berg authored
      commit c98d8836 upstream.
      
      This pointer can change here since the SKB can change, so we
      actually later open-coded IEEE80211_SKB_CB() again. Reload
      the pointer where needed, so the monitor-mode case using it
      gets fixed, and then use info-> later as well.
      
      Cc: stable@vger.kernel.org
      Fixes: 53168215
      
       ("mac80211: fix VLAN handling with TXQs")
      Link: https://msgid.link/20240131164910.b54c28d583bc.I29450cec84ea6773cff5d9c16ff92b836c331471@changeid
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b10c8883
    • Daniel de Villiers's avatar
      nfp: flower: prevent re-adding mac index for bonded port · ef5b1041
      Daniel de Villiers authored
      commit 1a1c1330 upstream.
      
      When physical ports are reset (either through link failure or manually
      toggled down and up again) that are slaved to a Linux bond with a tunnel
      endpoint IP address on the bond device, not all tunnel packets arriving
      on the bond port are decapped as expected.
      
      The bond dev assigns the same MAC address to itself and each of its
      slaves. When toggling a slave device, the same MAC address is therefore
      offloaded to the NFP multiple times with different indexes.
      
      The issue only occurs when re-adding the shared mac. The
      nfp_tunnel_add_shared_mac() function has a conditional check early on
      that checks if a mac entry already exists and if that mac entry is
      global: (entry && nfp_tunnel_is_mac_idx_global(entry->index)). In the
      case of a bonded device (For example br-ex), the mac index is obtained,
      and no new index is assigned.
      
      We therefore modify the conditional in nfp_tunnel_add_shared_mac() to
      check if the port belongs to the LAG along with the existing checks to
      prevent a new global mac index from being re-assigned to the slave port.
      
      Fixes: 20cce886
      
       ("nfp: flower: enable MAC address sharing for offloadable devs")
      CC: stable@vger.kernel.org # 5.1+
      Signed-off-by: default avatarDaniel de Villiers <daniel.devilliers@corigine.com>
      Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ef5b1041
    • Daniel Basilio's avatar
      nfp: use correct macro for LengthSelect in BAR config · e58efe0f
      Daniel Basilio authored
      commit b3d4f7f2 upstream.
      
      The 1st and 2nd expansion BAR configuration registers are configured,
      when the driver starts up, in variables 'barcfg_msix_general' and
      'barcfg_msix_xpb', respectively. The 'LengthSelect' field is ORed in
      from bit 0, which is incorrect. The 'LengthSelect' field should
      start from bit 27.
      
      This has largely gone un-noticed because
      NFP_PCIE_BAR_PCIE2CPP_LengthSelect_32BIT happens to be 0.
      
      Fixes: 4cb584e0
      
       ("nfp: add CPP access core")
      Cc: stable@vger.kernel.org # 4.11+
      Signed-off-by: default avatarDaniel Basilio <daniel.basilio@corigine.com>
      Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e58efe0f
    • Kim Phillips's avatar
      crypto: ccp - Fix null pointer dereference in __sev_platform_shutdown_locked · 7535ec35
      Kim Phillips authored
      commit ccb88e95 upstream.
      
      The SEV platform device can be shutdown with a null psp_master,
      e.g., using DEBUG_TEST_DRIVER_REMOVE.  Found using KASAN:
      
      [  137.148210] ccp 0000:23:00.1: enabling device (0000 -> 0002)
      [  137.162647] ccp 0000:23:00.1: no command queues available
      [  137.170598] ccp 0000:23:00.1: sev enabled
      [  137.174645] ccp 0000:23:00.1: psp enabled
      [  137.178890] general protection fault, probably for non-canonical address 0xdffffc000000001e: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC KASAN NOPTI
      [  137.182693] KASAN: null-ptr-deref in range [0x00000000000000f0-0x00000000000000f7]
      [  137.182693] CPU: 93 PID: 1 Comm: swapper/0 Not tainted 6.8.0-rc1+ #311
      [  137.182693] RIP: 0010:__sev_platform_shutdown_locked+0x51/0x180
      [  137.182693] Code: 08 80 3c 08 00 0f 85 0e 01 00 00 48 8b 1d 67 b6 01 08 48 b8 00 00 00 00 00 fc ff df 48 8d bb f0 00 00 00 48 89 f9 48 c1 e9 03 <80> 3c 01 00 0f 85 fe 00 00 00 48 8b 9b f0 00 00 00 48 85 db 74 2c
      [  137.182693] RSP: 0018:ffffc900000cf9b0 EFLAGS: 00010216
      [  137.182693] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 000000000000001e
      [  137.182693] RDX: 0000000000000000 RSI: 0000000000000008 RDI: 00000000000000f0
      [  137.182693] RBP: ffffc900000cf9c8 R08: 0000000000000000 R09: fffffbfff58f5a66
      [  137.182693] R10: ffffc900000cf9c8 R11: ffffffffac7ad32f R12: ffff8881e5052c28
      [  137.182693] R13: ffff8881e5052c28 R14: ffff8881758e43e8 R15: ffffffffac64abf8
      [  137.182693] FS:  0000000000000000(0000) GS:ffff889de7000000(0000) knlGS:0000000000000000
      [  137.182693] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  137.182693] CR2: 0000000000000000 CR3: 0000001cf7c7e000 CR4: 0000000000350ef0
      [  137.182693] Call Trace:
      [  137.182693]  <TASK>
      [  137.182693]  ? show_regs+0x6c/0x80
      [  137.182693]  ? __die_body+0x24/0x70
      [  137.182693]  ? die_addr+0x4b/0x80
      [  137.182693]  ? exc_general_protection+0x126/0x230
      [  137.182693]  ? asm_exc_general_protection+0x2b/0x30
      [  137.182693]  ? __sev_platform_shutdown_locked+0x51/0x180
      [  137.182693]  sev_firmware_shutdown.isra.0+0x1e/0x80
      [  137.182693]  sev_dev_destroy+0x49/0x100
      [  137.182693]  psp_dev_destroy+0x47/0xb0
      [  137.182693]  sp_destroy+0xbb/0x240
      [  137.182693]  sp_pci_remove+0x45/0x60
      [  137.182693]  pci_device_remove+0xaa/0x1d0
      [  137.182693]  device_remove+0xc7/0x170
      [  137.182693]  really_probe+0x374/0xbe0
      [  137.182693]  ? srso_return_thunk+0x5/0x5f
      [  137.182693]  __driver_probe_device+0x199/0x460
      [  137.182693]  driver_probe_device+0x4e/0xd0
      [  137.182693]  __driver_attach+0x191/0x3d0
      [  137.182693]  ? __pfx___driver_attach+0x10/0x10
      [  137.182693]  bus_for_each_dev+0x100/0x190
      [  137.182693]  ? __pfx_bus_for_each_dev+0x10/0x10
      [  137.182693]  ? __kasan_check_read+0x15/0x20
      [  137.182693]  ? srso_return_thunk+0x5/0x5f
      [  137.182693]  ? _raw_spin_unlock+0x27/0x50
      [  137.182693]  driver_attach+0x41/0x60
      [  137.182693]  bus_add_driver+0x2a8/0x580
      [  137.182693]  driver_register+0x141/0x480
      [  137.182693]  __pci_register_driver+0x1d6/0x2a0
      [  137.182693]  ? srso_return_thunk+0x5/0x5f
      [  137.182693]  ? esrt_sysfs_init+0x1cd/0x5d0
      [  137.182693]  ? __pfx_sp_mod_init+0x10/0x10
      [  137.182693]  sp_pci_init+0x22/0x30
      [  137.182693]  sp_mod_init+0x14/0x30
      [  137.182693]  ? __pfx_sp_mod_init+0x10/0x10
      [  137.182693]  do_one_initcall+0xd1/0x470
      [  137.182693]  ? __pfx_do_one_initcall+0x10/0x10
      [  137.182693]  ? parameq+0x80/0xf0
      [  137.182693]  ? srso_return_thunk+0x5/0x5f
      [  137.182693]  ? __kmalloc+0x3b0/0x4e0
      [  137.182693]  ? kernel_init_freeable+0x92d/0x1050
      [  137.182693]  ? kasan_populate_vmalloc_pte+0x171/0x190
      [  137.182693]  ? srso_return_thunk+0x5/0x5f
      [  137.182693]  kernel_init_freeable+0xa64/0x1050
      [  137.182693]  ? __pfx_kernel_init+0x10/0x10
      [  137.182693]  kernel_init+0x24/0x160
      [  137.182693]  ? __switch_to_asm+0x3e/0x70
      [  137.182693]  ret_from_fork+0x40/0x80
      [  137.182693]  ? __pfx_kernel_init+0x10/0x10
      [  137.182693]  ret_from_fork_asm+0x1b/0x30
      [  137.182693]  </TASK>
      [  137.182693] Modules linked in:
      [  137.538483] ---[ end trace 0000000000000000 ]---
      
      Fixes: 1b05ece0
      
       ("crypto: ccp - During shutdown, check SEV data pointer before using")
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarMario Limonciello <mario.limonciello@amd.com>
      Signed-off-by: default avatarKim Phillips <kim.phillips@amd.com>
      Reviewed-by: default avatarLiam Merwick <liam.merwick@oracle.com>
      Acked-by: default avatarJohn Allen <john.allen@amd.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7535ec35
    • Ryusuke Konishi's avatar
      nilfs2: fix hang in nilfs_lookup_dirty_data_buffers() · 7e9b622b
      Ryusuke Konishi authored
      commit 38296afe upstream.
      
      Syzbot reported a hang issue in migrate_pages_batch() called by mbind()
      and nilfs_lookup_dirty_data_buffers() called in the log writer of nilfs2.
      
      While migrate_pages_batch() locks a folio and waits for the writeback to
      complete, the log writer thread that should bring the writeback to
      completion picks up the folio being written back in
      nilfs_lookup_dirty_data_buffers() that it calls for subsequent log
      creation and was trying to lock the folio.  Thus causing a deadlock.
      
      In the first place, it is unexpected that folios/pages in the middle of
      writeback will be updated and become dirty.  Nilfs2 adds a checksum to
      verify the validity of the log being written and uses it for recovery at
      mount, so data changes during writeback are suppressed.  Since this is
      broken, an unclean shutdown could potentially cause recovery to fail.
      
      Investigation revealed that the root cause is that the wait for writeback
      completion in nilfs_page_mkwrite() is conditional, and if the backing
      device does not require stable writes, data may be modified without
      waiting.
      
      Fix these issues by making nilfs_page_mkwrite() wait for writeback to
      finish regardless of the stable write requirement of the backing device.
      
      Link: https://lkml.kernel.org/r/20240131145657.4209-1-konishi.ryusuke@gmail.com
      Fixes: 1d1d1a76
      
       ("mm: only enforce stable page writes if the backing device requires it")
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Reported-by: default avatar <syzbot+ee2ae68da3b22d04cd8d@syzkaller.appspotmail.com>
      Closes: https://lkml.kernel.org/r/00000000000047d819061004ad6c@google.com
      Tested-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7e9b622b
    • Ryusuke Konishi's avatar
      nilfs2: fix data corruption in dsync block recovery for small block sizes · 120f7fa2
      Ryusuke Konishi authored
      commit 67b8bcba
      
       upstream.
      
      The helper function nilfs_recovery_copy_block() of
      nilfs_recovery_dsync_blocks(), which recovers data from logs created by
      data sync writes during a mount after an unclean shutdown, incorrectly
      calculates the on-page offset when copying repair data to the file's page
      cache.  In environments where the block size is smaller than the page
      size, this flaw can cause data corruption and leak uninitialized memory
      bytes during the recovery process.
      
      Fix these issues by correcting this byte offset calculation on the page.
      
      Link: https://lkml.kernel.org/r/20240124121936.10575-1-konishi.ryusuke@gmail.com
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Tested-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      120f7fa2
    • bo liu's avatar
      ALSA: hda/conexant: Add quirk for SWS JS201D · ee28bbb6
      bo liu authored
      commit 4639c502
      
       upstream.
      
      The SWS JS201D need a different pinconfig from windows driver.
      Add a quirk to use a specific pinconfig to SWS JS201D.
      
      Signed-off-by: default avatarbo liu <bo.liu@senarytech.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20240205013802.51907-1-bo.liu@senarytech.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ee28bbb6
    • Alexander Stein's avatar
      mmc: slot-gpio: Allow non-sleeping GPIO ro · 776f0c69
      Alexander Stein authored
      commit cc9432c4 upstream.
      
      This change uses the appropriate _cansleep or non-sleeping API for
      reading GPIO read-only state. This allows users with GPIOs that
      never sleepbeing called in atomic context.
      
      Implement the same mechanism as in commit 52af318c
      
       ("mmc: Allow
      non-sleeping GPIO cd").
      
      Signed-off-by: default avatarAlexander Stein <alexander.stein@ew.tq-group.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20240206083912.2543142-1-alexander.stein@ew.tq-group.com
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      776f0c69
    • Steve Wahl's avatar
      x86/mm/ident_map: Use gbpages only where full GB page should be mapped. · 62fa8230
      Steve Wahl authored
      commit d794734c
      
       upstream.
      
      When ident_pud_init() uses only gbpages to create identity maps, large
      ranges of addresses not actually requested can be included in the
      resulting table; a 4K request will map a full GB.  On UV systems, this
      ends up including regions that will cause hardware to halt the system
      if accessed (these are marked "reserved" by BIOS).  Even processor
      speculation into these regions is enough to trigger the system halt.
      
      Only use gbpages when map creation requests include the full GB page
      of space.  Fall back to using smaller 2M pages when only portions of a
      GB page are included in the request.
      
      No attempt is made to coalesce mapping requests. If a request requires
      a map entry at the 2M (pmd) level, subsequent mapping requests within
      the same 1G region will also be at the pmd level, even if adjacent or
      overlapping such requests could have been combined to map a full
      gbpage.  Existing usage starts with larger regions and then adds
      smaller regions, so this should not have any great consequence.
      
      [ dhansen: fix up comment formatting, simplifty changelog ]
      
      Signed-off-by: default avatarSteve Wahl <steve.wahl@hpe.com>
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/all/20240126164841.170866-1-steve.wahl%40hpe.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      62fa8230
    • Aleksander Mazur's avatar
      x86/Kconfig: Transmeta Crusoe is CPU family 5, not 6 · 1fb17e9b
      Aleksander Mazur authored
      commit f6a18925 upstream.
      
      The kernel built with MCRUSOE is unbootable on Transmeta Crusoe.  It shows
      the following error message:
      
        This kernel requires an i686 CPU, but only detected an i586 CPU.
        Unable to boot - please use a kernel appropriate for your CPU.
      
      Remove MCRUSOE from the condition introduced in commit in Fixes, effectively
      changing X86_MINIMUM_CPU_FAMILY back to 5 on that machine, which matches the
      CPU family given by CPUID.
      
        [ bp: Massage commit message. ]
      
      Fixes: 25d76ac8
      
       ("x86/Kconfig: Explicitly enumerate i686-class CPUs in Kconfig")
      Signed-off-by: default avatarAleksander Mazur <deweloper@wp.pl>
      Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Acked-by: default avatarH. Peter Anvin <hpa@zytor.com>
      Cc: <stable@kernel.org>
      Link: https://lore.kernel.org/r/20240123134309.1117782-1-deweloper@wp.pl
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1fb17e9b
    • Naveen N Rao's avatar
      powerpc/64: Set task pt_regs->link to the LR value on scv entry · 0fc0bcba
      Naveen N Rao authored
      commit aad98efd upstream.
      
      Nysal reported that userspace backtraces are missing in offcputime bcc
      tool. As an example:
          $ sudo ./bcc/tools/offcputime.py -uU
          Tracing off-CPU time (us) of user threads by user stack... Hit Ctrl-C to end.
      
          ^C
      	write
      	-                python (9107)
      	    8
      
      	write
      	-                sudo (9105)
      	    9
      
      	mmap
      	-                python (9107)
      	    16
      
      	clock_nanosleep
      	-                multipathd (697)
      	    3001604
      
      The offcputime bcc tool attaches a bpf program to a kprobe on
      finish_task_switch(), which is usually hit on a syscall from userspace.
      With the switch to system call vectored, we started setting
      pt_regs->link to zero. This is because system call vectored behaves like
      a function call with LR pointing to the system call return address, and
      with no modification to SRR0/SRR1. The LR value does indicate our next
      instruction, so it is being saved as pt_regs->nip, and pt_regs->link is
      being set to zero. This is not a problem by itself, but BPF uses perf
      callchain infrastructure for capturing stack traces, and that stores LR
      as the second entry in the stack trace. perf has code to cope with the
      second entry being zero, and skips over it. However, generic userspace
      unwinders assume that a zero entry indicates end of the stack trace,
      resulting in a truncated userspace stack trace.
      
      Rather than fixing all userspace unwinders to ignore/skip past the
      second entry, store the real LR value in pt_regs->link so that there
      continues to be a valid, though duplicate entry in the stack trace.
      
      With this change:
          $ sudo ./bcc/tools/offcputime.py -uU
          Tracing off-CPU time (us) of user threads by user stack... Hit Ctrl-C to end.
      
          ^C
      	write
      	write
      	[unknown]
      	[unknown]
      	[unknown]
      	[unknown]
      	[unknown]
      	PyObject_VectorcallMethod
      	[unknown]
      	[unknown]
      	PyObject_CallOneArg
      	PyFile_WriteObject
      	PyFile_WriteString
      	[unknown]
      	[unknown]
      	PyObject_Vectorcall
      	_PyEval_EvalFrameDefault
      	PyEval_EvalCode
      	[unknown]
      	[unknown]
      	[unknown]
      	_PyRun_SimpleFileObject
      	_PyRun_AnyFileObject
      	Py_RunMain
      	[unknown]
      	Py_BytesMain
      	[unknown]
      	__libc_start_main
      	-                python (1293)
      	    7
      
      	write
      	write
      	[unknown]
      	sudo_ev_loop_v1
      	sudo_ev_dispatch_v1
      	[unknown]
      	[unknown]
      	[unknown]
      	[unknown]
      	__libc_start_main
      	-                sudo (1291)
      	    7
      
      	syscall
      	syscall
      	bpf_open_perf_buffer_opts
      	[unknown]
      	[unknown]
      	[unknown]
      	[unknown]
      	_PyObject_MakeTpCall
      	PyObject_Vectorcall
      	_PyEval_EvalFrameDefault
      	PyEval_EvalCode
      	[unknown]
      	[unknown]
      	[unknown]
      	_PyRun_SimpleFileObject
      	_PyRun_AnyFileObject
      	Py_RunMain
      	[unknown]
      	Py_BytesMain
      	[unknown]
      	__libc_start_main
      	-                python (1293)
      	    11
      
      	clock_nanosleep
      	clock_nanosleep
      	nanosleep
      	sleep
      	[unknown]
      	[unknown]
      	__clone
      	-                multipathd (698)
      	    3001661
      
      Fixes: 7fa95f9a
      
       ("powerpc/64s: system call support for scv/rfscv instructions")
      Cc: stable@vger.kernel.org
      Reported-by: default avatar"Nysal Jan K.A" <nysal@linux.ibm.com>
      Signed-off-by: default avatarNaveen N Rao <naveen@kernel.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://msgid.link/20240202154316.395276-1-naveen@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0fc0bcba
    • Hugo Villeneuve's avatar
      serial: max310x: fail probe if clock crystal is unstable · 72bf8760
      Hugo Villeneuve authored
      commit 8afa6c6d upstream.
      
      A stable clock is really required in order to use this UART, so log an
      error message and bail out if the chip reports that the clock is not
      stable.
      
      Fixes: 4cf9a888
      
       ("serial: max310x: Check the clock readiness")
      Cc: stable@vger.kernel.org
      Suggested-by: default avatarJan Kundrát <jan.kundrat@cesnet.cz>
      Link: https://www.spinics.net/lists/linux-serial/msg35773.html
      Signed-off-by: default avatarHugo Villeneuve <hvilleneuve@dimonoff.com>
      Link: https://lore.kernel.org/r/20240116213001.3691629-4-hugo@hugovil.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      72bf8760
    • Hugo Villeneuve's avatar
      serial: max310x: improve crystal stable clock detection · b67b421a
      Hugo Villeneuve authored
      commit 93cd256a upstream.
      
      Some people are seeing a warning similar to this when using a crystal:
      
          max310x 11-006c: clock is not stable yet
      
      The datasheet doesn't mention the maximum time to wait for the clock to be
      stable when using a crystal, and it seems that the 10ms delay in the driver
      is not always sufficient.
      
      Jan Kundrát reported that it took three tries (each separated by 10ms) to
      get a stable clock.
      
      Modify behavior to check stable clock ready bit multiple times (20), and
      waiting 10ms between each try.
      
      Note: the first draft of the driver originally used a 50ms delay, without
      checking the clock stable bit.
      Then a loop with 1000 retries was implemented, each time reading the clock
      stable bit.
      
      Fixes: 4cf9a888
      
       ("serial: max310x: Check the clock readiness")
      Cc: stable@vger.kernel.org
      Suggested-by: default avatarJan Kundrát <jan.kundrat@cesnet.cz>
      Link: https://www.spinics.net/lists/linux-serial/msg35773.html
      Link: https://lore.kernel.org/all/20240110174015.6f20195fde08e5c9e64e5675@hugovil.com/raw
      Link: https://github.com/boundarydevices/linux/commit/e5dfe3e4a751392515d78051973190301a37ca9a
      Signed-off-by: default avatarHugo Villeneuve <hvilleneuve@dimonoff.com>
      Link: https://lore.kernel.org/r/20240116213001.3691629-3-hugo@hugovil.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b67b421a
    • Hugo Villeneuve's avatar
      serial: max310x: set default value when reading clock ready bit · 2e8b2b91
      Hugo Villeneuve authored
      commit 04193733 upstream.
      
      If regmap_read() returns a non-zero value, the 'val' variable can be left
      uninitialized.
      
      Clear it before calling regmap_read() to make sure we properly detect
      the clock ready bit.
      
      Fixes: 4cf9a888
      
       ("serial: max310x: Check the clock readiness")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHugo Villeneuve <hvilleneuve@dimonoff.com>
      Link: https://lore.kernel.org/r/20240116213001.3691629-2-hugo@hugovil.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2e8b2b91
    • Vincent Donnefort's avatar
      ring-buffer: Clean ring_buffer_poll_wait() error return · f8777d33
      Vincent Donnefort authored
      commit 66bbea9e upstream.
      
      The return type for ring_buffer_poll_wait() is __poll_t. This is behind
      the scenes an unsigned where we can set event bits. In case of a
      non-allocated CPU, we do return instead -EINVAL (0xffffffea). Lucky us,
      this ends up setting few error bits (EPOLLERR | EPOLLHUP | EPOLLNVAL), so
      user-space at least is aware something went wrong.
      
      Nonetheless, this is an incorrect code. Replace that -EINVAL with a
      proper EPOLLERR to clean that output. As this doesn't change the
      behaviour, there's no need to treat this change as a bug fix.
      
      Link: https://lore.kernel.org/linux-trace-kernel/20240131140955.3322792-1-vdonnefort@google.com
      
      Cc: stable@vger.kernel.org
      Fixes: 6721cb60
      
       ("ring-buffer: Do not poll non allocated cpu buffers")
      Signed-off-by: default avatarVincent Donnefort <vdonnefort@google.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f8777d33
    • Souradeep Chakrabarti's avatar
      hv_netvsc: Fix race condition between netvsc_probe and netvsc_remove · 7656372a
      Souradeep Chakrabarti authored
      commit e0526ec5 upstream.
      
      In commit ac504767 ("hv_netvsc: Disable NAPI before closing the
      VMBus channel"), napi_disable was getting called for all channels,
      including all subchannels without confirming if they are enabled or not.
      
      This caused hv_netvsc getting hung at napi_disable, when netvsc_probe()
      has finished running but nvdev->subchan_work has not started yet.
      netvsc_subchan_work() -> rndis_set_subchannel() has not created the
      sub-channels and because of that netvsc_sc_open() is not running.
      netvsc_remove() calls cancel_work_sync(&nvdev->subchan_work), for which
      netvsc_subchan_work did not run.
      
      netif_napi_add() sets the bit NAPI_STATE_SCHED because it ensures NAPI
      cannot be scheduled. Then netvsc_sc_open() -> napi_enable will clear the
      NAPIF_STATE_SCHED bit, so it can be scheduled. napi_disable() does the
      opposite.
      
      Now during netvsc_device_remove(), when napi_disable is called for those
      subchannels, napi_disable gets stuck on infinite msleep.
      
      This fix addresses this problem by ensuring that napi_disable() is not
      getting called for non-enabled NAPI struct.
      But netif_napi_del() is still necessary for these non-enabled NAPI struct
      for cleanup purpose.
      
      Call trace:
      [  654.559417] task:modprobe        state:D stack:    0 pid: 2321 ppid:  1091 flags:0x00004002
      [  654.568030] Call Trace:
      [  654.571221]  <TASK>
      [  654.573790]  __schedule+0x2d6/0x960
      [  654.577733]  schedule+0x69/0xf0
      [  654.581214]  schedule_timeout+0x87/0x140
      [  654.585463]  ? __bpf_trace_tick_stop+0x20/0x20
      [  654.590291]  msleep+0x2d/0x40
      [  654.593625]  napi_disable+0x2b/0x80
      [  654.597437]  netvsc_device_remove+0x8a/0x1f0 [hv_netvsc]
      [  654.603935]  rndis_filter_device_remove+0x194/0x1c0 [hv_netvsc]
      [  654.611101]  ? do_wait_intr+0xb0/0xb0
      [  654.615753]  netvsc_remove+0x7c/0x120 [hv_netvsc]
      [  654.621675]  vmbus_remove+0x27/0x40 [hv_vmbus]
      
      Cc: stable@vger.kernel.org
      Fixes: ac504767
      
       ("hv_netvsc: Disable NAPI before closing the VMBus channel")
      Signed-off-by: default avatarSouradeep Chakrabarti <schakrabarti@linux.microsoft.com>
      Reviewed-by: default avatarDexuan Cui <decui@microsoft.com>
      Reviewed-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Link: https://lore.kernel.org/r/1706686551-28510-1-git-send-email-schakrabarti@linux.microsoft.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7656372a
    • Philip Yang's avatar
      drm/prime: Support page array >= 4GB · 4cc90928
      Philip Yang authored
      commit b671cd3d
      
       upstream.
      
      Without unsigned long typecast, the size is passed in as zero if page
      array size >= 4GB, nr_pages >= 0x100000, then sg list converted will
      have the first and the last chunk lost.
      
      Signed-off-by: default avatarPhilip Yang <Philip.Yang@amd.com>
      Acked-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230821200201.24685-1-Philip.Yang@amd.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4cc90928
    • Sean Young's avatar
      media: rc: bpf attach/detach requires write permission · d9821010
      Sean Young authored
      commit 6a9d5524
      
       upstream.
      
      Note that bpf attach/detach also requires CAP_NET_ADMIN.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSean Young <sean@mess.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9821010
    • Mario Limonciello's avatar
      iio: accel: bma400: Fix a compilation problem · a4b4ba77
      Mario Limonciello authored
      commit 4cb81840 upstream.
      
      The kernel fails when compiling without `CONFIG_REGMAP_I2C` but with
      `CONFIG_BMA400`.
      ```
      ld: drivers/iio/accel/bma400_i2c.o: in function `bma400_i2c_probe':
      bma400_i2c.c:(.text+0x23): undefined reference to `__devm_regmap_init_i2c'
      ```
      
      Link: https://download.01.org/0day-ci/archive/20240131/202401311634.FE5CBVwe-lkp@intel.com/config
      Fixes: 465c811f ("iio: accel: Add driver for the BMA400")
      Fixes: 9bea1064
      
       ("iio: accel: bma400: add support for bma400 spi")
      Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
      Link: https://lore.kernel.org/r/20240131225246.14169-1-mario.limonciello@amd.com
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a4b4ba77
    • Dinghao Liu's avatar
      iio: core: fix memleak in iio_device_register_sysfs · 1c6d19c8
      Dinghao Liu authored
      commit 95a0d596 upstream.
      
      When iio_device_register_sysfs_group() fails, we should
      free iio_dev_opaque->chan_attr_group.attrs to prevent
      potential memleak.
      
      Fixes: 32f17172
      
       ("iio: core: rework iio device group creation")
      Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
      Link: https://lore.kernel.org/r/20231208073119.29283-1-dinghao.liu@zju.edu.cn
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1c6d19c8
    • zhili.liu's avatar
      iio: magnetometer: rm3100: add boundary check for the value read from RM3100_REG_TMRC · 8d5838a4
      zhili.liu authored
      commit 792595ba upstream.
      
      Recently, we encounter kernel crash in function rm3100_common_probe
      caused by out of bound access of array rm3100_samp_rates (because of
      underlying hardware failures). Add boundary check to prevent out of
      bound access.
      
      Fixes: 121354b2
      
       ("iio: magnetometer: Add driver support for PNI RM3100")
      Suggested-by: default avatarZhouyi Zhou <zhouzhouyi@gmail.com>
      Signed-off-by: default avatarzhili.liu <zhili.liu@ucas.com.cn>
      Link: https://lore.kernel.org/r/1704157631-3814-1-git-send-email-zhouzhouyi@gmail.com
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8d5838a4
    • David Schiller's avatar
      staging: iio: ad5933: fix type mismatch regression · 7b9cabd4
      David Schiller authored
      commit 6db053cd upstream.
      
      Commit 4c3577db ("Staging: iio: impedance-analyzer: Fix sparse
      warning") fixed a compiler warning, but introduced a bug that resulted
      in one of the two 16 bit IIO channels always being zero (when both are
      enabled).
      
      This is because int is 32 bits wide on most architectures and in the
      case of a little-endian machine the two most significant bytes would
      occupy the buffer for the second channel as 'val' is being passed as a
      void pointer to 'iio_push_to_buffers()'.
      
      Fix by defining 'val' as u16. Tested working on ARM64.
      
      Fixes: 4c3577db
      
       ("Staging: iio: impedance-analyzer: Fix sparse warning")
      Signed-off-by: default avatarDavid Schiller <david.schiller@jku.at>
      Link: https://lore.kernel.org/r/20240122134916.2137957-1-david.schiller@jku.at
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7b9cabd4
    • Steven Rostedt (Google)'s avatar
      tracing: Fix wasted memory in saved_cmdlines logic · 047aa3dc
      Steven Rostedt (Google) authored
      commit 44dc5c41 upstream.
      
      While looking at improving the saved_cmdlines cache I found a huge amount
      of wasted memory that should be used for the cmdlines.
      
      The tracing data saves pids during the trace. At sched switch, if a trace
      occurred, it will save the comm of the task that did the trace. This is
      saved in a "cache" that maps pids to comms and exposed to user space via
      the /sys/kernel/tracing/saved_cmdlines file. Currently it only caches by
      default 128 comms.
      
      The structure that uses this creates an array to store the pids using
      PID_MAX_DEFAULT (which is usually set to 32768). This causes the structure
      to be of the size of 131104 bytes on 64 bit machines.
      
      In hex: 131104 = 0x20020, and since the kernel allocates generic memory in
      powers of two, the kernel would allocate 0x40000 or 262144 bytes to store
      this structure. That leaves 131040 bytes of wasted space.
      
      Worse, the structure points to an allocated array to store the comm names,
      which is 16 bytes times the amount of names to save (currently 128), which
      is 2048 bytes. Instead of allocating a separate array, make the structure
      end with a variable length string and use the extra space for that.
      
      This is similar to a recommendation that Linus had made about eventfs_inode names:
      
        https://lore.kernel.org/all/20240130190355.11486-5-torvalds@linux-foundation.org/
      
      Instead of allocating a separate string array to hold the saved comms,
      have the structure end with: char saved_cmdlines[]; and round up to the
      next power of two over sizeof(struct saved_cmdline_buffers) + num_cmdlines * TASK_COMM_LEN
      It will use this extra space for the saved_cmdline portion.
      
      Now, instead of saving only 128 comms by default, by using this wasted
      space at the end of the structure it can save over 8000 comms and even
      saves space by removing the need for allocating the other array.
      
      Link: https://lore.kernel.org/linux-trace-kernel/20240209063622.1f7b6d5f@rorschach.local.home
      
      Cc: stable@vger.kernel.org
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Vincent Donnefort <vdonnefort@google.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Mete Durlu <meted@linux.ibm.com>
      Fixes: 939c7a4f
      
       ("tracing: Introduce saved_cmdlines_size file")
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      047aa3dc
    • Baokun Li's avatar
      ext4: fix double-free of blocks due to wrong extents moved_len · afba9d11
      Baokun Li authored
      commit 55583e89 upstream.
      
      In ext4_move_extents(), moved_len is only updated when all moves are
      successfully executed, and only discards orig_inode and donor_inode
      preallocations when moved_len is not zero. When the loop fails to exit
      after successfully moving some extents, moved_len is not updated and
      remains at 0, so it does not discard the preallocations.
      
      If the moved extents overlap with the preallocated extents, the
      overlapped extents are freed twice in ext4_mb_release_inode_pa() and
      ext4_process_freed_data() (as described in commit 94d7c16c
      
       ("ext4:
      Fix double-free of blocks with EXT4_IOC_MOVE_EXT")), and bb_free is
      incremented twice. Hence when trim is executed, a zero-division bug is
      triggered in mb_update_avg_fragment_size() because bb_free is not zero
      and bb_fragments is zero.
      
      Therefore, update move_len after each extent move to avoid the issue.
      
      Reported-by: default avatarWei Chen <harperchen1110@gmail.com>
      Reported-by: default avatarxingwei lee <xrivendell7@gmail.com>
      Closes: https://lore.kernel.org/r/CAO4mrferzqBUnCag8R3m2zf897ts9UEuhjFQGPtODT92rYyR2Q@mail.gmail.com
      Fixes: fcf6b1b7
      
       ("ext4: refactor ext4_move_extents code base")
      CC:  <stable@vger.kernel.org> # 3.18
      Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Link: https://lore.kernel.org/r/20240104142040.2835097-2-libaokun1@huawei.com
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      afba9d11
    • Ekansh Gupta's avatar
      misc: fastrpc: Mark all sessions as invalid in cb_remove · b7902e34
      Ekansh Gupta authored
      commit a4e61de6 upstream.
      
      In remoteproc shutdown sequence, rpmsg_remove will get called which
      would depopulate all the child nodes that have been created during
      rpmsg_probe. This would result in cb_remove call for all the context
      banks for the remoteproc. In cb_remove function, session 0 is
      getting skipped which is not correct as session 0 will never become
      available again. Add changes to mark session 0 also as invalid.
      
      Fixes: f6f9279f
      
       ("misc: fastrpc: Add Qualcomm fastrpc basic driver model")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarEkansh Gupta <quic_ekangupt@quicinc.com>
      Link: https://lore.kernel.org/r/20240108114833.20480-1-quic_ekangupt@quicinc.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b7902e34
    • Carlos Llamas's avatar
      binder: signal epoll threads of self-work · 82722b45
      Carlos Llamas authored
      commit 97830f3c upstream.
      
      In (e)poll mode, threads often depend on I/O events to determine when
      data is ready for consumption. Within binder, a thread may initiate a
      command via BINDER_WRITE_READ without a read buffer and then make use
      of epoll_wait() or similar to consume any responses afterwards.
      
      It is then crucial that epoll threads are signaled via wakeup when they
      queue their own work. Otherwise, they risk waiting indefinitely for an
      event leaving their work unhandled. What is worse, subsequent commands
      won't trigger a wakeup either as the thread has pending work.
      
      Fixes: 457b9a6f
      
       ("Staging: android: add binder driver")
      Cc: Arve Hjønnevåg <arve@android.com>
      Cc: Martijn Coenen <maco@android.com>
      Cc: Alice Ryhl <aliceryhl@google.com>
      Cc: Steven Moreland <smoreland@google.com>
      Cc: stable@vger.kernel.org # v4.19+
      Signed-off-by: default avatarCarlos Llamas <cmllamas@google.com>
      Link: https://lore.kernel.org/r/20240131215347.1808751-1-cmllamas@google.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      82722b45
    • Vitaly Rodionov's avatar
      ALSA: hda/cs8409: Suppress vmaster control for Dolphin models · 4052b180
      Vitaly Rodionov authored
      commit a2ed0a44 upstream.
      
      Customer has reported an issue with specific desktop platform
      where two CS42L42 codecs are connected to CS8409 HDA bridge.
      If "Master Volume Control" is created then on Ubuntu OS UCM
      left/right balance slider in UI audio settings has no effect.
      This patch will fix this issue for a target paltform.
      
      Fixes: 20e50772
      
       ("ALSA: hda/cs8409: Add support for dolphin")
      Signed-off-by: default avatarVitaly Rodionov <vitalyr@opensource.cirrus.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20240122184710.5802-1-vitalyr@opensource.cirrus.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4052b180