# CVE-2023-52896: btrfs: fix race between quota rescan and disable leading to NULL pointer deref

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 4.7
- **CVSS:** 4.7 (v3.1, NVD) `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: High; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.29% (percentile 14, 2026-11-26)
- **CWE:** CWE-476
- **Published:** 2024-08-21T06:10:36.233Z
- **Modified:** 2026-06-17T06:43:53.027Z

## Who should check

- Anyone running Linux \>= 26b3901d20bf9da2c6a00cb1fb48932166f80a45, \< 89ac597e3e807b91e2ebd6a7c36fec7b97290233; \>= 32747e01436aac8ef93fe85b5b523b4f3b52f040, \< 3bd43374857103ba3cac751d6d4afa8d83b5d92a; \>= 89d4cca583fc9594ee7d1a0bc986886d6fb587e6, \< 64287cd456a22373053998c1fccf14b651e9cbbd; \>= e804861bd4e69cc5fe1053eedcb024982dde8e48, \< 1004fc90f0d79a4b7d9e3d432729914f472f9ad1; \>= e804861bd4e69cc5fe1053eedcb024982dde8e48, \< b7adbf9ada3513d2092362c8eac5cddc5b651f5c; 31198e58c09e21d4f65c49d2361f76b87aca4c3f; \>= 5.4.178, \< 5.4.230; \>= 5.10.99, \< 5.10.165; \>= 5.15.22, \< 5.15.90; \>= 5.16.8, \< 5.17
- Anyone running Linux 5.17

## Description

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

btrfs: fix race between quota rescan and disable leading to NULL pointer deref

If we have one task trying to start the quota rescan worker while another
one is trying to disable quotas, we can end up hitting a race that results
in the quota rescan worker doing a NULL pointer dereference. The steps for
this are the following:

1) Quotas are enabled;

2) Task A calls the quota rescan ioctl and enters btrfs\_qgroup\_rescan().
   It calls qgroup\_rescan\_init() which returns 0 (success) and then joins a
   transaction and commits it;

3) Task B calls the quota disable ioctl and enters btrfs\_quota\_disable().
   It clears the bit BTRFS\_FS\_QUOTA\_ENABLED from fs\_info-\>flags and calls
   btrfs\_qgroup\_wait\_for\_completion(), which returns immediately since the
   rescan worker is not yet running.
   Then it starts a transaction and locks fs\_info-\>qgroup\_ioctl\_lock;

4) Task A queues the rescan worker, by calling btrfs\_queue\_work();

5) The rescan worker starts, and calls rescan\_should\_stop() at the start
   of its while loop, which results in 0 iterations of the loop, since
   the flag BTRFS\_FS\_QUOTA\_ENABLED was cleared from fs\_info-\>flags by
   task B at step 3);

6) Task B sets fs\_info-\>quota\_root to NULL;

7) The rescan worker tries to start a transaction and uses
   fs\_info-\>quota\_root as the root argument for btrfs\_start\_transaction().
   This results in a NULL pointer dereference down the call chain of
   btrfs\_start\_transaction(). The stack trace is something like the one
   reported in Link tag below:

   general protection fault, probably for non-canonical address 0xdffffc0000000041: 0000 \[\#1\] PREEMPT SMP KASAN
   KASAN: null-ptr-deref in range \[0x0000000000000208-0x000000000000020f\]
   CPU: 1 PID: 34 Comm: kworker/u4:2 Not tainted 6.1.0-syzkaller-13872-gb6bb9676f216 \#0
   Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
   Workqueue: btrfs-qgroup-rescan btrfs\_work\_helper
   RIP: 0010:start\_transaction+0x48/0x10f0 fs/btrfs/transaction.c:564
   Code: 48 89 fb 48 (...)
   RSP: 0018:ffffc90000ab7ab0 EFLAGS: 00010206
   RAX: 0000000000000041 RBX: 0000000000000208 RCX: ffff88801779ba80
   RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
   RBP: dffffc0000000000 R08: 0000000000000001 R09: fffff52000156f5d
   R10: fffff52000156f5d R11: 1ffff92000156f5c R12: 0000000000000000
   R13: 0000000000000001 R14: 0000000000000001 R15: 0000000000000003
   FS:  0000000000000000(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
   CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
   CR2: 00007f2bea75b718 CR3: 000000001d0cc000 CR4: 00000000003506e0
   DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
   DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
   Call Trace:
    \<TASK\>
    btrfs\_qgroup\_rescan\_worker+0x3bb/0x6a0 fs/btrfs/qgroup.c:3402
    btrfs\_work\_helper+0x312/0x850 fs/btrfs/async-thread.c:280
    process\_one\_work+0x877/0xdb0 kernel/workqueue.c:2289
    worker\_thread+0xb14/0x1330 kernel/workqueue.c:2436
    kthread+0x266/0x300 kernel/kthread.c:376
    ret\_from\_fork+0x1f/0x30 arch/x86/entry/entry\_64.S:308
    \</TASK\>
   Modules linked in:

So fix this by having the rescan worker function not attempt to start a
transaction if it didn't do any rescan work.

## Affected and fixed versions

- Linux: \>= 26b3901d20bf9da2c6a00cb1fb48932166f80a45, \< 89ac597e3e807b91e2ebd6a7c36fec7b97290233; \>= 32747e01436aac8ef93fe85b5b523b4f3b52f040, \< 3bd43374857103ba3cac751d6d4afa8d83b5d92a; \>= 89d4cca583fc9594ee7d1a0bc986886d6fb587e6, \< 64287cd456a22373053998c1fccf14b651e9cbbd; \>= e804861bd4e69cc5fe1053eedcb024982dde8e48, \< 1004fc90f0d79a4b7d9e3d432729914f472f9ad1; \>= e804861bd4e69cc5fe1053eedcb024982dde8e48, \< b7adbf9ada3513d2092362c8eac5cddc5b651f5c; 31198e58c09e21d4f65c49d2361f76b87aca4c3f; \>= 5.4.178, \< 5.4.230; \>= 5.10.99, \< 5.10.165; \>= 5.15.22, \< 5.15.90; \>= 5.16.8, \< 5.17 (cvelist)
- Linux: 5.17 (cvelist)

## Mitigation

- Upgrade Linux to 5.17 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2023-52896. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2023-52896.md
Affected: Linux >= 26b3901d20bf9da2c6a00cb1fb48932166f80a45, < 89ac597e3e807b91e2ebd6a7c36fec7b97290233; >= 32747e01436aac8ef93fe85b5b523b4f3b52f040, < 3bd43374857103ba3cac751d6d4afa8d83b5d92a; >= 89d4cca583fc9594ee7d1a0bc986886d6fb587e6, < 64287cd456a22373053998c1fccf14b651e9cbbd; >= e804861bd4e69cc5fe1053e…
Fixed in: Linux 89ac597e3e807b91e2ebd6a7c36fec7b97290233, Linux 3bd43374857103ba3cac751d6d4afa8d83b5d92a, Linux 64287cd456a22373053998c1fccf14b651e9cbbd, Linux 1004fc90f0d79a4b7d9e3d432729914f472f9ad1, Linux 5.4.230, Linux 5.10.165, Linux 5.15.90, Linux 5.17

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2023-52896 being exploited?

There is no confirmed exploitation: CVE-2023-52896 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.29% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2023-52896?

Medium: CVSS 4.7 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed). The attack needs conditions outside the attacker's control, which makes it harder.

### Which versions are affected by CVE-2023-52896?

Linux \>= 26b3901d20bf9da2c6a00cb1fb48932166f80a45, \< 89ac597e3e807b91e2ebd6a7c36fec7b97290233; \>= 32747e01436aac8ef93fe85b5b523b4f3b52f040, \< 3bd43374857103ba3cac751d6d4afa8d83b5d92a; \>= 89d4cca583fc9594ee7d1a0bc986886d6fb587e6, \< 64287cd456a22373053998c1fccf14b651e9cbbd; \>= e804861bd4e69cc5fe1053eedcb024982dde8e48, \< 1004fc90f0d79a4b7d9e3d432729914f472f9ad1; \>= e804861bd4e69cc5fe1053eedcb024982dde8e48, \< b7adbf9ada3513d2092362c8eac5cddc5b651f5c; 31198e58c09e21d4f65c49d2361f76b87aca4c3f; \>= 5.4.178, \< 5.4.230; \>= 5.10.99, \< 5.10.165; \>= 5.15.22, \< 5.15.90; \>= 5.16.8, \< 5.17; Linux 5.17.

### Is there a fix for CVE-2023-52896?

Yes. Fixed in Linux 89ac597e3e807b91e2ebd6a7c36fec7b97290233, Linux 3bd43374857103ba3cac751d6d4afa8d83b5d92a, Linux 64287cd456a22373053998c1fccf14b651e9cbbd, Linux 1004fc90f0d79a4b7d9e3d432729914f472f9ad1, Linux 5.4.230, Linux 5.10.165, Linux 5.15.90, Linux 5.17. Upgrade Linux to 5.17 or later.

### How do I check if I'm affected by CVE-2023-52896?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/89ac597e3e807b91e2ebd6a7c36fec7b97290233>
- patch: <https://git.kernel.org/stable/c/3bd43374857103ba3cac751d6d4afa8d83b5d92a>
- patch: <https://git.kernel.org/stable/c/64287cd456a22373053998c1fccf14b651e9cbbd>
- patch: <https://git.kernel.org/stable/c/1004fc90f0d79a4b7d9e3d432729914f472f9ad1>
- patch: <https://git.kernel.org/stable/c/b7adbf9ada3513d2092362c8eac5cddc5b651f5c>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2023-52896>

HTML: <https://flawdb.com/CVE-2023-52896> · JSON: <https://flawdb.com/api/v1/entries/CVE-2023-52896>
