mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
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>
This commit is contained in:
parent
1e12299400
commit
5219a5342a
2 changed files with 11 additions and 0 deletions
|
@ -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) &&
|
if ((type == (CRYPTO_MSG_GETALG - CRYPTO_MSG_BASE) &&
|
||||||
(nlh->nlmsg_flags & NLM_F_DUMP))) {
|
(nlh->nlmsg_flags & NLM_F_DUMP))) {
|
||||||
|
struct crypto_alg *alg;
|
||||||
|
u16 dump_alloc = 0;
|
||||||
|
|
||||||
if (link->dump == NULL)
|
if (link->dump == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
list_for_each_entry(alg, &crypto_alg_list, cra_list)
|
||||||
|
dump_alloc += CRYPTO_REPORT_MAXSIZE;
|
||||||
|
|
||||||
{
|
{
|
||||||
struct netlink_dump_control c = {
|
struct netlink_dump_control c = {
|
||||||
.dump = link->dump,
|
.dump = link->dump,
|
||||||
.done = link->done,
|
.done = link->done,
|
||||||
|
.min_dump_alloc = dump_alloc,
|
||||||
};
|
};
|
||||||
return netlink_dump_start(crypto_nlsk, skb, nlh, &c);
|
return netlink_dump_start(crypto_nlsk, skb, nlh, &c);
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,3 +100,6 @@ struct crypto_report_rng {
|
||||||
char type[CRYPTO_MAX_NAME];
|
char type[CRYPTO_MAX_NAME];
|
||||||
unsigned int seedsize;
|
unsigned int seedsize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
|
||||||
|
sizeof(struct crypto_report_blkcipher))
|
||||||
|
|
Loading…
Reference in a new issue