lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Sun, 25 Oct 2009 11:03:22 +0100
From:	Arnd Bergmann <arndbergmann@...glemail.com>
To:	Mike Frysinger <vapier.adi@...il.com>
Cc:	Matt Fleming <matt@...sole-pimps.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] lib/checksum.c: lib/checksum: fix one more thinko

When do_csum gets unaligned data, we really need to treat
the first byte as an even byte, not an odd byte, because
we swap the two halves later.

Found by Mike's checksum-selftest module.

Reported-by: Mike Frysinger <vapier.adi@...il.com>
Signed-off-by: Arnd Bergmann <arnd@...db.de>

---

On Sunday 25 October 2009, Mike Frysinger wrote:

> > Andrew, Arnd, could one of you pick this up?
> 
> we've been using the generic checksum code with this fix on Blackfin
> boards for the last month and havent noticed any regressions so far

Mike,

sorry for my unresponsiveness on this one. I kept procrastinating
because I knew I need some to look at the whole logic again to make sure
I really get it right this time.

Andrew,

can you pick this one up to make sure we don't lose it again?
I could also put it into the asm-generic tree, but it feels out
of place there.

	Arnd <><


diff --git a/lib/checksum.c b/lib/checksum.c
index b2e2fd4..45c9c93 100644
--- a/lib/checksum.c
+++ b/lib/checksum.c
@@ -56,9 +56,9 @@ static unsigned int do_csum(const unsigned char *buff, int len)
 	odd = 1 & (unsigned long) buff;
 	if (odd) {
 #ifdef __LITTLE_ENDIAN
-		result = *buff;
-#else
 		result += (*buff << 8);
+#else
+		result = *buff;
 #endif
 		len--;
 		buff++;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ