# CVE-2023-54271: blk-cgroup: Fix NULL deref caused by blkg\_policy\_data being installed before init

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

- **Severity:** UNSCORED
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Unknown
- **EPSS:** 0.27% (percentile 11, 2026-11-26)
- **Published:** 2025-12-30T12:16:01.672Z
- **Modified:** 2026-10-15T01:17:17.017Z

## Who should check

- Anyone running Linux \>= 9d179b865449b351ad5cb76dbea480c9170d4a27, \< da6cc648c1f570290af1ddbe6b7ca3d91b1d6db9; \>= 9d179b865449b351ad5cb76dbea480c9170d4a27, \< 33f0370bb7ce15a59d72a4d8a05421d334a04add; \>= 9d179b865449b351ad5cb76dbea480c9170d4a27, \< e39ef7880d1057b2ebcdb013405f4d84a257db23; \>= 9d179b865449b351ad5cb76dbea480c9170d4a27, \< 7d63c6f9765339dcfc34b7365ced7c518012e4fe; \>= 9d179b865449b351ad5cb76dbea480c9170d4a27, \< ec14a87ee1999b19d8b7ed0fa95fea80644624ae
- Anyone running Linux 5.4

## Description

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

blk-cgroup: Fix NULL deref caused by blkg\_policy\_data being installed before init

blk-iocost sometimes causes the following crash:

  BUG: kernel NULL pointer dereference, address: 00000000000000e0
  ...
  RIP: 0010:\_raw\_spin\_lock+0x17/0x30
  Code: be 01 02 00 00 e8 79 38 39 ff 31 d2 89 d0 5d c3 0f 1f 00 0f 1f 44 00 00 55 48 89 e5 65 ff 05 48 d0 34 7e b9 01 00 00 00 31 c0 \<f0\> 0f b1 0f 75 02 5d c3 89 c6 e8 ea 04 00 00 5d c3 0f 1f 84 00 00
  RSP: 0018:ffffc900023b3d40 EFLAGS: 00010046
  RAX: 0000000000000000 RBX: 00000000000000e0 RCX: 0000000000000001
  RDX: ffffc900023b3d20 RSI: ffffc900023b3cf0 RDI: 00000000000000e0
  RBP: ffffc900023b3d40 R08: ffffc900023b3c10 R09: 0000000000000003
  R10: 0000000000000064 R11: 000000000000000a R12: ffff888102337000
  R13: fffffffffffffff2 R14: ffff88810af408c8 R15: ffff8881070c3600
  FS:  00007faaaf364fc0(0000) GS:ffff88842fdc0000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 00000000000000e0 CR3: 00000001097b1000 CR4: 0000000000350ea0
  Call Trace:
   \<TASK\>
   ioc\_weight\_write+0x13d/0x410
   cgroup\_file\_write+0x7a/0x130
   kernfs\_fop\_write\_iter+0xf5/0x170
   vfs\_write+0x298/0x370
   ksys\_write+0x5f/0xb0
   \_\_x64\_sys\_write+0x1b/0x20
   do\_syscall\_64+0x3d/0x80
   entry\_SYSCALL\_64\_after\_hwframe+0x46/0xb0

This happens because iocg-\>ioc is NULL. The field is initialized by
ioc\_pd\_init() and never cleared. The NULL deref is caused by
blkcg\_activate\_policy() installing blkg\_policy\_data before initializing it.

blkcg\_activate\_policy() was doing the following:

1. Allocate pd's for all existing blkg's and install them in blkg-\>pd\[\].
2. Initialize all pd's.
3. Online all pd's.

blkcg\_activate\_policy() only grabs the queue\_lock and may release and
re-acquire the lock as allocation may need to sleep. ioc\_weight\_write()
grabs blkcg-\>lock and iterates all its blkg's. The two can race and if
ioc\_weight\_write() runs during \#1 or between \#1 and \#2, it can encounter a
pd which is not initialized yet, leading to crash.

The crash can be reproduced with the following script:

  \#!/bin/bash

  echo +io \> /sys/fs/cgroup/cgroup.subtree\_control
  systemd-run --unit touch-sda --scope dd if=/dev/sda of=/dev/null bs=1M count=1 iflag=direct
  echo 100 \> /sys/fs/cgroup/system.slice/io.weight
  bash -c "echo '8:0 enable=1' \> /sys/fs/cgroup/io.cost.qos" &
  sleep .2
  echo 100 \> /sys/fs/cgroup/system.slice/io.weight

with the following patch applied:

\> diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
\> index fc49be622e05..38d671d5e10c 100644
\> --- a/block/blk-cgroup.c
\> +++ b/block/blk-cgroup.c
\> @@ -1553,6 +1553,12 @@ int blkcg\_activate\_policy(struct gendisk \*disk, const struct blkcg\_policy \*pol)
\> 		pd-\>online = false;
\> 	}
\>
\> +       if (system\_state == SYSTEM\_RUNNING) {
\> +               spin\_unlock\_irq(&q-\>queue\_lock);
\> +               ssleep(1);
\> +               spin\_lock\_irq(&q-\>queue\_lock);
\> +       }
\> +
\> 	/\* all allocated, init in the same order \*/
\> 	if (pol-\>pd\_init\_fn)
\> 		list\_for\_each\_entry\_reverse(blkg, &q-\>blkg\_list, q\_node)

I don't see a reason why all pd's should be allocated, initialized and
onlined together. The only ordering requirement is that parent blkgs to be
initialized and onlined before children, which is guaranteed from the
walking order. Let's fix the bug by allocating, initializing and onlining pd
for each blkg and holding blkcg-\>lock over initialization and onlining. This
ensures that an installed blkg is always fully initialized and onlined
removing the the race window.

## Affected and fixed versions

- Linux: \>= 9d179b865449b351ad5cb76dbea480c9170d4a27, \< da6cc648c1f570290af1ddbe6b7ca3d91b1d6db9; \>= 9d179b865449b351ad5cb76dbea480c9170d4a27, \< 33f0370bb7ce15a59d72a4d8a05421d334a04add; \>= 9d179b865449b351ad5cb76dbea480c9170d4a27, \< e39ef7880d1057b2ebcdb013405f4d84a257db23; \>= 9d179b865449b351ad5cb76dbea480c9170d4a27, \< 7d63c6f9765339dcfc34b7365ced7c518012e4fe; \>= 9d179b865449b351ad5cb76dbea480c9170d4a27, \< ec14a87ee1999b19d8b7ed0fa95fea80644624ae (cvelist)
- Linux: 5.4 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2023-54271.md
Affected: Linux >= 9d179b865449b351ad5cb76dbea480c9170d4a27, < da6cc648c1f570290af1ddbe6b7ca3d91b1d6db9; >= 9d179b865449b351ad5cb76dbea480c9170d4a27, < 33f0370bb7ce15a59d72a4d8a05421d334a04add; >= 9d179b865449b351ad5cb76dbea480c9170d4a27, < e39ef7880d1057b2ebcdb013405f4d84a257db23; >= 9d179b865449b351ad5cb76…
Fixed in: Linux 33f0370bb7ce15a59d72a4d8a05421d334a04add, Linux 7d63c6f9765339dcfc34b7365ced7c518012e4fe

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-54271 being exploited?

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

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

It has no CVSS score yet. Unknown.

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

Linux \>= 9d179b865449b351ad5cb76dbea480c9170d4a27, \< da6cc648c1f570290af1ddbe6b7ca3d91b1d6db9; \>= 9d179b865449b351ad5cb76dbea480c9170d4a27, \< 33f0370bb7ce15a59d72a4d8a05421d334a04add; \>= 9d179b865449b351ad5cb76dbea480c9170d4a27, \< e39ef7880d1057b2ebcdb013405f4d84a257db23; \>= 9d179b865449b351ad5cb76dbea480c9170d4a27, \< 7d63c6f9765339dcfc34b7365ced7c518012e4fe; \>= 9d179b865449b351ad5cb76dbea480c9170d4a27, \< ec14a87ee1999b19d8b7ed0fa95fea80644624ae; Linux 5.4.

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

Yes. Fixed in Linux 33f0370bb7ce15a59d72a4d8a05421d334a04add, Linux 7d63c6f9765339dcfc34b7365ced7c518012e4fe. No fix listed yet: follow the vendor advisory.

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

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

- other: <https://git.kernel.org/stable/c/da6cc648c1f570290af1ddbe6b7ca3d91b1d6db9>
- other: <https://git.kernel.org/stable/c/33f0370bb7ce15a59d72a4d8a05421d334a04add>
- other: <https://git.kernel.org/stable/c/e39ef7880d1057b2ebcdb013405f4d84a257db23>
- other: <https://git.kernel.org/stable/c/7d63c6f9765339dcfc34b7365ced7c518012e4fe>
- other: <https://git.kernel.org/stable/c/ec14a87ee1999b19d8b7ed0fa95fea80644624ae>
- other: <https://cert-portal.siemens.com/productcert/html/ssa-784472.html>

## 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-54271>

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