[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <32d123fa-5c5f-4db6-d333-24b71639b738@nokia.com>
Date: Thu, 6 Apr 2017 14:32:27 +0200
From: Alexander Sverdlin <alexander.sverdlin@...ia.com>
To: Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
<linux-crypto@...r.kernel.org>, <netdev@...r.kernel.org>
Subject: Re: [PATCH 2/4] crypto: af_alg - Allow arbitrarily long algorithm
names
Hi!
On 06/04/17 10:16, Herbert Xu wrote:
> This patch removes the hard-coded 64-byte limit on the length
> of the algorithm name through bind(2). The address length can
> now exceed that. The user-space structure remains unchanged.
> In order to use a longer name simply extend the salg_name array
> beyond its defined 64 bytes length.
>
> Signed-off-by: Herbert Xu <herbert@...dor.apana.org.au>
> ---
>
> crypto/af_alg.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/crypto/af_alg.c b/crypto/af_alg.c
> index 690deca..3556d8e 100644
> --- a/crypto/af_alg.c
> +++ b/crypto/af_alg.c
> @@ -160,11 +160,11 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
> if (sock->state == SS_CONNECTED)
> return -EINVAL;
>
> - if (addr_len != sizeof(*sa))
> + if (addr_len < sizeof(*sa))
> return -EINVAL;
>
> sa->salg_type[sizeof(sa->salg_type) - 1] = 0;
> - sa->salg_name[sizeof(sa->salg_name) - 1] = 0;
> + sa->salg_name[sizeof(sa->salg_name) + addr_len - sizeof(*sa) - 1] = 0;
>
> type = alg_get_type(sa->salg_type);
> if (IS_ERR(type) && PTR_ERR(type) == -ENOENT) {
Why should userspace ever extend the structure if salg_name is hardcoded to 64 in if_alg.h?
This patch doesn't change the behavior at all, or am I missing something?
--
Best regards,
Alexander Sverdlin.
Powered by blists - more mailing lists