Skip to content
Snippets Groups Projects
  1. Feb 01, 2025
  2. Jan 23, 2025
    • Greg Kroah-Hartman's avatar
    • Wang Liang's avatar
      net: fix data-races around sk->sk_forward_alloc · be7c61ea
      Wang Liang authored
      
      commit 073d8980 upstream.
      
      Syzkaller reported this warning:
       ------------[ cut here ]------------
       WARNING: CPU: 0 PID: 16 at net/ipv4/af_inet.c:156 inet_sock_destruct+0x1c5/0x1e0
       Modules linked in:
       CPU: 0 UID: 0 PID: 16 Comm: ksoftirqd/0 Not tainted 6.12.0-rc5 #26
       Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
       RIP: 0010:inet_sock_destruct+0x1c5/0x1e0
       Code: 24 12 4c 89 e2 5b 48 c7 c7 98 ec bb 82 41 5c e9 d1 18 17 ff 4c 89 e6 5b 48 c7 c7 d0 ec bb 82 41 5c e9 bf 18 17 ff 0f 0b eb 83 <0f> 0b eb 97 0f 0b eb 87 0f 0b e9 68 ff ff ff 66 66 2e 0f 1f 84 00
       RSP: 0018:ffffc9000008bd90 EFLAGS: 00010206
       RAX: 0000000000000300 RBX: ffff88810b172a90 RCX: 0000000000000007
       RDX: 0000000000000002 RSI: 0000000000000300 RDI: ffff88810b172a00
       RBP: ffff88810b172a00 R08: ffff888104273c00 R09: 0000000000100007
       R10: 0000000000020000 R11: 0000000000000006 R12: ffff88810b172a00
       R13: 0000000000000004 R14: 0000000000000000 R15: ffff888237c31f78
       FS:  0000000000000000(0000) GS:ffff888237c00000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 00007ffc63fecac8 CR3: 000000000342e000 CR4: 00000000000006f0
       DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
       Call Trace:
        <TASK>
        ? __warn+0x88/0x130
        ? inet_sock_destruct+0x1c5/0x1e0
        ? report_bug+0x18e/0x1a0
        ? handle_bug+0x53/0x90
        ? exc_invalid_op+0x18/0x70
        ? asm_exc_invalid_op+0x1a/0x20
        ? inet_sock_destruct+0x1c5/0x1e0
        __sk_destruct+0x2a/0x200
        rcu_do_batch+0x1aa/0x530
        ? rcu_do_batch+0x13b/0x530
        rcu_core+0x159/0x2f0
        handle_softirqs+0xd3/0x2b0
        ? __pfx_smpboot_thread_fn+0x10/0x10
        run_ksoftirqd+0x25/0x30
        smpboot_thread_fn+0xdd/0x1d0
        kthread+0xd3/0x100
        ? __pfx_kthread+0x10/0x10
        ret_from_fork+0x34/0x50
        ? __pfx_kthread+0x10/0x10
        ret_from_fork_asm+0x1a/0x30
        </TASK>
       ---[ end trace 0000000000000000 ]---
      
      Its possible that two threads call tcp_v6_do_rcv()/sk_forward_alloc_add()
      concurrently when sk->sk_state == TCP_LISTEN with sk->sk_lock unlocked,
      which triggers a data-race around sk->sk_forward_alloc:
      tcp_v6_rcv
          tcp_v6_do_rcv
              skb_clone_and_charge_r
                  sk_rmem_schedule
                      __sk_mem_schedule
                          sk_forward_alloc_add()
                  skb_set_owner_r
                      sk_mem_charge
                          sk_forward_alloc_add()
              __kfree_skb
                  skb_release_all
                      skb_release_head_state
                          sock_rfree
                              sk_mem_uncharge
                                  sk_forward_alloc_add()
                                  sk_mem_reclaim
                                      // set local var reclaimable
                                      __sk_mem_reclaim
                                          sk_forward_alloc_add()
      
      In this syzkaller testcase, two threads call
      tcp_v6_do_rcv() with skb->truesize=768, the sk_forward_alloc changes like
      this:
       (cpu 1)             | (cpu 2)             | sk_forward_alloc
       ...                 | ...                 | 0
       __sk_mem_schedule() |                     | +4096 = 4096
                           | __sk_mem_schedule() | +4096 = 8192
       sk_mem_charge()     |                     | -768  = 7424
                           | sk_mem_charge()     | -768  = 6656
       ...                 |    ...              |
       sk_mem_uncharge()   |                     | +768  = 7424
       reclaimable=7424    |                     |
                           | sk_mem_uncharge()   | +768  = 8192
                           | reclaimable=8192    |
       __sk_mem_reclaim()  |                     | -4096 = 4096
                           | __sk_mem_reclaim()  | -8192 = -4096 != 0
      
      The skb_clone_and_charge_r() should not be called in tcp_v6_do_rcv() when
      sk->sk_state is TCP_LISTEN, it happens later in tcp_v6_syn_recv_sock().
      Fix the same issue in dccp_v6_do_rcv().
      
      Suggested-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Fixes: e994b2f0 ("tcp: do not lock listener to process SYN packets")
      Signed-off-by: default avatarWang Liang <wangliang74@huawei.com>
      Link: https://patch.msgid.link/20241107023405.889239-1-wangliang74@huawei.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarAlva Lan <alvalan9@foxmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      be7c61ea
    • Juergen Gross's avatar
      x86/xen: fix SLS mitigation in xen_hypercall_iret() · 060de371
      Juergen Gross authored
      
      The backport of upstream patch a2796dff ("x86/xen: don't do PV iret
      hypercall through hypercall page") missed to adapt the SLS mitigation
      config check from CONFIG_MITIGATION_SLS to CONFIG_SLS.
      
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      060de371
    • Youzhong Yang's avatar
      nfsd: add list_head nf_gc to struct nfsd_file · 400fb0e9
      Youzhong Yang authored
      
      commit 8e6e2ffa upstream.
      
      nfsd_file_put() in one thread can race with another thread doing
      garbage collection (running nfsd_file_gc() -> list_lru_walk() ->
      nfsd_file_lru_cb()):
      
        * In nfsd_file_put(), nf->nf_ref is 1, so it tries to do nfsd_file_lru_add().
        * nfsd_file_lru_add() returns true (with NFSD_FILE_REFERENCED bit set)
        * garbage collector kicks in, nfsd_file_lru_cb() clears REFERENCED bit and
          returns LRU_ROTATE.
        * garbage collector kicks in again, nfsd_file_lru_cb() now decrements nf->nf_ref
          to 0, runs nfsd_file_unhash(), removes it from the LRU and adds to the dispose
          list [list_lru_isolate_move(lru, &nf->nf_lru, head)]
        * nfsd_file_put() detects NFSD_FILE_HASHED bit is cleared, so it tries to remove
          the 'nf' from the LRU [if (!nfsd_file_lru_remove(nf))]. The 'nf' has been added
          to the 'dispose' list by nfsd_file_lru_cb(), so nfsd_file_lru_remove(nf) simply
          treats it as part of the LRU and removes it, which leads to its removal from
          the 'dispose' list.
        * At this moment, 'nf' is unhashed with its nf_ref being 0, and not on the LRU.
          nfsd_file_put() continues its execution [if (refcount_dec_and_test(&nf->nf_ref))],
          as nf->nf_ref is already 0, nf->nf_ref is set to REFCOUNT_SATURATED, and the 'nf'
          gets no chance of being freed.
      
      nfsd_file_put() can also race with nfsd_file_cond_queue():
        * In nfsd_file_put(), nf->nf_ref is 1, so it tries to do nfsd_file_lru_add().
        * nfsd_file_lru_add() sets REFERENCED bit and returns true.
        * Some userland application runs 'exportfs -f' or something like that, which triggers
          __nfsd_file_cache_purge() -> nfsd_file_cond_queue().
        * In nfsd_file_cond_queue(), it runs [if (!nfsd_file_unhash(nf))], unhash is done
          successfully.
        * nfsd_file_cond_queue() runs [if (!nfsd_file_get(nf))], now nf->nf_ref goes to 2.
        * nfsd_file_cond_queue() runs [if (nfsd_file_lru_remove(nf))], it succeeds.
        * nfsd_file_cond_queue() runs [if (refcount_sub_and_test(decrement, &nf->nf_ref))]
          (with "decrement" being 2), so the nf->nf_ref goes to 0, the 'nf' is added to the
          dispose list [list_add(&nf->nf_lru, dispose)]
        * nfsd_file_put() detects NFSD_FILE_HASHED bit is cleared, so it tries to remove
          the 'nf' from the LRU [if (!nfsd_file_lru_remove(nf))], although the 'nf' is not
          in the LRU, but it is linked in the 'dispose' list, nfsd_file_lru_remove() simply
          treats it as part of the LRU and removes it. This leads to its removal from
          the 'dispose' list!
        * Now nf->ref is 0, unhashed. nfsd_file_put() continues its execution and set
          nf->nf_ref to REFCOUNT_SATURATED.
      
      As shown in the above analysis, using nf_lru for both the LRU list and dispose list
      can cause the leaks. This patch adds a new list_head nf_gc in struct nfsd_file, and uses
      it for the dispose list. This does not fix the nfsd_file leaking issue completely.
      
      Signed-off-by: default avatarYouzhong Yang <youzhong@gmail.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      400fb0e9
    • Gao Xiang's avatar
      erofs: handle NONHEAD !delta[1] lclusters gracefully · 75a0a6dd
      Gao Xiang authored
      
      commit 0bc8061f upstream.
      
      syzbot reported a WARNING in iomap_iter_done:
       iomap_fiemap+0x73b/0x9b0 fs/iomap/fiemap.c:80
       ioctl_fiemap fs/ioctl.c:220 [inline]
      
      Generally, NONHEAD lclusters won't have delta[1]==0, except for crafted
      images and filesystems created by pre-1.0 mkfs versions.
      
      Previously, it would immediately bail out if delta[1]==0, which led to
      inadequate decompressed lengths (thus FIEMAP is impacted).  Treat it as
      delta[1]=1 to work around these legacy mkfs versions.
      
      `lclusterbits > 14` is illegal for compact indexes, error out too.
      
      Reported-by: default avatar <syzbot+6c0b301317aa0156f9eb@syzkaller.appspotmail.com>
      Closes: https://lore.kernel.org/r/67373c0c.050a0220.2a2fcc.0079.GAE@google.com
      
      
      Tested-by: default avatar <syzbot+6c0b301317aa0156f9eb@syzkaller.appspotmail.com>
      Fixes: d95ae5e2 ("erofs: add support for the full decompressed length")
      Fixes: 001b8ccd ("erofs: fix compact 4B support for 16k block size")
      Signed-off-by: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
      Link: https://lore.kernel.org/r/20241115173651.3339514-1-hsiangkao@linux.alibaba.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      75a0a6dd
    • Gao Xiang's avatar
      erofs: tidy up EROFS on-disk naming · 6326a3dc
      Gao Xiang authored
      
      commit 1c7f49a7 upstream.
      
       - Get rid of all "vle" (variable-length extents) expressions
         since they only expand overall name lengths unnecessarily;
       - Rename COMPRESSION_LEGACY to COMPRESSED_FULL;
       - Move on-disk directory definitions ahead of compression;
       - Drop unused extended attribute definitions;
       - Move inode ondisk union `i_u` out as `union erofs_inode_i_u`.
      
      No actual logical change.
      
      Signed-off-by: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
      Reviewed-by: default avatarYue Hu <huyue2@coolpad.com>
      Reviewed-by: default avatarChao Yu <chao@kernel.org>
      Link: https://lore.kernel.org/r/20230331063149.25611-1-hsiangkao@linux.alibaba.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6326a3dc
    • Kang Yang's avatar
      wifi: ath10k: avoid NULL pointer error during sdio remove · 6e5dbd1c
      Kang Yang authored
      
      commit 95c38953 upstream.
      
      When running 'rmmod ath10k', ath10k_sdio_remove() will free sdio
      workqueue by destroy_workqueue(). But if CONFIG_INIT_ON_FREE_DEFAULT_ON
      is set to yes, kernel panic will happen:
      Call trace:
       destroy_workqueue+0x1c/0x258
       ath10k_sdio_remove+0x84/0x94
       sdio_bus_remove+0x50/0x16c
       device_release_driver_internal+0x188/0x25c
       device_driver_detach+0x20/0x2c
      
      This is because during 'rmmod ath10k', ath10k_sdio_remove() will call
      ath10k_core_destroy() before destroy_workqueue(). wiphy_dev_release()
      will finally be called in ath10k_core_destroy(). This function will free
      struct cfg80211_registered_device *rdev and all its members, including
      wiphy, dev and the pointer of sdio workqueue. Then the pointer of sdio
      workqueue will be set to NULL due to CONFIG_INIT_ON_FREE_DEFAULT_ON.
      
      After device release, destroy_workqueue() will use NULL pointer then the
      kernel panic happen.
      
      Call trace:
      ath10k_sdio_remove
        ->ath10k_core_unregister
          ……
          ->ath10k_core_stop
            ->ath10k_hif_stop
              ->ath10k_sdio_irq_disable
          ->ath10k_hif_power_down
            ->del_timer_sync(&ar_sdio->sleep_timer)
        ->ath10k_core_destroy
          ->ath10k_mac_destroy
            ->ieee80211_free_hw
              ->wiphy_free
          ……
                ->wiphy_dev_release
        ->destroy_workqueue
      
      Need to call destroy_workqueue() before ath10k_core_destroy(), free
      the work queue buffer first and then free pointer of work queue by
      ath10k_core_destroy(). This order matches the error path order in
      ath10k_sdio_probe().
      
      No work will be queued on sdio workqueue between it is destroyed and
      ath10k_core_destroy() is called. Based on the call_stack above, the
      reason is:
      Only ath10k_sdio_sleep_timer_handler(), ath10k_sdio_hif_tx_sg() and
      ath10k_sdio_irq_disable() will queue work on sdio workqueue.
      Sleep timer will be deleted before ath10k_core_destroy() in
      ath10k_hif_power_down().
      ath10k_sdio_irq_disable() only be called in ath10k_hif_stop().
      ath10k_core_unregister() will call ath10k_hif_power_down() to stop hif
      bus, so ath10k_sdio_hif_tx_sg() won't be called anymore.
      
      Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00189
      
      Signed-off-by: default avatarKang Yang <quic_kangyang@quicinc.com>
      Tested-by: default avatarDavid Ruth <druth@chromium.org>
      Reviewed-by: default avatarDavid Ruth <druth@chromium.org>
      Link: https://patch.msgid.link/20241008022246.1010-1-quic_kangyang@quicinc.com
      
      
      Signed-off-by: default avatarJeff Johnson <quic_jjohnson@quicinc.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6e5dbd1c
    • Greg Kroah-Hartman's avatar
      Revert "regmap: detach regmap from dev on regmap_exit" · cd862903
      Greg Kroah-Hartman authored
      This reverts commit 48dc44f3 which is
      commit 3061e170 upstream.
      
      It was backported incorrectly, a fixed version will be applied later.
      
      Cc: Cosmin Tanislav <demonsingur@gmail.com>
      Cc: Mark Brown <broonie@kernel.org>
      Link: https://lore.kernel.org/r/20250115033244.2540522-1-tzungbi@kernel.org
      
      
      Reported-by: default avatarTzung-Bi Shih <tzungbi@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cd862903
    • Suraj Sonawane's avatar
      scsi: sg: Fix slab-use-after-free read in sg_release() · 275b8347
      Suraj Sonawane authored
      
      commit f10593ad upstream.
      
      Fix a use-after-free bug in sg_release(), detected by syzbot with KASAN:
      
      BUG: KASAN: slab-use-after-free in lock_release+0x151/0xa30
      kernel/locking/lockdep.c:5838
      __mutex_unlock_slowpath+0xe2/0x750 kernel/locking/mutex.c:912
      sg_release+0x1f4/0x2e0 drivers/scsi/sg.c:407
      
      In sg_release(), the function kref_put(&sfp->f_ref, sg_remove_sfp) is
      called before releasing the open_rel_lock mutex. The kref_put() call may
      decrement the reference count of sfp to zero, triggering its cleanup
      through sg_remove_sfp(). This cleanup includes scheduling deferred work
      via sg_remove_sfp_usercontext(), which ultimately frees sfp.
      
      After kref_put(), sg_release() continues to unlock open_rel_lock and may
      reference sfp or sdp. If sfp has already been freed, this results in a
      slab-use-after-free error.
      
      Move the kref_put(&sfp->f_ref, sg_remove_sfp) call after unlocking the
      open_rel_lock mutex. This ensures:
      
       - No references to sfp or sdp occur after the reference count is
         decremented.
      
       - Cleanup functions such as sg_remove_sfp() and
         sg_remove_sfp_usercontext() can safely execute without impacting the
         mutex handling in sg_release().
      
      The fix has been tested and validated by syzbot. This patch closes the
      bug reported at the following syzkaller link and ensures proper
      sequencing of resource cleanup and mutex operations, eliminating the
      risk of use-after-free errors in sg_release().
      
      Reported-by: default avatar <syzbot+7efb5850a17ba6ce098b@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=7efb5850a17ba6ce098b
      
      
      Tested-by: default avatar <syzbot+7efb5850a17ba6ce098b@syzkaller.appspotmail.com>
      Fixes: cc833acb ("sg: O_EXCL and other lock handling")
      Signed-off-by: default avatarSuraj Sonawane <surajsonawane0215@gmail.com>
      Link: https://lore.kernel.org/r/20241120125944.88095-1-surajsonawane0215@gmail.com
      
      
      Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarAlva Lan <alvalan9@foxmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      275b8347
    • Zhu Yanjun's avatar
      RDMA/rxe: Fix the qp flush warnings in req · 9e95518e
      Zhu Yanjun authored
      
      commit ea4c990f upstream.
      
      When the qp is in error state, the status of WQEs in the queue should be
      set to error. Or else the following will appear.
      
      [  920.617269] WARNING: CPU: 1 PID: 21 at drivers/infiniband/sw/rxe/rxe_comp.c:756 rxe_completer+0x989/0xcc0 [rdma_rxe]
      [  920.617744] Modules linked in: rnbd_client(O) rtrs_client(O) rtrs_core(O) rdma_ucm rdma_cm iw_cm ib_cm crc32_generic rdma_rxe ip6_udp_tunnel udp_tunnel ib_uverbs ib_core loop brd null_blk ipv6
      [  920.618516] CPU: 1 PID: 21 Comm: ksoftirqd/1 Tainted: G           O       6.1.113-storage+ #65
      [  920.618986] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
      [  920.619396] RIP: 0010:rxe_completer+0x989/0xcc0 [rdma_rxe]
      [  920.619658] Code: 0f b6 84 24 3a 02 00 00 41 89 84 24 44 04 00 00 e9 2a f7 ff ff 39 ca bb 03 00 00 00 b8 0e 00 00 00 48 0f 45 d8 e9 15 f7 ff ff <0f> 0b e9 cb f8 ff ff 41 bf f5 ff ff ff e9 08 f8 ff ff 49 8d bc 24
      [  920.620482] RSP: 0018:ffff97b7c00bbc38 EFLAGS: 00010246
      [  920.620817] RAX: 0000000000000000 RBX: 000000000000000c RCX: 0000000000000008
      [  920.621183] RDX: ffff960dc396ebc0 RSI: 0000000000005400 RDI: ffff960dc4e2fbac
      [  920.621548] RBP: 0000000000000000 R08: 0000000000000001 R09: ffffffffac406450
      [  920.621884] R10: ffffffffac4060c0 R11: 0000000000000001 R12: ffff960dc4e2f800
      [  920.622254] R13: ffff960dc4e2f928 R14: ffff97b7c029c580 R15: 0000000000000000
      [  920.622609] FS:  0000000000000000(0000) GS:ffff960ef7d00000(0000) knlGS:0000000000000000
      [  920.622979] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  920.623245] CR2: 00007fa056965e90 CR3: 00000001107f1000 CR4: 00000000000006e0
      [  920.623680] Call Trace:
      [  920.623815]  <TASK>
      [  920.623933]  ? __warn+0x79/0xc0
      [  920.624116]  ? rxe_completer+0x989/0xcc0 [rdma_rxe]
      [  920.624356]  ? report_bug+0xfb/0x150
      [  920.624594]  ? handle_bug+0x3c/0x60
      [  920.624796]  ? exc_invalid_op+0x14/0x70
      [  920.624976]  ? asm_exc_invalid_op+0x16/0x20
      [  920.625203]  ? rxe_completer+0x989/0xcc0 [rdma_rxe]
      [  920.625474]  ? rxe_completer+0x329/0xcc0 [rdma_rxe]
      [  920.625749]  rxe_do_task+0x80/0x110 [rdma_rxe]
      [  920.626037]  rxe_requester+0x625/0xde0 [rdma_rxe]
      [  920.626310]  ? rxe_cq_post+0xe2/0x180 [rdma_rxe]
      [  920.626583]  ? do_complete+0x18d/0x220 [rdma_rxe]
      [  920.626812]  ? rxe_completer+0x1a3/0xcc0 [rdma_rxe]
      [  920.627050]  rxe_do_task+0x80/0x110 [rdma_rxe]
      [  920.627285]  tasklet_action_common.constprop.0+0xa4/0x120
      [  920.627522]  handle_softirqs+0xc2/0x250
      [  920.627728]  ? sort_range+0x20/0x20
      [  920.627942]  run_ksoftirqd+0x1f/0x30
      [  920.628158]  smpboot_thread_fn+0xc7/0x1b0
      [  920.628334]  kthread+0xd6/0x100
      [  920.628504]  ? kthread_complete_and_exit+0x20/0x20
      [  920.628709]  ret_from_fork+0x1f/0x30
      [  920.628892]  </TASK>
      
      Fixes: ae720bdb ("RDMA/rxe: Generate error completion for error requester QP state")
      Signed-off-by: default avatarZhu Yanjun <yanjun.zhu@linux.dev>
      Link: https://patch.msgid.link/20241025152036.121417-1-yanjun.zhu@linux.dev
      
      
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarBin Lan <lanbincn@qq.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9e95518e
    • Greg Kroah-Hartman's avatar
      Revert "drm/amdgpu: rework resume handling for display (v2)" · e7736037
      Greg Kroah-Hartman authored
      This reverts commit c807ab3a which is
      commit 73dae652 upstream.
      
      The original patch 73dae652 (drm/amdgpu: rework resume handling for
      display (v2)), was only targeted at kernels 6.11 and newer.  It did not
      apply cleanly to 6.12 so I backported it and it backport landed as
      99a02eab ("drm/amdgpu: rework resume handling for display (v2)"),
      however there was a bug in the backport that was subsequently fixed in
      063d380c ("drm/amdgpu: fix backport of commit 73dae652").  None
      of this was intended for kernels older than 6.11, however the original
      backport eventually landed in 6.6, 6.1, and 5.15.
      
      Please revert the change from kernels 6.6, 6.1, and 5.15.
      
      Link: https://lore.kernel.org/r/BL1PR12MB5144D5363FCE6F2FD3502534F7E72@BL1PR12MB5144.namprd12.prod.outlook.com
      Link: https://lore.kernel.org/r/BL1PR12MB51449ADCFBF2314431F8BCFDF7132@BL1PR12MB5144.namprd12.prod.outlook.com
      
      
      Reported-by: default avatarSalvatore Bonaccorso <carnil@debian.org>
      Reported-by: default avatarChristian König <christian.koenig@amd.com>
      Reported-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e7736037
    • Yu Kuai's avatar
      block: fix uaf for flush rq while iterating tags · 1921fe7d
      Yu Kuai authored
      
      commit 3802f73b upstream.
      
      blk_mq_clear_flush_rq_mapping() is not called during scsi probe, by
      checking blk_queue_init_done(). However, QUEUE_FLAG_INIT_DONE is cleared
      in del_gendisk by commit aec89dc5 ("block: keep q_usage_counter in
      atomic mode after del_gendisk"), hence for disk like scsi, following
      blk_mq_destroy_queue() will not clear flush rq from tags->rqs[] as well,
      cause following uaf that is found by our syzkaller for v6.6:
      
      ==================================================================
      BUG: KASAN: slab-use-after-free in blk_mq_find_and_get_req+0x16e/0x1a0 block/blk-mq-tag.c:261
      Read of size 4 at addr ffff88811c969c20 by task kworker/1:2H/224909
      
      CPU: 1 PID: 224909 Comm: kworker/1:2H Not tainted 6.6.0-ga836a5060850 #32
      Workqueue: kblockd blk_mq_timeout_work
      Call Trace:
      
      __dump_stack lib/dump_stack.c:88 [inline]
      dump_stack_lvl+0x91/0xf0 lib/dump_stack.c:106
      print_address_description.constprop.0+0x66/0x300 mm/kasan/report.c:364
      print_report+0x3e/0x70 mm/kasan/report.c:475
      kasan_report+0xb8/0xf0 mm/kasan/report.c:588
      blk_mq_find_and_get_req+0x16e/0x1a0 block/blk-mq-tag.c:261
      bt_iter block/blk-mq-tag.c:288 [inline]
      __sbitmap_for_each_set include/linux/sbitmap.h:295 [inline]
      sbitmap_for_each_set include/linux/sbitmap.h:316 [inline]
      bt_for_each+0x455/0x790 block/blk-mq-tag.c:325
      blk_mq_queue_tag_busy_iter+0x320/0x740 block/blk-mq-tag.c:534
      blk_mq_timeout_work+0x1a3/0x7b0 block/blk-mq.c:1673
      process_one_work+0x7c4/0x1450 kernel/workqueue.c:2631
      process_scheduled_works kernel/workqueue.c:2704 [inline]
      worker_thread+0x804/0xe40 kernel/workqueue.c:2785
      kthread+0x346/0x450 kernel/kthread.c:388
      ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147
      ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:293
      
      Allocated by task 942:
      kasan_save_stack+0x22/0x50 mm/kasan/common.c:45
      kasan_set_track+0x25/0x30 mm/kasan/common.c:52
      ____kasan_kmalloc mm/kasan/common.c:374 [inline]
      __kasan_kmalloc mm/kasan/common.c:383 [inline]
      __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:380
      kasan_kmalloc include/linux/kasan.h:198 [inline]
      __do_kmalloc_node mm/slab_common.c:1007 [inline]
      __kmalloc_node+0x69/0x170 mm/slab_common.c:1014
      kmalloc_node include/linux/slab.h:620 [inline]
      kzalloc_node include/linux/slab.h:732 [inline]
      blk_alloc_flush_queue+0x144/0x2f0 block/blk-flush.c:499
      blk_mq_alloc_hctx+0x601/0x940 block/blk-mq.c:3788
      blk_mq_alloc_and_init_hctx+0x27f/0x330 block/blk-mq.c:4261
      blk_mq_realloc_hw_ctxs+0x488/0x5e0 block/blk-mq.c:4294
      blk_mq_init_allocated_queue+0x188/0x860 block/blk-mq.c:4350
      blk_mq_init_queue_data block/blk-mq.c:4166 [inline]
      blk_mq_init_queue+0x8d/0x100 block/blk-mq.c:4176
      scsi_alloc_sdev+0x843/0xd50 drivers/scsi/scsi_scan.c:335
      scsi_probe_and_add_lun+0x77c/0xde0 drivers/scsi/scsi_scan.c:1189
      __scsi_scan_target+0x1fc/0x5a0 drivers/scsi/scsi_scan.c:1727
      scsi_scan_channel drivers/scsi/scsi_scan.c:1815 [inline]
      scsi_scan_channel+0x14b/0x1e0 drivers/scsi/scsi_scan.c:1791
      scsi_scan_host_selected+0x2fe/0x400 drivers/scsi/scsi_scan.c:1844
      scsi_scan+0x3a0/0x3f0 drivers/scsi/scsi_sysfs.c:151
      store_scan+0x2a/0x60 drivers/scsi/scsi_sysfs.c:191
      dev_attr_store+0x5c/0x90 drivers/base/core.c:2388
      sysfs_kf_write+0x11c/0x170 fs/sysfs/file.c:136
      kernfs_fop_write_iter+0x3fc/0x610 fs/kernfs/file.c:338
      call_write_iter include/linux/fs.h:2083 [inline]
      new_sync_write+0x1b4/0x2d0 fs/read_write.c:493
      vfs_write+0x76c/0xb00 fs/read_write.c:586
      ksys_write+0x127/0x250 fs/read_write.c:639
      do_syscall_x64 arch/x86/entry/common.c:51 [inline]
      do_syscall_64+0x70/0x120 arch/x86/entry/common.c:81
      entry_SYSCALL_64_after_hwframe+0x78/0xe2
      
      Freed by task 244687:
      kasan_save_stack+0x22/0x50 mm/kasan/common.c:45
      kasan_set_track+0x25/0x30 mm/kasan/common.c:52
      kasan_save_free_info+0x2b/0x50 mm/kasan/generic.c:522
      ____kasan_slab_free mm/kasan/common.c:236 [inline]
      __kasan_slab_free+0x12a/0x1b0 mm/kasan/common.c:244
      kasan_slab_free include/linux/kasan.h:164 [inline]
      slab_free_hook mm/slub.c:1815 [inline]
      slab_free_freelist_hook mm/slub.c:1841 [inline]
      slab_free mm/slub.c:3807 [inline]
      __kmem_cache_free+0xe4/0x520 mm/slub.c:3820
      blk_free_flush_queue+0x40/0x60 block/blk-flush.c:520
      blk_mq_hw_sysfs_release+0x4a/0x170 block/blk-mq-sysfs.c:37
      kobject_cleanup+0x136/0x410 lib/kobject.c:689
      kobject_release lib/kobject.c:720 [inline]
      kref_put include/linux/kref.h:65 [inline]
      kobject_put+0x119/0x140 lib/kobject.c:737
      blk_mq_release+0x24f/0x3f0 block/blk-mq.c:4144
      blk_free_queue block/blk-core.c:298 [inline]
      blk_put_queue+0xe2/0x180 block/blk-core.c:314
      blkg_free_workfn+0x376/0x6e0 block/blk-cgroup.c:144
      process_one_work+0x7c4/0x1450 kernel/workqueue.c:2631
      process_scheduled_works kernel/workqueue.c:2704 [inline]
      worker_thread+0x804/0xe40 kernel/workqueue.c:2785
      kthread+0x346/0x450 kernel/kthread.c:388
      ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147
      ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:293
      
      Other than blk_mq_clear_flush_rq_mapping(), the flag is only used in
      blk_register_queue() from initialization path, hence it's safe not to
      clear the flag in del_gendisk. And since QUEUE_FLAG_REGISTERED already
      make sure that queue should only be registered once, there is no need
      to test the flag as well.
      
      Fixes: 6cfeadbf ("blk-mq: don't clear flush_rq from tags->rqs[]")
      Depends-on: commit aec89dc5 ("block: keep q_usage_counter in atomic mode after del_gendisk")
      Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
      Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
      Link: https://lore.kernel.org/r/20241104110005.1412161-1-yukuai1@huaweicloud.com
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarBRUNO VERNAY <bruno.vernay@se.com>
      Signed-off-by: default avatarHugo SIMELIERE <hsimeliere.opensource@witekio.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1921fe7d
    • Vitaly Prosyak's avatar
      drm/amdgpu: fix usage slab after free · 05b1b339
      Vitaly Prosyak authored
      
      commit b61badd2 upstream.
      
      [  +0.000021] BUG: KASAN: slab-use-after-free in drm_sched_entity_flush+0x6cb/0x7a0 [gpu_sched]
      [  +0.000027] Read of size 8 at addr ffff8881b8605f88 by task amd_pci_unplug/2147
      
      [  +0.000023] CPU: 6 PID: 2147 Comm: amd_pci_unplug Not tainted 6.10.0+ #1
      [  +0.000016] Hardware name: ASUS System Product Name/ROG STRIX B550-F GAMING (WI-FI), BIOS 1401 12/03/2020
      [  +0.000016] Call Trace:
      [  +0.000008]  <TASK>
      [  +0.000009]  dump_stack_lvl+0x76/0xa0
      [  +0.000017]  print_report+0xce/0x5f0
      [  +0.000017]  ? drm_sched_entity_flush+0x6cb/0x7a0 [gpu_sched]
      [  +0.000019]  ? srso_return_thunk+0x5/0x5f
      [  +0.000015]  ? kasan_complete_mode_report_info+0x72/0x200
      [  +0.000016]  ? drm_sched_entity_flush+0x6cb/0x7a0 [gpu_sched]
      [  +0.000019]  kasan_report+0xbe/0x110
      [  +0.000015]  ? drm_sched_entity_flush+0x6cb/0x7a0 [gpu_sched]
      [  +0.000023]  __asan_report_load8_noabort+0x14/0x30
      [  +0.000014]  drm_sched_entity_flush+0x6cb/0x7a0 [gpu_sched]
      [  +0.000020]  ? srso_return_thunk+0x5/0x5f
      [  +0.000013]  ? __kasan_check_write+0x14/0x30
      [  +0.000016]  ? __pfx_drm_sched_entity_flush+0x10/0x10 [gpu_sched]
      [  +0.000020]  ? srso_return_thunk+0x5/0x5f
      [  +0.000013]  ? __kasan_check_write+0x14/0x30
      [  +0.000013]  ? srso_return_thunk+0x5/0x5f
      [  +0.000013]  ? enable_work+0x124/0x220
      [  +0.000015]  ? __pfx_enable_work+0x10/0x10
      [  +0.000013]  ? srso_return_thunk+0x5/0x5f
      [  +0.000014]  ? free_large_kmalloc+0x85/0xf0
      [  +0.000016]  drm_sched_entity_destroy+0x18/0x30 [gpu_sched]
      [  +0.000020]  amdgpu_vce_sw_fini+0x55/0x170 [amdgpu]
      [  +0.000735]  ? __kasan_check_read+0x11/0x20
      [  +0.000016]  vce_v4_0_sw_fini+0x80/0x110 [amdgpu]
      [  +0.000726]  amdgpu_device_fini_sw+0x331/0xfc0 [amdgpu]
      [  +0.000679]  ? mutex_unlock+0x80/0xe0
      [  +0.000017]  ? __pfx_amdgpu_device_fini_sw+0x10/0x10 [amdgpu]
      [  +0.000662]  ? srso_return_thunk+0x5/0x5f
      [  +0.000014]  ? __kasan_check_write+0x14/0x30
      [  +0.000013]  ? srso_return_thunk+0x5/0x5f
      [  +0.000013]  ? mutex_unlock+0x80/0xe0
      [  +0.000016]  amdgpu_driver_release_kms+0x16/0x80 [amdgpu]
      [  +0.000663]  drm_minor_release+0xc9/0x140 [drm]
      [  +0.000081]  drm_release+0x1fd/0x390 [drm]
      [  +0.000082]  __fput+0x36c/0xad0
      [  +0.000018]  __fput_sync+0x3c/0x50
      [  +0.000014]  __x64_sys_close+0x7d/0xe0
      [  +0.000014]  x64_sys_call+0x1bc6/0x2680
      [  +0.000014]  do_syscall_64+0x70/0x130
      [  +0.000014]  ? srso_return_thunk+0x5/0x5f
      [  +0.000014]  ? irqentry_exit_to_user_mode+0x60/0x190
      [  +0.000015]  ? srso_return_thunk+0x5/0x5f
      [  +0.000014]  ? irqentry_exit+0x43/0x50
      [  +0.000012]  ? srso_return_thunk+0x5/0x5f
      [  +0.000013]  ? exc_page_fault+0x7c/0x110
      [  +0.000015]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
      [  +0.000014] RIP: 0033:0x7ffff7b14f67
      [  +0.000013] Code: ff e8 0d 16 02 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 41 c3 48 83 ec 18 89 7c 24 0c e8 73 ba f7 ff
      [  +0.000026] RSP: 002b:00007fffffffe378 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
      [  +0.000019] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007ffff7b14f67
      [  +0.000014] RDX: 0000000000000000 RSI: 00007ffff7f6f47a RDI: 0000000000000003
      [  +0.000014] RBP: 00007fffffffe3a0 R08: 0000555555569890 R09: 0000000000000000
      [  +0.000014] R10: 0000000000000000 R11: 0000000000000246 R12: 00007fffffffe5c8
      [  +0.000013] R13: 00005555555552a9 R14: 0000555555557d48 R15: 00007ffff7ffd040
      [  +0.000020]  </TASK>
      
      [  +0.000016] Allocated by task 383 on cpu 7 at 26.880319s:
      [  +0.000014]  kasan_save_stack+0x28/0x60
      [  +0.000008]  kasan_save_track+0x18/0x70
      [  +0.000007]  kasan_save_alloc_info+0x38/0x60
      [  +0.000007]  __kasan_kmalloc+0xc1/0xd0
      [  +0.000007]  kmalloc_trace_noprof+0x180/0x380
      [  +0.000007]  drm_sched_init+0x411/0xec0 [gpu_sched]
      [  +0.000012]  amdgpu_device_init+0x695f/0xa610 [amdgpu]
      [  +0.000658]  amdgpu_driver_load_kms+0x1a/0x120 [amdgpu]
      [  +0.000662]  amdgpu_pci_probe+0x361/0xf30 [amdgpu]
      [  +0.000651]  local_pci_probe+0xe7/0x1b0
      [  +0.000009]  pci_device_probe+0x248/0x890
      [  +0.000008]  really_probe+0x1fd/0x950
      [  +0.000008]  __driver_probe_device+0x307/0x410
      [  +0.000007]  driver_probe_device+0x4e/0x150
      [  +0.000007]  __driver_attach+0x223/0x510
      [  +0.000006]  bus_for_each_dev+0x102/0x1a0
      [  +0.000007]  driver_attach+0x3d/0x60
      [  +0.000006]  bus_add_driver+0x2ac/0x5f0
      [  +0.000006]  driver_register+0x13d/0x490
      [  +0.000008]  __pci_register_driver+0x1ee/0x2b0
      [  +0.000007]  llc_sap_close+0xb0/0x160 [llc]
      [  +0.000009]  do_one_initcall+0x9c/0x3e0
      [  +0.000008]  do_init_module+0x241/0x760
      [  +0.000008]  load_module+0x51ac/0x6c30
      [  +0.000006]  __do_sys_init_module+0x234/0x270
      [  +0.000007]  __x64_sys_init_module+0x73/0xc0
      [  +0.000006]  x64_sys_call+0xe3/0x2680
      [  +0.000006]  do_syscall_64+0x70/0x130
      [  +0.000007]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
      
      [  +0.000015] Freed by task 2147 on cpu 6 at 160.507651s:
      [  +0.000013]  kasan_save_stack+0x28/0x60
      [  +0.000007]  kasan_save_track+0x18/0x70
      [  +0.000007]  kasan_save_free_info+0x3b/0x60
      [  +0.000007]  poison_slab_object+0x115/0x1c0
      [  +0.000007]  __kasan_slab_free+0x34/0x60
      [  +0.000007]  kfree+0xfa/0x2f0
      [  +0.000007]  drm_sched_fini+0x19d/0x410 [gpu_sched]
      [  +0.000012]  amdgpu_fence_driver_sw_fini+0xc4/0x2f0 [amdgpu]
      [  +0.000662]  amdgpu_device_fini_sw+0x77/0xfc0 [amdgpu]
      [  +0.000653]  amdgpu_driver_release_kms+0x16/0x80 [amdgpu]
      [  +0.000655]  drm_minor_release+0xc9/0x140 [drm]
      [  +0.000071]  drm_release+0x1fd/0x390 [drm]
      [  +0.000071]  __fput+0x36c/0xad0
      [  +0.000008]  __fput_sync+0x3c/0x50
      [  +0.000007]  __x64_sys_close+0x7d/0xe0
      [  +0.000007]  x64_sys_call+0x1bc6/0x2680
      [  +0.000007]  do_syscall_64+0x70/0x130
      [  +0.000007]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
      
      [  +0.000014] The buggy address belongs to the object at ffff8881b8605f80
                     which belongs to the cache kmalloc-64 of size 64
      [  +0.000020] The buggy address is located 8 bytes inside of
                     freed 64-byte region [ffff8881b8605f80, ffff8881b8605fc0)
      
      [  +0.000028] The buggy address belongs to the physical page:
      [  +0.000011] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1b8605
      [  +0.000008] anon flags: 0x17ffffc0000000(node=0|zone=2|lastcpupid=0x1fffff)
      [  +0.000007] page_type: 0xffffefff(slab)
      [  +0.000009] raw: 0017ffffc0000000 ffff8881000428c0 0000000000000000 dead000000000001
      [  +0.000006] raw: 0000000000000000 0000000000200020 00000001ffffefff 0000000000000000
      [  +0.000006] page dumped because: kasan: bad access detected
      
      [  +0.000012] Memory state around the buggy address:
      [  +0.000011]  ffff8881b8605e80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
      [  +0.000015]  ffff8881b8605f00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
      [  +0.000015] >ffff8881b8605f80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
      [  +0.000013]                       ^
      [  +0.000011]  ffff8881b8606000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc
      [  +0.000014]  ffff8881b8606080: fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb fb
      [  +0.000013] ==================================================================
      
      The issue reproduced on VG20 during the IGT pci_unplug test.
      The root cause of the issue is that the function drm_sched_fini is called before drm_sched_entity_kill.
      In drm_sched_fini, the drm_sched_rq structure is freed, but this structure is later accessed by
      each entity within the run queue, leading to invalid memory access.
      To resolve this, the order of cleanup calls is updated:
      
          Before:
              amdgpu_fence_driver_sw_fini
              amdgpu_device_ip_fini
      
          After:
              amdgpu_device_ip_fini
              amdgpu_fence_driver_sw_fini
      
      This updated order ensures that all entities in the IPs are cleaned up first, followed by proper
      cleanup of the schedulers.
      
      Additional Investigation:
      
      During debugging, another issue was identified in the amdgpu_vce_sw_fini function. The vce.vcpu_bo
      buffer must be freed only as the final step in the cleanup process to prevent any premature
      access during earlier cleanup stages.
      
      v2: Using Christian suggestion call drm_sched_entity_destroy before drm_sched_fini.
      
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarVitaly Prosyak <vitaly.prosyak@amd.com>
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAlva Lan <alvalan9@foxmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      05b1b339
    • Srinivasan Shanmugam's avatar
      drm/amd/display: Fix out-of-bounds access in 'dcn21_link_encoder_create' · 5bd410c2
      Srinivasan Shanmugam authored
      
      commit 63de35a8 upstream.
      
      An issue was identified in the dcn21_link_encoder_create function where
      an out-of-bounds access could occur when the hpd_source index was used
      to reference the link_enc_hpd_regs array. This array has a fixed size
      and the index was not being checked against the array's bounds before
      accessing it.
      
      This fix adds a conditional check to ensure that the hpd_source index is
      within the valid range of the link_enc_hpd_regs array. If the index is
      out of bounds, the function now returns NULL to prevent undefined
      behavior.
      
      References:
      
      [   65.920507] ------------[ cut here ]------------
      [   65.920510] UBSAN: array-index-out-of-bounds in drivers/gpu/drm/amd/amdgpu/../display/dc/resource/dcn21/dcn21_resource.c:1312:29
      [   65.920519] index 7 is out of range for type 'dcn10_link_enc_hpd_registers [5]'
      [   65.920523] CPU: 3 PID: 1178 Comm: modprobe Tainted: G           OE      6.8.0-cleanershaderfeatureresetasdntipmi200nv2132 #13
      [   65.920525] Hardware name: AMD Majolica-RN/Majolica-RN, BIOS WMJ0429N_Weekly_20_04_2 04/29/2020
      [   65.920527] Call Trace:
      [   65.920529]  <TASK>
      [   65.920532]  dump_stack_lvl+0x48/0x70
      [   65.920541]  dump_stack+0x10/0x20
      [   65.920543]  __ubsan_handle_out_of_bounds+0xa2/0xe0
      [   65.920549]  dcn21_link_encoder_create+0xd9/0x140 [amdgpu]
      [   65.921009]  link_create+0x6d3/0xed0 [amdgpu]
      [   65.921355]  create_links+0x18a/0x4e0 [amdgpu]
      [   65.921679]  dc_create+0x360/0x720 [amdgpu]
      [   65.921999]  ? dmi_matches+0xa0/0x220
      [   65.922004]  amdgpu_dm_init+0x2b6/0x2c90 [amdgpu]
      [   65.922342]  ? console_unlock+0x77/0x120
      [   65.922348]  ? dev_printk_emit+0x86/0xb0
      [   65.922354]  dm_hw_init+0x15/0x40 [amdgpu]
      [   65.922686]  amdgpu_device_init+0x26a8/0x33a0 [amdgpu]
      [   65.922921]  amdgpu_driver_load_kms+0x1b/0xa0 [amdgpu]
      [   65.923087]  amdgpu_pci_probe+0x1b7/0x630 [amdgpu]
      [   65.923087]  local_pci_probe+0x4b/0xb0
      [   65.923087]  pci_device_probe+0xc8/0x280
      [   65.923087]  really_probe+0x187/0x300
      [   65.923087]  __driver_probe_device+0x85/0x130
      [   65.923087]  driver_probe_device+0x24/0x110
      [   65.923087]  __driver_attach+0xac/0x1d0
      [   65.923087]  ? __pfx___driver_attach+0x10/0x10
      [   65.923087]  bus_for_each_dev+0x7d/0xd0
      [   65.923087]  driver_attach+0x1e/0x30
      [   65.923087]  bus_add_driver+0xf2/0x200
      [   65.923087]  driver_register+0x64/0x130
      [   65.923087]  ? __pfx_amdgpu_init+0x10/0x10 [amdgpu]
      [   65.923087]  __pci_register_driver+0x61/0x70
      [   65.923087]  amdgpu_init+0x7d/0xff0 [amdgpu]
      [   65.923087]  do_one_initcall+0x49/0x310
      [   65.923087]  ? kmalloc_trace+0x136/0x360
      [   65.923087]  do_init_module+0x6a/0x270
      [   65.923087]  load_module+0x1fce/0x23a0
      [   65.923087]  init_module_from_file+0x9c/0xe0
      [   65.923087]  ? init_module_from_file+0x9c/0xe0
      [   65.923087]  idempotent_init_module+0x179/0x230
      [   65.923087]  __x64_sys_finit_module+0x5d/0xa0
      [   65.923087]  do_syscall_64+0x76/0x120
      [   65.923087]  entry_SYSCALL_64_after_hwframe+0x6e/0x76
      [   65.923087] RIP: 0033:0x7f2d80f1e88d
      [   65.923087] Code: 5b 41 5c c3 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 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 73 b5 0f 00 f7 d8 64 89 01 48
      [   65.923087] RSP: 002b:00007ffc7bc1aa78 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
      [   65.923087] RAX: ffffffffffffffda RBX: 0000564c9c1db130 RCX: 00007f2d80f1e88d
      [   65.923087] RDX: 0000000000000000 RSI: 0000564c9c1e5480 RDI: 000000000000000f
      [   65.923087] RBP: 0000000000040000 R08: 0000000000000000 R09: 0000000000000002
      [   65.923087] R10: 000000000000000f R11: 0000000000000246 R12: 0000564c9c1e5480
      [   65.923087] R13: 0000564c9c1db260 R14: 0000000000000000 R15: 0000564c9c1e54b0
      [   65.923087]  </TASK>
      [   65.923927] ---[ end trace ]---
      
      Cc: Tom Chung <chiahsuan.chung@amd.com>
      Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Cc: Roman Li <roman.li@amd.com>
      Cc: Alex Hung <alex.hung@amd.com>
      Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
      Cc: Harry Wentland <harry.wentland@amd.com>
      Cc: Hamza Mahfooz <hamza.mahfooz@amd.com>
      Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
      Reviewed-by: default avatarRoman Li <roman.li@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarBin Lan <lanbincn@qq.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5bd410c2
    • Javier Carrasco's avatar
      iio: adc: rockchip_saradc: fix information leak in triggered buffer · 64b79afd
      Javier Carrasco authored
      
      commit 38724591 upstream.
      
      The 'data' local struct is used to push data to user space from a
      triggered buffer, but it does not set values for inactive channels, as
      it only uses iio_for_each_active_channel() to assign new values.
      
      Initialize the struct to zero before using it to avoid pushing
      uninitialized information to userspace.
      
      Cc: stable@vger.kernel.org
      Fixes: 4e130dc7 ("iio: adc: rockchip_saradc: Add support iio buffers")
      Signed-off-by: default avatarJavier Carrasco <javier.carrasco.cruz@gmail.com>
      Link: https://patch.msgid.link/20241125-iio_memset_scan_holes-v1-4-0cb6e98d895c@gmail.com
      
      
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarBin Lan <lanbincn@qq.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      64b79afd
    • JeanBaptiste Maneyrol's avatar
      iio: imu: inv_icm42600: fix timestamps after suspend if sensor is on · d3e25180
      JeanBaptiste Maneyrol authored
      
      commit 65a60a59 upstream.
      
      Currently suspending while sensors are one will result in timestamping
      continuing without gap at resume. It can work with monotonic clock but
      not with other clocks. Fix that by resetting timestamping.
      
      Fixes: ec74ae9f ("iio: imu: inv_icm42600: add accurate timestamping")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
      Link: https://patch.msgid.link/20241113-inv_icm42600-fix-timestamps-after-suspend-v1-1-dfc77c394173@tdk.com
      
      
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d3e25180
    • JeanBaptiste Maneyrol's avatar
      iio: imu: inv_icm42600: fix spi burst write not supported · f2e4823b
      JeanBaptiste Maneyrol authored
      
      commit c0f866de upstream.
      
      Burst write with SPI is not working for all icm42600 chips. It was
      only used for setting user offsets with regmap_bulk_write.
      
      Add specific SPI regmap config for using only single write with SPI.
      
      Fixes: 9f9ff91b ("iio: imu: inv_icm42600: add SPI driver for inv_icm42600 driver")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
      Link: https://patch.msgid.link/20241112-inv-icm42600-fix-spi-burst-write-not-supported-v2-1-97690dc03607@tdk.com
      
      
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f2e4823b
    • Terry Tritton's avatar
      Revert "PCI: Use preserve_config in place of pci_flags" · 479a42ee
      Terry Tritton authored
      
      This reverts commit f858b0fa which is
      commit 7246a452 upstream.
      
      This patch causes a regression in cuttlefish/crossvm boot on arm64.
      
      The patch was part of a series that when applied will not cause a regression
      but this patch was backported to the 6.1 branch by itself.
      
      The other patches do not apply cleanly to the 6.1 branch.
      
      Signed-off-by: default avatarTerry Tritton <terry.tritton@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      479a42ee
Loading