Commit 888fb5b9 authored by James Bottomley's avatar James Bottomley Committed by James Bottomley

[SCSI] Correct command leaks in the prep_fn

parent 54a7ee17
...@@ -781,11 +781,8 @@ static int scsi_init_io(Scsi_Cmnd *SCpnt) ...@@ -781,11 +781,8 @@ static int scsi_init_io(Scsi_Cmnd *SCpnt)
printk(KERN_ERR "req nr_sec %lu, cur_nr_sec %u\n", req->nr_sectors, printk(KERN_ERR "req nr_sec %lu, cur_nr_sec %u\n", req->nr_sectors,
req->current_nr_sectors); req->current_nr_sectors);
/* /* release the command and kill it */
* kill it. there should be no leftover blocks in this request scsi_put_command(SCpnt);
*/
SCpnt = scsi_end_request(SCpnt, 0, req->nr_sectors, 1);
BUG_ON(SCpnt);
ret = BLKPREP_KILL; ret = BLKPREP_KILL;
out: out:
return ret; return ret;
...@@ -884,6 +881,7 @@ int scsi_prep_fn(struct request_queue *q, struct request *req) ...@@ -884,6 +881,7 @@ int scsi_prep_fn(struct request_queue *q, struct request *req)
* required). * required).
*/ */
if ((ret = scsi_init_io(SCpnt))) if ((ret = scsi_init_io(SCpnt)))
/* BLKPREP_KILL return also releases the command */
return ret; return ret;
/* /*
...@@ -891,6 +889,7 @@ int scsi_prep_fn(struct request_queue *q, struct request *req) ...@@ -891,6 +889,7 @@ int scsi_prep_fn(struct request_queue *q, struct request *req)
*/ */
if (!STpnt->init_command(SCpnt)) { if (!STpnt->init_command(SCpnt)) {
scsi_release_buffers(SCpnt); scsi_release_buffers(SCpnt);
scsi_put_command(SCpnt);
return BLKPREP_KILL; return BLKPREP_KILL;
} }
} }
......
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