Commit e96dc36
committed
linuxkm/lkcapi_aes_glue.c: fix scatterwalk_map error handling in AesGcmCrypt_1
When scatterwalk_map fails in either the stream or non-stream path, the
code jumped to cleanup without setting err, causing the function to
return 0 (success) despite the failure. This could cause the kernel
crypto layer to treat uninitialized data as valid ciphertext/plaintext.
- Capture the error code (PTR_ERR) into err before goto out
- Fix PTR_ERR arguments that incorrectly used assoc instead of
in_map/out_map (assoc was NULL or pointed to the wrong mapping)
- Make in_map/out_map NULL assignments unconditional (previously
gated behind < 6.15, but the cleanup at out: checks these
pointers on all kernel versions)
- Remove bogus scatterwalk_unmap of a failed walk in the stream
path on >= 6.15
Signed-off-by: Sameeh Jubran <sameeh@wolfssl.com>1 parent a6195c3 commit e96dc36
1 file changed
+6
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1148 | 1148 | | |
1149 | 1149 | | |
1150 | 1150 | | |
| 1151 | + | |
1151 | 1152 | | |
1152 | 1153 | | |
1153 | 1154 | | |
1154 | | - | |
1155 | | - | |
1156 | | - | |
| 1155 | + | |
1157 | 1156 | | |
1158 | 1157 | | |
1159 | 1158 | | |
| |||
1355 | 1354 | | |
1356 | 1355 | | |
1357 | 1356 | | |
| 1357 | + | |
1358 | 1358 | | |
1359 | 1359 | | |
1360 | | - | |
1361 | | - | |
| 1360 | + | |
1362 | 1361 | | |
1363 | | - | |
1364 | 1362 | | |
1365 | 1363 | | |
1366 | 1364 | | |
| |||
1374 | 1372 | | |
1375 | 1373 | | |
1376 | 1374 | | |
| 1375 | + | |
1377 | 1376 | | |
1378 | 1377 | | |
1379 | | - | |
1380 | | - | |
| 1378 | + | |
1381 | 1379 | | |
1382 | | - | |
1383 | 1380 | | |
1384 | 1381 | | |
1385 | 1382 | | |
| |||
0 commit comments