Skip to content

linuxkm/lkcapi_aes_glue.c: fix scatterwalk_map error handling in AesG…#9996

Open
sameehj wants to merge 1 commit intowolfSSL:masterfrom
sameehj:linuxkm-fix
Open

linuxkm/lkcapi_aes_glue.c: fix scatterwalk_map error handling in AesG…#9996
sameehj wants to merge 1 commit intowolfSSL:masterfrom
sameehj:linuxkm-fix

Conversation

@sameehj
Copy link
Contributor

@sameehj sameehj commented Mar 17, 2026

…cmCrypt_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

Description

Please describe the scope of the fix or feature addition.

Fixes zd#

Testing

How did you test?

Checklist

  • [NA] added tests
  • [NA] updated/added doxygen
  • [NA] updated appropriate READMEs
  • [NA] Updated manual and documentation

…cmCrypt_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>
@sameehj
Copy link
Contributor Author

sameehj commented Mar 18, 2026

retest this please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants