aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394
diff options
context:
space:
mode:
authorBen Collins <bcollins@ubuntu.com>2006-06-12 18:16:01 -0400
committerBen Collins <bcollins@ubuntu.com>2006-06-12 18:16:01 -0400
commit445151932e869fd76b23bccff75ae2a600ccf3c9 (patch)
tree5d71807bde779cd3f7454f02085a3d4b27cd7399 /drivers/ieee1394
parentf654240f330d77eb198af4abde89131e2a0e4f90 (diff)
ieee1394: hl_irqs_lock is taken in hardware interrupt context
ohci1394 and pcilynx call highlevel_host_reset from their hardware interrupt handler (via hpsb_selfid_complete). Therefore all readers and writers of hl_irqs_lock have to disable interrupts. Reported by Jiri Slaby and J. A. Magallon. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Ben Collins <bcollins@ubuntu.com>
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r--drivers/ieee1394/highlevel.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/drivers/ieee1394/highlevel.c b/drivers/ieee1394/highlevel.c
index 165dcd669560..d255d407e064 100644
--- a/drivers/ieee1394/highlevel.c
+++ b/drivers/ieee1394/highlevel.c
@@ -210,6 +210,8 @@ static int highlevel_for_each_host_reg(struct hpsb_host *host, void *__data)
210 210
211void hpsb_register_highlevel(struct hpsb_highlevel *hl) 211void hpsb_register_highlevel(struct hpsb_highlevel *hl)
212{ 212{
213 unsigned long flags;
214
213 INIT_LIST_HEAD(&hl->addr_list); 215 INIT_LIST_HEAD(&hl->addr_list);
214 INIT_LIST_HEAD(&hl->host_info_list); 216 INIT_LIST_HEAD(&hl->host_info_list);
215 217
@@ -219,9 +221,9 @@ void hpsb_register_highlevel(struct hpsb_highlevel *hl)
219 list_add_tail(&hl->hl_list, &hl_drivers); 221 list_add_tail(&hl->hl_list, &hl_drivers);
220 up_write(&hl_drivers_sem); 222 up_write(&hl_drivers_sem);
221 223
222 write_lock(&hl_irqs_lock); 224 write_lock_irqsave(&hl_irqs_lock, flags);
223 list_add_tail(&hl->irq_list, &hl_irqs); 225 list_add_tail(&hl->irq_list, &hl_irqs);
224 write_unlock(&hl_irqs_lock); 226 write_unlock_irqrestore(&hl_irqs_lock, flags);
225 227
226 if (hl->add_host) 228 if (hl->add_host)
227 nodemgr_for_each_host(hl, highlevel_for_each_host_reg); 229 nodemgr_for_each_host(hl, highlevel_for_each_host_reg);
@@ -282,9 +284,11 @@ static int highlevel_for_each_host_unreg(struct hpsb_host *host, void *__data)
282 284
283void hpsb_unregister_highlevel(struct hpsb_highlevel *hl) 285void hpsb_unregister_highlevel(struct hpsb_highlevel *hl)
284{ 286{
285 write_lock(&hl_irqs_lock); 287 unsigned long flags;
288
289 write_lock_irqsave(&hl_irqs_lock, flags);
286 list_del(&hl->irq_list); 290 list_del(&hl->irq_list);
287 write_unlock(&hl_irqs_lock); 291 write_unlock_irqrestore(&hl_irqs_lock, flags);
288 292
289 down_write(&hl_drivers_sem); 293 down_write(&hl_drivers_sem);
290 list_del(&hl->hl_list); 294 list_del(&hl->hl_list);
@@ -517,42 +521,45 @@ void highlevel_remove_host(struct hpsb_host *host)
517 521
518void highlevel_host_reset(struct hpsb_host *host) 522void highlevel_host_reset(struct hpsb_host *host)
519{ 523{
524 unsigned long flags;
520 struct hpsb_highlevel *hl; 525 struct hpsb_highlevel *hl;
521 526
522 read_lock(&hl_irqs_lock); 527 read_lock_irqsave(&hl_irqs_lock, flags);
523 list_for_each_entry(hl, &hl_irqs, irq_list) { 528 list_for_each_entry(hl, &hl_irqs, irq_list) {
524 if (hl->host_reset) 529 if (hl->host_reset)
525 hl->host_reset(host); 530 hl->host_reset(host);
526 } 531 }
527 read_unlock(&hl_irqs_lock); 532 read_unlock_irqrestore(&hl_irqs_lock, flags);
528} 533}
529 534
530void highlevel_iso_receive(struct hpsb_host *host, void *data, size_t length) 535void highlevel_iso_receive(struct hpsb_host *host, void *data, size_t length)
531{ 536{
537 unsigned long flags;
532 struct hpsb_highlevel *hl; 538 struct hpsb_highlevel *hl;
533 int channel = (((quadlet_t *)data)[0] >> 8) & 0x3f; 539 int channel = (((quadlet_t *)data)[0] >> 8) & 0x3f;
534 540
535 read_lock(&hl_irqs_lock); 541 read_lock_irqsave(&hl_irqs_lock, flags);
536 list_for_each_entry(hl, &hl_irqs, irq_list) { 542 list_for_each_entry(hl, &hl_irqs, irq_list) {
537 if (hl->iso_receive) 543 if (hl->iso_receive)
538 hl->iso_receive(host, channel, data, length); 544 hl->iso_receive(host, channel, data, length);
539 } 545 }
540 read_unlock(&hl_irqs_lock); 546 read_unlock_irqrestore(&hl_irqs_lock, flags);
541} 547}
542 548
543void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction, 549void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction,
544 void *data, size_t length) 550 void *data, size_t length)
545{ 551{
552 unsigned long flags;
546 struct hpsb_highlevel *hl; 553 struct hpsb_highlevel *hl;
547 int cts = ((quadlet_t *)data)[0] >> 4; 554 int cts = ((quadlet_t *)data)[0] >> 4;
548 555
549 read_lock(&hl_irqs_lock); 556 read_lock_irqsave(&hl_irqs_lock, flags);
550 list_for_each_entry(hl, &hl_irqs, irq_list) { 557 list_for_each_entry(hl, &hl_irqs, irq_list) {
551 if (hl->fcp_request) 558 if (hl->fcp_request)
552 hl->fcp_request(host, nodeid, direction, cts, data, 559 hl->fcp_request(host, nodeid, direction, cts, data,
553 length); 560 length);
554 } 561 }
555 read_unlock(&hl_irqs_lock); 562 read_unlock_irqrestore(&hl_irqs_lock, flags);
556} 563}
557 564
558int highlevel_read(struct hpsb_host *host, int nodeid, void *data, 565int highlevel_read(struct hpsb_host *host, int nodeid, void *data,