Commit 6e5cf31
committed
x86/mce/amd: Publish the bank pointer only after setup has succeeded
threshold_create_bank() creates a bank descriptor per MCA error
thresholding counter which can be controlled over sysfs. It publishes
the pointer to that bank in a per-CPU variable and then goes on to
create additional thresholding blocks if the bank has such.
However, that creation of additional blocks in
allocate_threshold_blocks() can fail, leading to a use-after-free
through the per-CPU pointer.
Therefore, publish that pointer only after all blocks have been setup
successfully.
Fixes: 019f34f ("x86, MCE, AMD: Move shared bank to node descriptor")
Reported-by: Saar Amar <Saar.Amar@microsoft.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: <stable@vger.kernel.org>
Link: http://lkml.kernel.org/r/20200128140846.phctkvx5btiexvbx@kili.mountain1 parent bb6d3fb commit 6e5cf31
1 file changed
Lines changed: 16 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1198 | 1198 | | |
1199 | 1199 | | |
1200 | 1200 | | |
1201 | | - | |
1202 | | - | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
1203 | 1204 | | |
1204 | 1205 | | |
1205 | 1206 | | |
| |||
1243 | 1244 | | |
1244 | 1245 | | |
1245 | 1246 | | |
1246 | | - | |
1247 | | - | |
1248 | | - | |
1249 | | - | |
1250 | | - | |
1251 | | - | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
1252 | 1251 | | |
1253 | | - | |
1254 | | - | |
1255 | | - | |
| 1252 | + | |
1256 | 1253 | | |
1257 | 1254 | | |
1258 | 1255 | | |
1259 | 1256 | | |
1260 | 1257 | | |
1261 | 1258 | | |
1262 | 1259 | | |
1263 | | - | |
| 1260 | + | |
1264 | 1261 | | |
1265 | 1262 | | |
1266 | 1263 | | |
| |||
1345 | 1342 | | |
1346 | 1343 | | |
1347 | 1344 | | |
1348 | | - | |
1349 | | - | |
1350 | 1345 | | |
1351 | 1346 | | |
1352 | 1347 | | |
| |||
1357 | 1352 | | |
1358 | 1353 | | |
1359 | 1354 | | |
1360 | | - | |
1361 | | - | |
1362 | | - | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
1363 | 1362 | | |
1364 | 1363 | | |
1365 | 1364 | | |
| |||
0 commit comments