Browse Source

firewire: fix panic in handle_at_packet

This fixes a use-after-free bug in the handling of split transactions.
The AT DMA handler of the request was occasionally executed after the
AR DMA handler of the response.  The AT DMA handler then accessed an
already freed packet.

Reported by Johannes Berg.
http://bugzilla.kernel.org/show_bug.cgi?id=9617

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Tested-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jarod Wilson <jwilson@redhat.com>
Stefan Richter 17 years ago
parent
commit
10a4c73551
1 changed files with 6 additions and 0 deletions
  1. 6 0
      drivers/firewire/fw-transaction.c

+ 6 - 0
drivers/firewire/fw-transaction.c

@@ -736,6 +736,12 @@ fw_core_handle_response(struct fw_card *card, struct fw_packet *p)
 		break;
 		break;
 	}
 	}
 
 
+	/*
+	 * The response handler may be executed while the request handler
+	 * is still pending.  Cancel the request handler.
+	 */
+	card->driver->cancel_packet(card, &t->packet);
+
 	t->callback(card, rcode, data, data_length, t->callback_data);
 	t->callback(card, rcode, data, data_length, t->callback_data);
 }
 }
 EXPORT_SYMBOL(fw_core_handle_response);
 EXPORT_SYMBOL(fw_core_handle_response);