[PATCH 1/2] nvmet: fix oops in nvmet_execute_passthru_cmd()
Chaitanya Kulkarni
Chaitanya.Kulkarni at wdc.com
Thu Aug 6 15:40:35 EDT 2020
Logan,
>> diff --git a/drivers/nvme/target/passthru.c b/drivers/nvme/target/passthru.c
>> index a260c09b5ab2..96bc9aa11ddb 100644
>> --- a/drivers/nvme/target/passthru.c
>> +++ b/drivers/nvme/target/passthru.c
>> @@ -239,7 +239,6 @@ static void nvmet_passthru_execute_cmd(struct
>> nvmet_req *req)
>>
>> rq = nvme_alloc_request(q, req->cmd, BLK_MQ_REQ_NOWAIT, NVME_QID_ANY);
>> if (IS_ERR(rq)) {
>> - rq = NULL;
>> status = NVME_SC_INTERNAL;
>> goto fail_out;
>> }
>> @@ -248,7 +247,7 @@ static void nvmet_passthru_execute_cmd(struct
>> nvmet_req *req)
>> ret = nvmet_passthru_map_sg(req, rq);
>> if (unlikely(ret)) {
>> status = NVME_SC_INTERNAL;
>> - goto fail_out;
>> + goto fail_put_req;
>> }
>> }
>>
>> @@ -275,11 +274,12 @@ static void nvmet_passthru_execute_cmd(struct
>> nvmet_req *req)
>>
>> return;
>>
>> +fail_put_req:
>> + blk_put_request(rq);
>> fail_out:
>> if (ns)
>> nvme_put_ns(ns);
>> nvmet_req_complete(req, status);
>> - blk_put_request(rq);
>> }
>>
>> /*
>
This adds an extra label. Also I don't understand why we should change
the order of nvmet_req_complete() and blk_put_request() in
nvmet_passthru_execute_cmd() and make is inconsistent with in
nvmet_passthru_req_done() ?
More information about the Linux-nvme
mailing list