svn commit: r201242 - stable/7/sys/opencrypto

Bjoern A. Zeeb bz at FreeBSD.org
Tue Dec 29 23:47:22 UTC 2009


Author: bz
Date: Tue Dec 29 23:47:21 2009
New Revision: 201242
URL: http://svn.freebsd.org/changeset/base/201242

Log:
  MFC r199906:
    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.

Modified:
  stable/7/sys/opencrypto/cryptosoft.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/opencrypto/cryptosoft.c
==============================================================================
--- stable/7/sys/opencrypto/cryptosoft.c	Tue Dec 29 23:44:32 2009	(r201241)
+++ stable/7/sys/opencrypto/cryptosoft.c	Tue Dec 29 23:47:21 2009	(r201242)
@@ -543,7 +543,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