Re: [PATCH] Add RNG support to AF_ALG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



----- "Neil Horman" <nhorman@xxxxxxxxxxxxx> wrote:

> On Mon, Dec 13, 2010 at 12:24:34PM -0500, Miloslav Trmac wrote:
> > ----- "Neil Horman" <nhorman@xxxxxxxxxxxxx> 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.
> > 
> I'd rather allocate the explicit amount needed, just to avoid added memory
> pressure allocating memory that we won't use, but yes, I can definately add an
> upper limit to how much data can be requested in a single call.
Please allow arbitrarily large requests.  rng_recvmsg can easily use a smaller buffer by filling the user-space destination one buffer-size at a time, on the other hand handling an arbitrary upper limit in user-space would be unnecessarily complex.
    Mirek
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux