diff options
| author | Joanne Koong <[email protected]> | 2025-03-18 00:30:28 +0000 |
|---|---|---|
| committer | Christian Brauner <[email protected]> | 2025-03-19 08:24:03 +0000 |
| commit | d9ecc77193cad25402ff5517fb26fb22b4db0e10 (patch) | |
| tree | d2d1d22ae4a3df3ba148cfc9cbd422eec22c4f72 /drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | |
| parent | afs: Fix afs_atcell_get_link() to check if ws_cell is unset first (diff) | |
| download | kernel-d9ecc77193cad25402ff5517fb26fb22b4db0e10.tar.gz kernel-d9ecc77193cad25402ff5517fb26fb22b4db0e10.zip | |
fuse: fix uring race condition for null dereference of fc
There is a race condition leading to a kernel crash from a null
dereference when attemping to access fc->lock in
fuse_uring_create_queue(). fc may be NULL in the case where another
thread is creating the uring in fuse_uring_create() and has set
fc->ring but has not yet set ring->fc when fuse_uring_create_queue()
reads ring->fc. There is another race condition as well where in
fuse_uring_register(), ring->nr_queues may still be 0 and not yet set
to the new value when we compare qid against it.
This fix sets fc->ring only after ring->fc and ring->nr_queues have been
set, which guarantees now that ring->fc is a proper pointer when any
queues are created and ring->nr_queues reflects the right number of
queues if ring is not NULL. We must use smp_store_release() and
smp_load_acquire() semantics to ensure the ordering will remain correct
where fc->ring is assigned only after ring->fc and ring->nr_queues have
been assigned.
Signed-off-by: Joanne Koong <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Fixes: 24fe962c86f5 ("fuse: {io-uring} Handle SQEs - register commands")
Acked-by: Miklos Szeredi <[email protected]>
Reviewed-by: Bernd Schubert <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c')
0 files changed, 0 insertions, 0 deletions
