CVE-2022-49394

Source
https://cve.org/CVERecord?id=CVE-2022-49394
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-49394.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2022-49394
Downstream
Related
Published
2025-02-26T02:11:25.197Z
Modified
2026-05-18T05:56:58.463083329Z
Summary
blk-iolatency: Fix inflight count imbalances and IO hangs on offline
Details

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

blk-iolatency: Fix inflight count imbalances and IO hangs on offline

iolatency needs to track the number of inflight IOs per cgroup. As this tracking can be expensive, it is disabled when no cgroup has iolatency configured for the device. To ensure that the inflight counters stay balanced, iolatencysetlimit() freezes the request_queue while manipulating the enabled counter, which ensures that no IO is in flight and thus all counters are zero.

Unfortunately, iolatencysetlimit() isn't the only place where the enabled counter is manipulated. iolatencypdoffline() can also dec the counter and trigger disabling. As this disabling happens without freezing the q, this can easily happen while some IOs are in flight and thus leak the counts.

This can be easily demonstrated by turning on iolatency on an one empty cgroup while IOs are in flight in other cgroups and then removing the cgroup. Note that iolatency shouldn't have been enabled elsewhere in the system to ensure that removing the cgroup disables iolatency for the whole device.

The following keeps flipping on and off iolatency on sda:

echo +io > /sys/fs/cgroup/cgroup.subtree_control while true; do mkdir -p /sys/fs/cgroup/test echo '8:0 target=100000' > /sys/fs/cgroup/test/io.latency sleep 1 rmdir /sys/fs/cgroup/test sleep 1 done

and there's concurrent fio generating direct rand reads:

fio --name test --filename=/dev/sda --direct=1 --rw=randread \ --runtime=600 --time_based --iodepth=256 --numjobs=4 --bs=4k

while monitoring with the following drgn script:

while True: for css in cssforeachdescendantpre(prog['blkcgroot'].css.addressof_()): for pos in hlistforeach(containerof(css, 'struct blkcg', 'css').blkglist): blkg = containerof(pos, 'struct blkcggq', 'blkcgnode') pd = blkg.pd[prog['blkcgpolicyiolatency'].plid] if pd.value() == 0: continue iolat = containerof(pd, 'struct iolatencygrp', 'pd') inflight = iolat.rqwait.inflight.counter.value() if inflight: print(f'inflight={inflight} {diskname(blkg.q.disk).decode("utf-8")} ' f'{cgrouppath(css.cgroup).decode("utf-8")}') time.sleep(1)

The monitoring output looks like the following:

inflight=1 sda /user.slice inflight=1 sda /user.slice ... inflight=14 sda /user.slice inflight=13 sda /user.slice inflight=17 sda /user.slice inflight=15 sda /user.slice inflight=18 sda /user.slice inflight=17 sda /user.slice inflight=20 sda /user.slice inflight=19 sda /user.slice <- fio stopped, inflight stuck at 19 inflight=19 sda /user.slice inflight=19 sda /user.slice

If a cgroup with stuck inflight ends up getting throttled, the throttled IOs will never get issued as there's no completion event to wake it up leading to an indefinite hang.

This patch fixes the bug by unifying enable handling into a work item which is automatically kicked off from iolatencysetminlatnsec() which is called from both iolatencysetlimit() and iolatencypdoffline() paths. Punting to a work item is necessary as iolatencypdoffline() is called under spinlocks while freezing a request_queue requires a sleepable context.

This also simplifies the code reducing LOC sans the comments and avoids the unnecessary freezes which were happening whenever a cgroup's latency target is newly set or cleared.

Database specific
{
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/49xxx/CVE-2022-49394.json",
    "cna_assigner": "Linux"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
6d482bc5697763eb1214f207286daa201b32d20a
Fixed
515d077ee3085ae343b6bea7fd031f9906645f38
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
8c772a9bfc7c07c76f4a58b58910452fbb20843b
Fixed
d19fa8f252000d141f9199ca32959c50314e1f05
Fixed
77692c02e1517c54f2fd0535f41aa4286ac9f140
Fixed
a30acbb5dfb7bcc813ad6a18ca31011ac44e5547
Fixed
968f7a239c590454ffba79c126fbe0e963a0ba78
Fixed
5b0ff3ebbef791341695b718f8d2870869cf1d01
Fixed
8a177a36da6c54c98b8685d4f914cb3637d53c0d
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
0 Unknown introduced commit / All previous commits are affected
Last affected
beed6109acd4efc2f1717c31bddcd0ad7ebbf253

Affected versions

v2.*
v2.6.12-rc2
v2.6.12-rc3
v2.6.12-rc4
v2.6.13
v2.6.13-rc1
v2.6.13-rc2
v2.6.13-rc3
v2.6.13-rc4
v2.6.13-rc5
v2.6.13-rc6
v2.6.13-rc7
v2.6.14-rc1
v2.6.14-rc2
v2.6.14-rc3
v2.6.15-rc1
v2.6.15-rc2
v2.6.15-rc4
v2.6.15-rc5
v2.6.15-rc7
v2.6.16
v2.6.16-rc1
v2.6.16-rc2
v2.6.16-rc3
v2.6.16-rc4
v2.6.16-rc5
v2.6.16-rc6
v2.6.17
v2.6.17-rc1
v2.6.17-rc2
v2.6.17-rc3
v2.6.17-rc4
v2.6.17-rc5
v2.6.17-rc6
v2.6.18
v2.6.18-rc1
v2.6.18-rc2
v2.6.18-rc3
v2.6.18-rc5
v2.6.18-rc6
v2.6.19-rc1
v2.6.19-rc2
v2.6.20-rc1
v2.6.20-rc2
v2.6.20-rc3
v2.6.20-rc4
v2.6.20-rc5
v2.6.20-rc6
v2.6.20-rc7
v2.6.21
v2.6.21-rc1
v2.6.21-rc2
v2.6.21-rc3
v2.6.21-rc4
v2.6.21-rc5
v2.6.21-rc6
v2.6.21-rc7
v2.6.22
v2.6.22-rc1
v2.6.22-rc2
v2.6.22-rc3
v2.6.22-rc4
v2.6.22-rc5
v2.6.22-rc6
v2.6.22-rc7
v2.6.23
v2.6.23-rc1
v2.6.23-rc2
v2.6.23-rc3
v2.6.23-rc4
v2.6.23-rc5
v2.6.23-rc6
v2.6.23-rc7
v2.6.23-rc8
v2.6.23-rc9
v2.6.24
v2.6.24-rc1
v2.6.24-rc2
v2.6.24-rc3
v2.6.24-rc4
v2.6.24-rc5
v2.6.24-rc6
v2.6.24-rc7
v2.6.24-rc8
v2.6.25
v2.6.25-rc1
v2.6.25-rc2
v2.6.25-rc3
v2.6.25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-rc2
v4.11-rc3
v4.11-rc4
v4.11-rc5
v4.11-rc6
v4.11-rc7
v4.11-rc8
v4.12
v4.12-rc1
v4.12-rc2
v4.12-rc3
v4.12-rc4
v4.12-rc5
v4.12-rc6
v4.12-rc7
v4.13
v4.13-rc1
v4.13-rc2
v4.13-rc3
v4.13-rc4
v4.13-rc5
v4.13-rc6
v4.13-rc7
v4.14
v4.14-rc1
v4.14-rc2
v4.14-rc3
v4.14-rc4
v4.14-rc5
v4.14-rc6
v4.14-rc7
v4.14-rc8
v4.15
v4.15-rc1
v4.15-rc2
v4.15-rc3
v4.15-rc4
v4.15-rc5
v4.15-rc6
v4.15-rc7
v4.15-rc8
v4.15-rc9
v4.16
v4.16-rc1
v4.16-rc2
v4.16-rc3
v4.16-rc4
v4.16-rc5
v4.16-rc6
v4.16-rc7
v4.17
v4.17-rc1
v4.17-rc2
v4.17-rc3
v4.17-rc4
v4.17-rc5
v4.17-rc6
v4.17-rc7
v4.18
v4.18-rc1
v4.18-rc2
v4.18-rc3
v4.18-rc4
v4.18-rc5
v4.18-rc6
v4.18-rc7
v4.18-rc8
v4.19
v4.19-rc1
v4.19-rc2
v4.19-rc3
v4.19-rc4
v4.19-rc5
v4.19-rc6
v4.19-rc7
v4.19-rc8
v4.19.100
v4.19.101
v4.19.102
v4.19.103
v4.19.104
v4.19.105
v4.19.106
v4.19.107
v4.19.108
v4.19.109
v4.19.110
v4.19.111
v4.19.112
v4.19.113
v4.19.114
v4.19.115
v4.19.116
v4.19.117
v4.19.118
v4.19.119
v4.19.120
v4.19.121
v4.19.122
v4.19.123
v4.19.124
v4.19.125
v4.19.126
v4.19.127
v4.19.128
v4.19.129
v4.19.130
v4.19.131
v4.19.132
v4.19.133
v4.19.134
v4.19.135
v4.19.136
v4.19.137
v4.19.138
v4.19.139
v4.19.140
v4.19.141
v4.19.142
v4.19.143
v4.19.144
v4.19.145
v4.19.146
v4.19.147
v4.19.148
v4.19.149
v4.19.150
v4.19.151
v4.19.152
v4.19.153
v4.19.154
v4.19.155
v4.19.156
v4.19.157
v4.19.158
v4.19.159
v4.19.160
v4.19.161
v4.19.162
v4.19.163
v4.19.164
v4.19.165
v4.19.166
v4.19.167
v4.19.168
v4.19.169
v4.19.170
v4.19.171
v4.19.172
v4.19.173
v4.19.174
v4.19.175
v4.19.176
v4.19.177
v4.19.178
v4.19.179
v4.19.180
v4.19.181
v4.19.182
v4.19.183
v4.19.184
v4.19.185
v4.19.186
v4.19.187
v4.19.188
v4.19.189
v4.19.190
v4.19.191
v4.19.192
v4.19.193
v4.19.194
v4.19.195
v4.19.196
v4.19.197
v4.19.198
v4.19.199
v4.19.200
v4.19.201
v4.19.202
v4.19.203
v4.19.204
v4.19.205
v4.19.206
v4.19.207
v4.19.208
v4.19.209
v4.19.210
v4.19.211
v4.19.212
v4.19.213
v4.19.214
v4.19.215
v4.19.216
v4.19.217
v4.19.218
v4.19.219
v4.19.220
v4.19.221
v4.19.222
v4.19.223
v4.19.224
v4.19.225
v4.19.226
v4.19.227
v4.19.228
v4.19.229
v4.19.230
v4.19.231
v4.19.232
v4.19.233
v4.19.234
v4.19.235
v4.19.236
v4.19.237
v4.19.238
v4.19.239
v4.19.240
v4.19.241
v4.19.242
v4.19.243
v4.19.244
v4.19.245
v4.19.246
v4.19.29
v4.19.30
v4.19.31
v4.19.32
v4.19.33
v4.19.34
v4.19.35
v4.19.36
v4.19.37
v4.19.38
v4.19.39
v4.19.40
v4.19.41
v4.19.42
v4.19.43
v4.19.44
v4.19.45
v4.19.46
v4.19.47
v4.19.48
v4.19.49
v4.19.50
v4.19.51
v4.19.52
v4.19.53
v4.19.54
v4.19.55
v4.19.56
v4.19.57
v4.19.58
v4.19.59
v4.19.60
v4.19.61
v4.19.62
v4.19.63
v4.19.64
v4.19.65
v4.19.66
v4.19.67
v4.19.68
v4.19.69
v4.19.70
v4.19.71
v4.19.72
v4.19.73
v4.19.74
v4.19.75
v4.19.76
v4.19.77
v4.19.78
v4.19.79
v4.19.80
v4.19.81
v4.19.82
v4.19.83
v4.19.84
v4.19.85
v4.19.86
v4.19.87
v4.19.88
v4.19.89
v4.19.90
v4.19.91
v4.19.92
v4.19.93
v4.19.94
v4.19.95
v4.19.96
v4.19.97
v4.19.98
v4.19.99
v4.2
v4.2-rc1
v4.2-rc2
v4.2-rc3
v4.2-rc4
v4.2-rc5
v4.2-rc6
v4.2-rc7
v4.2-rc8
v4.20
v4.20-rc1
v4.20-rc2
v4.20-rc3
v4.20-rc4
v4.20-rc5
v4.20-rc6
v4.20-rc7
v4.20.1
v4.20.10
v4.20.11
v4.20.12
v4.20.13
v4.20.14
v4.20.15
v4.20.2
v4.20.3
v4.20.4
v4.20.5
v4.20.6
v4.20.7
v4.20.8
v4.20.9
v4.3
v4.3-rc1
v4.3-rc2
v4.3-rc3
v4.3-rc4
v4.3-rc5
v4.3-rc6
v4.3-rc7
v4.4
v4.4-rc1
v4.4-rc2
v4.4-rc3
v4.4-rc4
v4.4-rc5
v4.4-rc6
v4.4-rc7
v4.4-rc8
v4.5
v4.5-rc1
v4.5-rc2
v4.5-rc3
v4.5-rc4
v4.5-rc5
v4.5-rc6
v4.5-rc7
v4.6
v4.6-rc1
v4.6-rc2
v4.6-rc3
v4.6-rc4
v4.6-rc5
v4.6-rc6
v4.6-rc7
v4.7
v4.7-rc1
v4.7-rc2
v4.7-rc3
v4.7-rc4
v4.7-rc5
v4.7-rc6
v4.7-rc7
v4.8
v4.8-rc1
v4.8-rc2
v4.8-rc3
v4.8-rc4
v4.8-rc5
v4.8-rc6
v4.8-rc7
v4.8-rc8
v4.9
v4.9-rc1
v4.9-rc2
v4.9-rc3
v4.9-rc4
v4.9-rc5
v4.9-rc6
v4.9-rc7
v4.9-rc8

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-49394.json"

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
4.19.247
Type
ECOSYSTEM
Events
Introduced
4.20.0
Fixed
5.4.198
Type
ECOSYSTEM
Events
Introduced
5.0.0
Fixed
5.10.121
Type
ECOSYSTEM
Events
Introduced
5.5.0
Fixed
5.15.46
Type
ECOSYSTEM
Events
Introduced
5.11.0
Fixed
5.17.14
Type
ECOSYSTEM
Events
Introduced
5.16.0
Fixed
5.18.3

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-49394.json"