[PATCH] fix mm leakage of block request in SCSI FiberChannel transport

From: Hillf Danton
Date: Thu Nov 25 2010 - 08:53:16 EST


When blk_rq_timed_out_timer run, only requests that are not completed
are selected for processing with LLD callback function.

In the case of fc_bsg_job_timeout, if BLK_EH_NOT_HANDLED returned, the
block layer will be signaled to do nothing for the request, but the
request still remains uncompleted since it is already marked with
REQ_ATOM_COMPLETE by the timer function and blk_complete_request()
will check it. Thus mm leakage is triggered.

It is fixed by returning BLK_EH_HANDLED, instead of
BLK_EH_NOT_HANDLED, with warning also recorded.

Thanks all for comments when preparing this work.

Signed-off-by: Hillf Danton <dhillf@xxxxxxxxx>
---

--- a/drivers/scsi/scsi_transport_fc.c 2010-11-01 19:54:12.000000000 +0800
+++ b/drivers/scsi/scsi_transport_fc.c 2010-11-24 20:55:12.000000000 +0800
@@ -3626,9 +3626,9 @@ fc_bsg_job_timeout(struct request *req)

/* the blk_end_sync_io() doesn't check the error */
if (done)
- return BLK_EH_NOT_HANDLED;
- else
- return BLK_EH_HANDLED;
+ printk(KERN_WARNING "%s: fixing mm leak...done\n", __func__);
+
+ return BLK_EH_HANDLED;
}

static int
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/