svn commit: r199906 - head/sys/opencrypto
Bjoern A. Zeeb
bz at FreeBSD.org
Sun Nov 29 17:53:57 UTC 2009
Author: bz
Date: Sun Nov 29 17:53:57 2009
New Revision: 199906
URL: http://svn.freebsd.org/changeset/base/199906
Log:
In case the compression result is the same size as the orignal version,
the compression was useless as well. Make sure to not update the data
and return, else we would waste resources when decompressing.
This also avoids the copyback() changing data other consumers like
xform_ipcomp.c would have ignored because of no win and sent out without
noting that compression was used, resulting in invalid packets at the
receiver.
MFC after: 5 days
Modified:
head/sys/opencrypto/cryptosoft.c
Modified: head/sys/opencrypto/cryptosoft.c
==============================================================================
--- head/sys/opencrypto/cryptosoft.c Sun Nov 29 17:47:49 2009 (r199905)
+++ head/sys/opencrypto/cryptosoft.c Sun Nov 29 17:53:57 2009 (r199906)
@@ -552,7 +552,7 @@ swcr_compdec(struct cryptodesc *crd, str
sw->sw_size = result;
/* Check the compressed size when doing compression */
if (crd->crd_flags & CRD_F_COMP) {
- if (result > crd->crd_len) {
+ if (result >= crd->crd_len) {
/* Compression was useless, we lost time */
free(out, M_CRYPTO_DATA);
return 0;
More information about the svn-src-all
mailing list