diff options
author | Steffen Klassert <steffen.klassert@secunet.com> | 2012-03-29 09:04:46 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2012-03-29 19:52:48 +0800 |
commit | f4766950a4645dcb08ae2882d7b50bd7b592084e (patch) | |
tree | 8a7e09ae28c3326a555d463ff64e2ee93864b9ca | |
parent | 88ba94c77405fdb4aed52c5ef3387b06b7ee00c8 (diff) | |
download | linux-crypto-f4766950a4645dcb08ae2882d7b50bd7b592084e.tar.gz linux-crypto-f4766950a4645dcb08ae2882d7b50bd7b592084e.zip |
crypto: user - Fix size of netlink dump message
The default netlink message size limit might be exceeded when dumping a
lot of algorithms to userspace. As a result, not all of the instantiated
algorithms dumped to userspace. So calculate an upper bound on the message
size and call netlink_dump_start() with that value.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r-- | crypto/crypto_user.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c index e91c1611..f1ea0a06 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) if ((type == (CRYPTO_MSG_GETALG - CRYPTO_MSG_BASE) && (nlh->nlmsg_flags & NLM_F_DUMP))) { + struct crypto_alg *alg; + u16 dump_alloc = 0; + if (link->dump == NULL) return -EINVAL; + + list_for_each_entry(alg, &crypto_alg_list, cra_list) + dump_alloc += CRYPTO_REPORT_MAXSIZE; + { struct netlink_dump_control c = { .dump = link->dump, .done = link->done, + .min_dump_alloc = dump_alloc, }; return netlink_dump_start(crypto_nlsk, skb, nlh, &c); } |