Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9c9bdf4d50730fd04b06077e22d7a83b585f26b5
Commit:     9c9bdf4d50730fd04b06077e22d7a83b585f26b5
Parent:     5d59a6f1ba90f15132d55d9d4d5a632f15a43d84
Author:     Stefan Richter <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 02:15:36 2007 +0200
Committer:  Stefan Richter <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 23:53:28 2007 +0200

    firewire: fix memory leak of fw_request instances
    
    Found and debugged by Jay Fenlason <[EMAIL PROTECTED]>.
    The bug was especially noticeable with direct I/O over fw-sbp2.
    
    Signed-off-by: Stefan Richter <[EMAIL PROTECTED]>
    Signed-off-by: Kristian Høgsberg <[EMAIL PROTECTED]>
---
 drivers/firewire/fw-transaction.c |    4 +++-
 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 c4b3417..3ce8e2f 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 5abed19..5ceaccd 100644
--- a/drivers/firewire/fw-transaction.h
+++ b/drivers/firewire/fw-transaction.h
@@ -123,6 +123,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,
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to