]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
firewire: fix memory leak of fw_request instances
authorStefan Richter <stefanr@s5r6.in-berlin.de>
Thu, 19 Jul 2007 07:28:42 +0000 (09:28 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 9 Aug 2007 21:27:37 +0000 (14:27 -0700)
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>
drivers/firewire/fw-transaction.c
drivers/firewire/fw-transaction.h

index 80d0121463d0d7fee8b0a49b6e56a3aab53b20f3..a506a1fef9a34ab452f0d35be319daded154c8b8 100644 (file)
@@ -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,
index b6b42fa3fff0ed38965c270cb8bd9f84fe5ab817..e2b9ca43ffaa1f2c589e4a1f55ca7df05c398b1c 100644 (file)
@@ -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,