svn commit: r201508 - stable/6/sys/opencrypto

Bjoern A. Zeeb bz at FreeBSD.org
Mon Jan 4 15:05:37 UTC 2010


Author: bz
Date: Mon Jan  4 15:05:37 2010
New Revision: 201508
URL: http://svn.freebsd.org/changeset/base/201508

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/6/sys/opencrypto/cryptosoft.c
Directory Properties:
  stable/6/sys/   (props changed)
  stable/6/sys/contrib/pf/   (props changed)
  stable/6/sys/dev/cxgb/   (props changed)

Modified: stable/6/sys/opencrypto/cryptosoft.c
==============================================================================
--- stable/6/sys/opencrypto/cryptosoft.c	Mon Jan  4 15:05:11 2010	(r201507)
+++ stable/6/sys/opencrypto/cryptosoft.c	Mon Jan  4 15:05:37 2010	(r201508)
@@ -539,7 +539,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