----- "Neil Horman" [off-list ref] wrote:
+static int rng_recvmsg(struct kiocb *unused, struct socket *sock,
+ struct msghdr *msg, size_t len, int flags)
+{
+ struct sock *sk = sock->sk;
+ struct alg_sock *ask = alg_sk(sk);
+ struct rng_ctx *ctx = ask->private;
+ int rc, i;
+ u8 *data = kzalloc(len, GFP_KERNEL);
There probably should be an upper limit on the allocation - perhaps just always allocate a single page.
+static void rng_release(void *private)
+{
+ struct rng_ctx *ctx = private;
+ crypto_free_rng(ctx->ctx);
+ kfree(ctx->seed);
Is a seed secret enough that it should be zeroed before freeing? (Same in setkey, accept_parent).
Mirek