public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ollie Wild <aaw@rincewind.tv>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] arch-sh csum_partial_copy_generic() bugfix
Date: Thu, 25 Aug 2005 10:57:43 -0700	[thread overview]
Message-ID: <430E0697.5000503@rincewind.tv> (raw)

[-- Attachment #1: Type: text/plain, Size: 496 bytes --]

There's a bug in Hitachi SuperH csum_partial_copy_generic() 
implementation.  If the supplied length is 1 (and several alignment 
conditions are met), the function immediately branches to label 4.  
However, the assembly at label 4 expects the length to be stored in 
register r2.  Since this has not occurred, subsequent behavior is undefined.

This can cause bad payload checksums in TCP connections.

I've fixed the problem by initializing register r2 prior to the branch 
instruction.

Ollie

[-- Attachment #2: csum_partial_copy_generic.patch --]
[-- Type: text/x-patch, Size: 456 bytes --]

diff --git a/arch/sh/lib/checksum.S b/arch/sh/lib/checksum.S
--- a/arch/sh/lib/checksum.S
+++ b/arch/sh/lib/checksum.S
@@ -202,8 +202,9 @@ ENTRY(csum_partial_copy_generic)
 	cmp/pz	r6		! Jump if we had at least two bytes.
 	bt/s	1f
 	 clrt
+	add	#2,r6		! r6 was < 2.	Deal with it.
 	bra	4f
-	 add	#2,r6		! r6 was < 2.	Deal with it.
+	 mov	r6,r2
 
 3:	! Handle different src and dest alignments.
 	! This is not common, so simple byte by byte copy will do.

             reply	other threads:[~2005-08-25 17:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-25 17:57 Ollie Wild [this message]
2005-09-02 17:26 ` [PATCH] arch-sh csum_partial_copy_generic() bugfix Ollie Wild
2005-09-02 22:24   ` Adrian Bunk
2005-09-02 22:29     ` Ollie Wild

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=430E0697.5000503@rincewind.tv \
    --to=aaw@rincewind.tv \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox