---
id: CVE-2023-52480
title: |-
  In the Linux kernel, the following vulnerability has been resolved:

  ksmbd: fix race condition between session lookup and expire

   Thread A                        +  Thread B
   ksmbd_session_lookup            |  smb2_sess_setup
     sess = …
summary: |-
  In the Linux kernel, the following vulnerability has been resolved:

  ksmbd: fix race condition between session lookup and expire

   Thread A                        +  Thread B
   ksmbd_session_lookup            |  smb2_sess_setup
     sess = …
severity: critical
cvss: 9.8
cvssVector: 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H'
cwe:
  - CWE-362
vendor: linux
product: linux_kernel
affected:
  - 'linux_kernel >= 5.15, < 5.15.145'
  - 'linux_kernel >= 5.16, < 6.1.57'
  - 'linux_kernel >= 6.2, < 6.5.7'
  - linux_kernel = 6.6
patched:
  - linux_kernel 6.5.7
published: '2024-02-29'
updated: '2026-08-04'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2023-52480'
references:
  - url: 'https://git.kernel.org/stable/c/18ced78b0ebccc2d16f426143dc56ab3aad666be'
    label: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
  - url: 'https://git.kernel.org/stable/c/53ff5cf89142b978b1a5ca8dc4d4425e6a09745f'
    label: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
  - url: 'https://git.kernel.org/stable/c/a2ca5fd3dbcc665e1169044fa0c9e3eba779202b'
    label: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
  - url: 'https://git.kernel.org/stable/c/c77fd3e25a51ac92b0f1b347a96eff6a0b4f066f'
    label: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
  - url: 'https://git.kernel.org/stable/c/18ced78b0ebccc2d16f426143dc56ab3aad666be'
    label: af854a3a-2127-422b-91ae-364da2661108
  - url: 'https://git.kernel.org/stable/c/53ff5cf89142b978b1a5ca8dc4d4425e6a09745f'
    label: af854a3a-2127-422b-91ae-364da2661108
  - url: 'https://git.kernel.org/stable/c/a2ca5fd3dbcc665e1169044fa0c9e3eba779202b'
    label: af854a3a-2127-422b-91ae-364da2661108
  - url: 'https://git.kernel.org/stable/c/c77fd3e25a51ac92b0f1b347a96eff6a0b4f066f'
    label: af854a3a-2127-422b-91ae-364da2661108
tags:
  - nvd
epss: 0.00485
epssPercentile: 0.39204
ingestedAt: '2026-08-04T10:39:39.686Z'
---

## Overview

In the Linux kernel, the following vulnerability has been resolved:

ksmbd: fix race condition between session lookup and expire

 Thread A                        +  Thread B
 ksmbd_session_lookup            |  smb2_sess_setup
   sess = xa_load                |
                                 |
                                 |    xa_erase(&conn->sessions, sess->id);
                                 |
                                 |    ksmbd_session_destroy(sess) --> kfree(sess)
                                 |
   // UAF!                       |
   sess->last_active = jiffies   |
                                 +

This patch add rwsem to fix race condition between ksmbd_session_lookup
and ksmbd_expire_session.

## Affected

- `linux_kernel >= 5.15, < 5.15.145`
- `linux_kernel >= 5.16, < 6.1.57`
- `linux_kernel >= 6.2, < 6.5.7`
- `linux_kernel = 6.6`

## Remediation

Upgrade past the affected range:

- `linux_kernel 6.5.7`
