summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorOndrej Kozina <okozina@redhat.com>2014-08-25 11:49:54 +0200
committerLuis Henriques <luis.henriques@canonical.com>2014-11-14 15:20:05 +0000
commit27d507ca56491959f3172b44fac263c3d330dc35 (patch)
tree023e9e3d27cb0622ae3dad078420dad3f0ec1f42 /crypto
parent81603a0ef02f2253a562c9ebc78147098e237c65 (diff)
downloadlinux-stable-27d507ca56491959f3172b44fac263c3d330dc35.tar.gz
linux-stable-27d507ca56491959f3172b44fac263c3d330dc35.tar.bz2
linux-stable-27d507ca56491959f3172b44fac263c3d330dc35.zip
crypto: algif - avoid excessive use of socket buffer in skcipher
commit e2cffb5f493a8b431dc87124388ea59b79f0bccb upstream. On archs with PAGE_SIZE >= 64 KiB the function skcipher_alloc_sgl() fails with -ENOMEM no matter what user space actually requested. This is caused by the fact sock_kmalloc call inside the function tried to allocate more memory than allowed by the default kernel socket buffer size (kernel param net.core.optmem_max). Signed-off-by: Ondrej Kozina <okozina@redhat.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/algif_skcipher.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index a19c027b29bd..83187f497c7c 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -49,7 +49,7 @@ struct skcipher_ctx {
struct ablkcipher_request req;
};
-#define MAX_SGL_ENTS ((PAGE_SIZE - sizeof(struct skcipher_sg_list)) / \
+#define MAX_SGL_ENTS ((4096 - sizeof(struct skcipher_sg_list)) / \
sizeof(struct scatterlist) - 1)
static inline int skcipher_sndbuf(struct sock *sk)