浏览代码

crypto: algif - avoid excessive use of socket buffer in skcipher

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>
Ondrej Kozina 11 年之前
父节点
当前提交
e2cffb5f49
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      crypto/algif_skcipher.c

+ 1 - 1
crypto/algif_skcipher.c

@@ -49,7 +49,7 @@ struct skcipher_ctx {
 	struct ablkcipher_request req;
 	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)
 		      sizeof(struct scatterlist) - 1)
 
 
 static inline int skcipher_sndbuf(struct sock *sk)
 static inline int skcipher_sndbuf(struct sock *sk)