Thread (7 messages) 7 messages, 4 authors, 2016-01-21

Re: [PATCH] crypto: af_alg - add async support to algif_aead

From: Tadeusz Struk <hidden>
Date: 2016-01-19 15:22:27
Also in: lkml

On 01/18/2016 04:34 PM, Herbert Xu wrote:
quoted
My understanding is that the sock_kmalloc is mainly used for allocations
quoted
of the user provided  data, because it keeps tracks of how much memory
is allocated by a socket, and makes sure that is will not exceed the
sysctl_optmem_max limit. Usually the internal structures, with fixed
size are allocated simply with kmalloc. I don't think that using
sock_kmalloc will give us any benefit here.
If there is only ever one of them per-socket then kmalloc is fine,
otherwise you should use sock_kmalloc.
There is one per request. There can be a few of them at a given time.
We have the same thing in skcipher and we use kmalloc there. 
quoted
I agree that they are very similar, but I found it much easier to debug
quoted
when they are separate functions. I would prefer to keep them separate.
They are also separate in algif_skcipher. It makes it also easier to
read and understand.
I too would prefer a common function.  However we can do this
later if we wish.
 
lets do this later then.
quoted
quoted
The inflight ctr is incremented only if an asynchronous request has been
successfully en-queued for processing. If a user forges to call recvmsg
then the function that increments it won't be even called.
quoted
From the other hand we don't want to give the option to interrupt the
wait, because in a case, when we do have request being processed by some
hardware, and the user kills the process, causing the socket to be
freed, then we will get an Oops in the callback.
This should be replaced with a sock_hold.
Ok, I will try sock_hold.
Thanks,

-- 
TS
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help