mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: Jarod Wilson <jwilson@redhat.com>
Cc: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] firewire: fw-ohci: add self ID error check
Date: Wed, 19 Mar 2008 21:37:42 +0100 (CET)	[thread overview]
Message-ID: <tkrat.463115f5f3763a98@s5r6.in-berlin.de> (raw)
In-Reply-To: <tkrat.a46eb70f34367db6@s5r6.in-berlin.de>

On 19 Mar, Stefan Richter wrote:
> Discard self ID buffer contents if
>   - the selfIDError flag is set,
>   - any of the self ID packets has bit errors.
> 
> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
> ---
>  drivers/firewire/fw-ohci.c |   12 +++++++++---
>  drivers/firewire/fw-ohci.h |    1 +
>  2 files changed, 10 insertions(+), 3 deletions(-)
> 
> Index: linux/drivers/firewire/fw-ohci.c
> ===================================================================
> --- linux.orig/drivers/firewire/fw-ohci.c
> +++ linux/drivers/firewire/fw-ohci.c
> @@ -1060,20 +1060,26 @@ static void bus_reset_tasklet(unsigned l
>  	ohci->node_id = reg & (OHCI1394_NodeID_busNumber |
>  			       OHCI1394_NodeID_nodeNumber);
>  
> +	reg = reg_read(ohci, OHCI1394_SelfIDCount);
> +	if (reg & OHCI1394_SelfIDCount_selfIDError) {
> +		fw_error("inconsistent self IDs\n");
> +		return;
> +	}
>  	/*
>  	 * The count in the SelfIDCount register is the number of
>  	 * bytes in the self ID receive buffer.  Since we also receive
>  	 * the inverted quadlets and a header quadlet, we shift one
>  	 * bit extra to get the actual number of self IDs.
>  	 */
> -
> -	self_id_count = (reg_read(ohci, OHCI1394_SelfIDCount) >> 3) & 0x3ff;
> +	self_id_count = (reg >> 3) & 0x3ff;
>  	generation = (cond_le32_to_cpu(ohci->self_id_cpu[0]) >> 16) & 0xff;
>  	rmb();
>  
>  	for (i = 1, j = 0; j < self_id_count; i += 2, j++) {
> -		if (ohci->self_id_cpu[i] != ~ohci->self_id_cpu[i + 1])
> +		if (ohci->self_id_cpu[i] != ~ohci->self_id_cpu[i + 1]) {
>  			fw_error("inconsistent self IDs\n");
> +			return;
> +		}
>  		ohci->self_id_buffer[j] =
>  				cond_le32_to_cpu(ohci->self_id_cpu[i]);
>  	}
> Index: linux/drivers/firewire/fw-ohci.h
> ===================================================================
> --- linux.orig/drivers/firewire/fw-ohci.h
> +++ linux/drivers/firewire/fw-ohci.h
> @@ -30,6 +30,7 @@
>  #define  OHCI1394_HCControl_softReset		0x00010000
>  #define OHCI1394_SelfIDBuffer                 0x064
>  #define OHCI1394_SelfIDCount                  0x068
> +#define  OHCI1394_SelfIDCount_selfIDError	0x80000000
>  #define OHCI1394_IRMultiChanMaskHiSet         0x070
>  #define OHCI1394_IRMultiChanMaskHiClear       0x074
>  #define OHCI1394_IRMultiChanMaskLoSet         0x078
> 

-- 
Stefan Richter
-=====-==--- --== =--==
http://arcgraph.de/sr/


  reply	other threads:[~2008-03-19 22:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-19 19:55 [PATCH 1/2] firewire: catch self_id_count == 0 Stefan Richter
2008-03-19 19:56 ` [PATCH 2/2] firewire: insist on successive self ID complete events Stefan Richter
2008-03-19 20:32   ` [PATCH] firewire: fw-ohci: add self ID error check Stefan Richter
2008-03-19 20:37     ` Stefan Richter [this message]
2008-03-19 20:40       ` [PATCH update] " Stefan Richter
2008-03-19 21:05         ` [PATCH] firewire: fw-ohci: catch self_id_count == 0 Stefan Richter
2008-03-22 10:20           ` Stefan Richter
2008-03-23  3:39             ` Jarod Wilson
2008-03-19 21:02   ` [PATCH 2/2 update] firewire: insist on successive self ID complete events Stefan Richter
2008-04-18 16:45     ` Stefan Richter
2008-03-19 20:11 ` [PATCH 1/2] firewire: catch self_id_count == 0 Stefan Richter
2008-03-19 20:24   ` Stefan Richter

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=tkrat.463115f5f3763a98@s5r6.in-berlin.de \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=jwilson@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    /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

all inboxes | Powered by JetHome®