Loading
crypto: qat - uninitialized variable in adf_hb_error_inject_write()
mainline inclusion from mainline-v6.9-rc1 commit bcc06e1b3dadc76140203753a08979374c965ada category: feature bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I9A5BW CVE: N/A Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bcc06e1b3dadc76140203753a08979374c965ada ------------------------------------- There are a few issues in this code. If *ppos is non-zero then the first part of the buffer is not initialized. We never initialize the last character of the buffer. The return is not checked so it's possible that none of the buffer is initialized. This is debugfs code which is root only and the impact of these bugs is very small. However, it's still worth fixing. To fix this: 1) Check that *ppos is zero. 2) Use copy_from_user() instead of simple_write_to_buffer(). 3) Explicitly add a NUL terminator. Intel-SIG: commit bcc06e1b3dad crypto: qat - uninitialized variable in adf_hb_error_inject_write() Backport to support QAT in-tree driver Fixes: e2b67859ab6e ("crypto: qat - add heartbeat error simulator") Signed-off-by:Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by:
Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by:
Herbert Xu <herbert@gondor.apana.org.au> [ Aichun Shi: amend commit log ] Signed-off-by:
Aichun Shi <aichun.shi@intel.com>