crypto: af_alg - whitelist mask and type
authorStephan Mueller <smueller@chronox.de>
Tue, 2 Jan 2018 07:55:25 +0000 (08:55 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 31 May 2018 23:30:06 +0000 (00:30 +0100)
commitefe80592cd0d721b786e6b6c2b3de25bdd5f6bdf
tree30b113eb96815656ac34e036f6e310008f0cbca2
parent9bbce9986d0e62506891392d6c62171f5515a96d
crypto: af_alg - whitelist mask and type

commit bb30b8848c85e18ca7e371d0a869e94b3e383bdf upstream.

The user space interface allows specifying the type and mask field used
to allocate the cipher. Only a subset of the possible flags are intended
for user space. Therefore, white-list the allowed flags.

In case the user space caller uses at least one non-allowed flag, EINVAL
is returned.

Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[bwh: Backported to 3.2: The CRYPTO_ALG_KERN_DRIVER_ONLY flag is not supported,
 so set allowed to 0]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
crypto/af_alg.c