DEBIAN-CVE-2023-54158

Source
https://security-tracker.debian.org/tracker/CVE-2023-54158
Import Source
https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2023-54158.json
JSON Data
https://api.osv.dev/v1/vulns/DEBIAN-CVE-2023-54158
Upstream
Published
2025-12-24T13:16:17.850Z
Modified
2025-12-25T11:13:58.830746Z
Summary
[none]
Details

In the Linux kernel, the following vulnerability has been resolved: btrfs: don't free qgroup space unless specified Boris noticed in his simple quotas testing that he was getting a leak with Sweet Tea's change to subvol create that stopped doing a transaction commit. This was just a side effect of that change. In the delayed inode code we have an optimization that will free extra reservations if we think we can pack a dir item into an already modified leaf. Previously this wouldn't be triggered in the subvolume create case because we'd commit the transaction, it was still possible but much harder to trigger. It could actually be triggered if we did a mkdir && subvol create with qgroups enabled. This occurs because in btrfsinsertdelayeddirindex(), which gets called when we're adding the dir item, we do the following: btrfsblockrsvrelease(fsinfo, trans->blockrsv, bytes, NULL); if we're able to skip reserving space. The problem here is that trans->blockrsv points at the temporary block rsv for the subvolume create, which has qgroup reservations in the block rsv. This is a problem because btrfsblockrsvrelease() will do the following: if (blockrsv->qgrouprsvreserved >= blockrsv->qgrouprsvsize) { qgrouptorelease = blockrsv->qgrouprsvreserved - blockrsv->qgrouprsvsize; blockrsv->qgrouprsvreserved = blockrsv->qgrouprsvsize; } The temporary block rsv just has ->qgrouprsvreserved set, ->qgrouprsvsize == 0. The optimization in btrfsinsertdelayeddirindex() sets ->qgrouprsvreserved = 0. Then later on when we call btrfssubvolumereleasemetadata() which has btrfsblockrsvrelease(fsinfo, rsv, (u64)-1, &qgrouptorelease); btrfsqgroupconvertreservedmeta(root, qgrouptorelease); qgrouptorelease is set to 0, and we do not convert the reserved metadata space. The problem here is that the block rsv code has been unconditionally messing with ->qgrouprsvreserved, because the main place this is used is delalloc, and any time we call btrfsblockrsvrelease() we do it with qgrouptorelease set, and thus do the proper accounting. The subvolume code is the only other code that uses the qgroup reservation stuff, but it's intermingled with the above optimization, and thus was getting its reservation freed out from underneath it and thus leaking the reserved space. The solution is to simply not mess with the qgroup reservations if we don't have qgrouptorelease set. This works with the existing code as anything that messes with the delalloc reservations always have qgroupto_release set. This fixes the leak that Boris was observing.

References

Affected packages

Debian:11 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
5.10.191-1

Affected versions

5.*

5.10.46-4
5.10.46-5
5.10.70-1~bpo10+1
5.10.70-1
5.10.84-1
5.10.92-1~bpo10+1
5.10.92-1
5.10.92-2
5.10.103-1~bpo10+1
5.10.103-1
5.10.106-1
5.10.113-1
5.10.120-1~bpo10+1
5.10.120-1
5.10.127-1
5.10.127-2~bpo10+1
5.10.127-2
5.10.136-1
5.10.140-1
5.10.148-1
5.10.149-1
5.10.149-2
5.10.158-1
5.10.158-2
5.10.162-1
5.10.178-1
5.10.178-2
5.10.178-3
5.10.179-1
5.10.179-2
5.10.179-3
5.10.179-4
5.10.179-5

Ecosystem specific

{
    "urgency": "not yet assigned"
}

Database specific

source

"https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2023-54158.json"

Debian:12 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
6.1.37-1

Affected versions

6.*

6.1.27-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}

Database specific

source

"https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2023-54158.json"

Debian:13 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
6.3.7-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}

Database specific

source

"https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2023-54158.json"

Debian:14 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
6.3.7-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}

Database specific

source

"https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2023-54158.json"