]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
common/secret.c: don't pass uninitialized stack data to the kernel 30675/head
authorIlya Dryomov <idryomov@gmail.com>
Mon, 30 Sep 2019 15:50:55 +0000 (17:50 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 1 Oct 2019 19:03:23 +0000 (21:03 +0200)
commit1ff296c1ae7c7f5a6883777c562d54f5cd83161a
tree671692b54e6e31ab81f928525715aeb9687712d8
parent712393daf303fd257ee0a3733a0f1d57ee131572
common/secret.c: don't pass uninitialized stack data to the kernel

ceph_unarmor() returns the number of bytes decoded, which can be (and
usually is) smaller than the size of the payload array.

set_kernel_secret() has behaved this way ever since it was introduced
in commit bee85518e288 ("mount.ceph: Use kernel key management API when
possible.").  The reason it didn't cause problems in the kernel is that
the encoding includes the actual length of the secret and there is no
check for the end of the supplied payload (see ceph_key_preparse() in
net/ceph/crypto.c).

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
src/common/secret.c