aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crypto/crypto_user.c8
-rw-r--r--include/linux/cryptouser.h3
2 files changed, 11 insertions, 0 deletions
diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c
index e91c16111ed3..f1ea0a064135 100644
--- a/crypto/crypto_user.c
+++ b/crypto/crypto_user.c
@@ -457,12 +457,20 @@ static int crypto_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
457 457
458 if ((type == (CRYPTO_MSG_GETALG - CRYPTO_MSG_BASE) && 458 if ((type == (CRYPTO_MSG_GETALG - CRYPTO_MSG_BASE) &&
459 (nlh->nlmsg_flags & NLM_F_DUMP))) { 459 (nlh->nlmsg_flags & NLM_F_DUMP))) {
460 struct crypto_alg *alg;
461 u16 dump_alloc = 0;
462
460 if (link->dump == NULL) 463 if (link->dump == NULL)
461 return -EINVAL; 464 return -EINVAL;
465
466 list_for_each_entry(alg, &crypto_alg_list, cra_list)
467 dump_alloc += CRYPTO_REPORT_MAXSIZE;
468
462 { 469 {
463 struct netlink_dump_control c = { 470 struct netlink_dump_control c = {
464 .dump = link->dump, 471 .dump = link->dump,
465 .done = link->done, 472 .done = link->done,
473 .min_dump_alloc = dump_alloc,
466 }; 474 };
467 return netlink_dump_start(crypto_nlsk, skb, nlh, &c); 475 return netlink_dump_start(crypto_nlsk, skb, nlh, &c);
468 } 476 }
diff --git a/include/linux/cryptouser.h b/include/linux/cryptouser.h
index 532fb58f16bf..4abf2ea6a887 100644
--- a/include/linux/cryptouser.h
+++ b/include/linux/cryptouser.h
@@ -100,3 +100,6 @@ struct crypto_report_rng {
100 char type[CRYPTO_MAX_NAME]; 100 char type[CRYPTO_MAX_NAME];
101 unsigned int seedsize; 101 unsigned int seedsize;
102}; 102};
103
104#define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
105 sizeof(struct crypto_report_blkcipher))