Re: [PATCH 2/2] crypto: user - Fix size of netlink dump message

2012-03-28 Thread Steffen Klassert
On Thu, Mar 29, 2012 at 07:53:30AM +0200, Steffen Klassert wrote:
> 
> Ok, so I'll respin this one to the mainline and resend.

I'll resend the whole patchset, please ignore this one.

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] crypto: user - Fix size of netlink dump message

2012-03-28 Thread Steffen Klassert
On Thu, Mar 29, 2012 at 01:46:26PM +0800, Herbert Xu wrote:
> On Thu, Mar 29, 2012 at 07:45:04AM +0200, Steffen Klassert wrote:
> > On Mon, Mar 26, 2012 at 09:28:27AM +0200, Steffen Klassert wrote:
> > > +
> > >   return netlink_dump_start(crypto_nlsk, skb, nlh,
> > > -   link->dump, link->done, 0);
> > > +   link->dump, link->done, dump_alloc);
> > 
> > I've just noticed that the interface to netlink_dump_start() changed in
> > the mainline (with commit 80d326fab534a5380e8f6e509a0b9076655a9670), so
> > this will cause a conflict. The crypto-2.6 tree is way behind the mainline
> > (v3.2 + some patches). Could you please update the crypto-2.6 tree so that
> > I can respin this patch?
> 
> 
> As long as your patch is against mainline it should be fine.  I will
> rebase cryptodev before applying any patches for the next release.
> 

Ok, so I'll respin this one to the mainline and resend.
Anyway, would be nice to see this fix in v3.4.
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] crypto: user - Fix size of netlink dump message

2012-03-28 Thread Herbert Xu
On Thu, Mar 29, 2012 at 07:45:04AM +0200, Steffen Klassert wrote:
> On Mon, Mar 26, 2012 at 09:28:27AM +0200, Steffen Klassert wrote:
> > +
> > return netlink_dump_start(crypto_nlsk, skb, nlh,
> > - link->dump, link->done, 0);
> > + link->dump, link->done, dump_alloc);
> 
> I've just noticed that the interface to netlink_dump_start() changed in
> the mainline (with commit 80d326fab534a5380e8f6e509a0b9076655a9670), so
> this will cause a conflict. The crypto-2.6 tree is way behind the mainline
> (v3.2 + some patches). Could you please update the crypto-2.6 tree so that
> I can respin this patch?


As long as your patch is against mainline it should be fine.  I will
rebase cryptodev before applying any patches for the next release.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] crypto: user - Fix size of netlink dump message

2012-03-28 Thread Steffen Klassert
On Mon, Mar 26, 2012 at 09:28:27AM +0200, Steffen Klassert wrote:
> +
>   return netlink_dump_start(crypto_nlsk, skb, nlh,
> -   link->dump, link->done, 0);
> +   link->dump, link->done, dump_alloc);

I've just noticed that the interface to netlink_dump_start() changed in
the mainline (with commit 80d326fab534a5380e8f6e509a0b9076655a9670), so
this will cause a conflict. The crypto-2.6 tree is way behind the mainline
(v3.2 + some patches). Could you please update the crypto-2.6 tree so that
I can respin this patch?

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] crypto: user - Fix size of netlink dump message

2012-03-26 Thread Steffen Klassert
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 
---
 crypto/crypto_user.c   |8 +++-
 include/linux/cryptouser.h |3 +++
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c
index 38534aa..7fca04c 100644
--- a/crypto/crypto_user.c
+++ b/crypto/crypto_user.c
@@ -456,11 +456,17 @@ 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;
+
return netlink_dump_start(crypto_nlsk, skb, nlh,
- link->dump, link->done, 0);
+ link->dump, link->done, dump_alloc);
}
 
err = nlmsg_parse(nlh, crypto_msg_min[type], attrs, CRYPTOCFGA_MAX,
diff --git a/include/linux/cryptouser.h b/include/linux/cryptouser.h
index 532fb58..4abf2ea 100644
--- a/include/linux/cryptouser.h
+++ b/include/linux/cryptouser.h
@@ -100,3 +100,6 @@ struct crypto_report_rng {
char type[CRYPTO_MAX_NAME];
unsigned int seedsize;
 };
+
+#define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
+  sizeof(struct crypto_report_blkcipher))
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html