Commit 9c9bdf4d authored by Stefan Richter's avatar Stefan Richter

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.
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: default avatarKristian Høgsberg <krh@redhat.com>
parent 5d59a6f1
...@@ -605,8 +605,10 @@ fw_send_response(struct fw_card *card, struct fw_request *request, int rcode) ...@@ -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 * check is sufficient to ensure we don't send response to
* broadcast packets or posted writes. * broadcast packets or posted writes.
*/ */
if (request->ack != ACK_PENDING) if (request->ack != ACK_PENDING) {
kfree(request);
return; return;
}
if (rcode == RCODE_COMPLETE) if (rcode == RCODE_COMPLETE)
fw_fill_response(&request->response, request->request_header, fw_fill_response(&request->response, request->request_header,
......
...@@ -123,6 +123,10 @@ typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode, ...@@ -123,6 +123,10 @@ typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode,
size_t length, size_t length,
void *callback_data); 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, typedef void (*fw_address_callback_t)(struct fw_card *card,
struct fw_request *request, struct fw_request *request,
int tcode, int destination, int source, int tcode, int destination, int source,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment