aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2007-03-27 10:42:39 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-03-28 15:30:15 -0400
commit93e4fd455c62085cdceea3af4c56d95758d3cb74 (patch)
tree1b760e2a26572cf80c8a06d21cac3221582a4776 /drivers/firewire
parent3964a4496eaa4cb84772e8dfc6c3a72ec4ddca7a (diff)
firewire: Don't set card->irm_node before we have a new valid topology.
In case the topology build fails, we want to retain the old topology info until another reset finishes and results in a valid new tree. If we clear card->irm_node to NULL and the topology build fails, we end up dereferencing a NULL pointer in a few places. Signed-off-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/fw-topology.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/firewire/fw-topology.c b/drivers/firewire/fw-topology.c
index 7923463fdbf3..bc8a3487c83a 100644
--- a/drivers/firewire/fw-topology.c
+++ b/drivers/firewire/fw-topology.c
@@ -166,7 +166,7 @@ static void update_hop_count(struct fw_node *node)
166static struct fw_node *build_tree(struct fw_card *card, 166static struct fw_node *build_tree(struct fw_card *card,
167 u32 *sid, int self_id_count) 167 u32 *sid, int self_id_count)
168{ 168{
169 struct fw_node *node, *child, *local_node; 169 struct fw_node *node, *child, *local_node, *irm_node;
170 struct list_head stack, *h; 170 struct list_head stack, *h;
171 u32 *next_sid, *end, q; 171 u32 *next_sid, *end, q;
172 int i, port_count, child_port_count, phy_id, parent_count, stack_depth; 172 int i, port_count, child_port_count, phy_id, parent_count, stack_depth;
@@ -178,7 +178,7 @@ static struct fw_node *build_tree(struct fw_card *card,
178 stack_depth = 0; 178 stack_depth = 0;
179 end = sid + self_id_count; 179 end = sid + self_id_count;
180 phy_id = 0; 180 phy_id = 0;
181 card->irm_node = NULL; 181 irm_node = NULL;
182 gap_count = self_id_gap_count(*sid); 182 gap_count = self_id_gap_count(*sid);
183 topology_type = 0; 183 topology_type = 0;
184 184
@@ -218,7 +218,7 @@ static struct fw_node *build_tree(struct fw_card *card,
218 local_node = node; 218 local_node = node;
219 219
220 if (self_id_contender(q)) 220 if (self_id_contender(q))
221 card->irm_node = node; 221 irm_node = node;
222 222
223 if (node->phy_speed == SCODE_BETA) 223 if (node->phy_speed == SCODE_BETA)
224 topology_type |= FW_TOPOLOGY_B; 224 topology_type |= FW_TOPOLOGY_B;
@@ -282,6 +282,7 @@ static struct fw_node *build_tree(struct fw_card *card,
282 } 282 }
283 283
284 card->root_node = node; 284 card->root_node = node;
285 card->irm_node = irm_node;
285 card->gap_count = gap_count; 286 card->gap_count = gap_count;
286 card->topology_type = topology_type; 287 card->topology_type = topology_type;
287 288