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: [PATCH 2/2 update] firewire: insist on successive self ID complete events
Date: Wed, 19 Mar 2008 22:02:40 +0100 (CET)	[thread overview]
Message-ID: <tkrat.f63ec71babd13755@s5r6.in-berlin.de> (raw)
In-Reply-To: <tkrat.00038248cbf40b77@s5r6.in-berlin.de>

The whole topology code only works if the old and new topologies which
are compared come from immediately successive self ID complete events.

If there happened bus resets without self ID complete events in the
meantime, or self ID complete events with invalid selfIDs, the topology
comparison could identify nodes wrongly, or more likely just corrupt
kernel memory or panic right away.

We new discard all nodes of the old topology and treat all current nodes
as new ones if the current self ID generation is not the previous one
plus 1.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---

Update:
  - Doesn't help with http://bugzilla.kernel.org/show_bug.cgi?id=10128.
  - Suppress spurious "destroying all nodes" if there are none, in
    particular when loading the driver.

 drivers/firewire/fw-topology.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

Index: linux/drivers/firewire/fw-topology.c
===================================================================
--- linux.orig/drivers/firewire/fw-topology.c
+++ linux/drivers/firewire/fw-topology.c
@@ -513,6 +513,18 @@ fw_core_handle_bus_reset(struct fw_card 
 
 	fw_flush_transactions(card);
 
+	/*
+	 * If the selfID buffer is not the immediate successor of the
+	 * previously processed one, we cannot reliably compare the
+	 * old and new topologies.
+	 */
+	if ((generation & 0xff) != ((card->generation + 1) & 0xff) &&
+	    card->local_node != NULL) {
+		fw_notify("skipped bus generations, destroying all nodes\n");
+		fw_destroy_nodes(card);
+		card->bm_retries = 0;
+	}
+
 	spin_lock_irqsave(&card->lock, flags);
 
 	/*

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


  parent reply	other threads:[~2008-03-19 22:30 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
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   ` Stefan Richter [this message]
2008-04-18 16:45     ` [PATCH 2/2 update] firewire: insist on successive self ID complete events 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.f63ec71babd13755@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®