diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-07-19 11:28:42 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-08-10 01:27:37 +0400 |
commit | b336114c8eab95d6892efd325247d2d5860d3ae0 (patch) | |
tree | 92c87b39f64634f96ac9e3953165586fb72f88d4 | |
parent | 717bb45a019dd5e298f261a316cdf3b9298b4544 (diff) | |
download | linux-b336114c8eab95d6892efd325247d2d5860d3ae0.tar.xz |
firewire: fix memory leak of fw_request instances
Found and debugged by Jay Fenlason <fenlason@redhat.com>.
The bug was especially noticeable with direct I/O over fw-sbp2.
Same as commit 9c9bdf4d50730fd04b06077e22d7a83b585f26b5.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/firewire/fw-transaction.c | 4 | ||||
-rw-r--r-- | drivers/firewire/fw-transaction.h | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c index 80d0121463d0..a506a1fef9a3 100644 --- a/drivers/firewire/fw-transaction.c +++ b/drivers/firewire/fw-transaction.c @@ -605,8 +605,10 @@ fw_send_response(struct fw_card *card, struct fw_request *request, int rcode) * check is sufficient to ensure we don't send response to * broadcast packets or posted writes. */ - if (request->ack != ACK_PENDING) + if (request->ack != ACK_PENDING) { + kfree(request); return; + } if (rcode == RCODE_COMPLETE) fw_fill_response(&request->response, request->request_header, diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h index b6b42fa3fff0..e2b9ca43ffaa 100644 --- a/drivers/firewire/fw-transaction.h +++ b/drivers/firewire/fw-transaction.h @@ -124,6 +124,10 @@ typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode, size_t length, void *callback_data); +/* + * Important note: The callback must guarantee that either fw_send_response() + * or kfree() is called on the @request. + */ typedef void (*fw_address_callback_t)(struct fw_card *card, struct fw_request *request, int tcode, int destination, int source, |