HomeFreeBSD

Linux: Fix uninitialized variable usage in zio_do_crypt_data()

Description

Linux: Fix uninitialized variable usage in zio_do_crypt_data()

Coverity complained about this. An error from hkdf_sha512() before uio
initialization will cause pointers to uninitialized memory to be passed
to zio_crypt_destroy_uio(). This is a regression that was introduced
by cf63739191b6cac629d053930a4aea592bca3819. Interestingly, this never
affected FreeBSD, since the FreeBSD version never had that patch ported.
Since moving uio initialization to the top of this function would slow
down the qat_crypt() path, we only move the memset() calls to the top
of the function. This is sufficient to fix this problem.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Neal Gompa <ngompa@datto.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #13944

Details

Provenance
Richard Yao <richard.yao@alumni.stonybrook.edu>Authored on Sep 26 2022, 11:44 PM
GitHub <noreply@github.com>Committed on Sep 26 2022, 11:44 PM
Parents
rGbf5b42f9c8fb: Fix double declaration of getauxval() for FreeBSD PPC
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rG52afc3443d16: Linux: Fix uninitialized variable usage in zio_do_crypt_data() (authored by Richard Yao <richard.yao@alumni.stonybrook.edu>).Sep 26 2022, 11:44 PM