path: root/crypto
diff options
authorOndrej Kozina <>2014-08-25 09:49:54 (GMT)
committerGreg Kroah-Hartman <>2014-11-14 16:48:00 (GMT)
commit591189c21235f0c2884cfae24b65ecfb5e120325 (patch)
treeaf2758bedcee666e84d34dbb47871185d1f3754a /crypto
parentb089fe5b6d7fe1ad383dd2ffcb2e4ce4ee0c574d (diff)
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 <> Signed-off-by: Herbert Xu <> Signed-off-by: Greg Kroah-Hartman <>
Diffstat (limited to 'crypto')
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index a19c027..83187f4 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)