]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
libceph: don't WARN() if user tries to add invalid key
authorEric Biggers <ebiggers@google.com>
Tue, 7 Nov 2017 05:57:26 +0000 (21:57 -0800)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 13 Nov 2017 11:12:44 +0000 (12:12 +0100)
commitb11270853fa3654f08d4a6a03b23ddb220512d8d
treed9f851b984bda537edced56d652af69a5a79b04c
parent7c084289795bc0f3b9ab315ac3c8d269dd4d0215
libceph: don't WARN() if user tries to add invalid key

The WARN_ON(!key->len) in set_secret() in net/ceph/crypto.c is hit if a
user tries to add a key of type "ceph" with an invalid payload as
follows (assuming CONFIG_CEPH_LIB=y):

    echo -e -n '\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' \
| keyctl padd ceph desc @s

This can be hit by fuzzers.  As this is merely bad input and not a
kernel bug, replace the WARN_ON() with return -EINVAL.

Fixes: 7af3ea189a9a ("libceph: stop allocating a new cipher on every crypto request")
Cc: <stable@vger.kernel.org> # v4.10+
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
net/ceph/crypto.c