nvmet: Fix req->data_len size in case of nvme_admin_get_features cmd, fid 0x81
Subsystems (2)
PATCH 1/1 nvmet: Fix req->data_len size in case of nvme_admin_get_features cmd, fid 0x81
From: Amit Engel <[email protected]>
In feature id 0x81 NVME_FEAT_HOST_ID, nvmet_copy_to_sgl is called req->data_len shall hold a non-zero value which is 'sizeof(req->sq->ctrl->hostid)'
--- drivers/nvme/target/admin-cmd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/nvme/target/admin-cmd.c +5 -1
@@ -812,6 +812,7 @@ u16 nvmet_parse_admin_cmd(struct nvmet_req *req) {struct nvme_command *cmd = req->cmd;u16 ret; +u8 feature; ret =nvmet_check_ctrl_status (req, cmd);if (unlikely (ret))
@@ -875,7 +876,10 @@ u16 nvmet_parse_admin_cmd(struct nvmet_req *req)return 0 ;case nvme_admin_get_features: req->execute = nvmet_execute_get_features; - req->data_len =0 ; +if (feature ==NVME_FEAT_HOST_ID ) + req->data_len =sizeof (req->sq->ctrl->hostid); +else + req->data_len =0 ;return 0 ;case nvme_admin_async_event: req->execute = nvmet_execute_async_event;
Signature · 7 lines
2.16.5 _______________________________________________ linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
->data_len is gone in latest mainline, instead nvmet_execute_get_features check the transfer_len. But your general scheme should apply there. I think a little nvmet_feature_data_len helper to calculate the required length would be nice, similar to what we do for read/write commands or log pages.
_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Ok, please ignore my previous patches from earlier today.
I just sent a new patch based on nvme-5.5
"Add helper function 'nvmet_feature_data_len' to calculate the required data_len"
Please let me know what you think
Thanks
Amit Engel
-----Original Message-----
From: Christoph Hellwig <[email protected]>
Sent: Thursday, December 5, 2019 10:33 AM
To: Engel, Amit
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] nvmet: Fix req->data_len size in case of nvme_admin_get_features cmd, fid 0x81
[EXTERNAL EMAIL]
->data_len is gone in latest mainline, insteadnvmet_execute_get_features check the transfer_len. But your general scheme should apply there. I think a little nvmet_feature_data_len helper to calculate the required length would be nice, similar to what we do for read/write commands or log pages.
_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Hi,
Did you receive my latest patch fix for the below bug?
Thanks
Amit
-----Original Message-----
From: Engel, Amit
Sent: Thursday, December 5, 2019 3:36 PM
To: Christoph Hellwig
Cc: [email protected]; [email protected]
Subject: RE: [PATCH] nvmet: Fix req->data_len size in case of nvme_admin_get_features cmd, fid 0x81
Ok, please ignore my previous patches from earlier today.
I just sent a new patch based on nvme-5.5 "Add helper function 'nvmet_feature_data_len' to calculate the required data_len"
Please let me know what you think
Thanks
Amit Engel
-----Original Message-----
From: Christoph Hellwig <[email protected]>
Sent: Thursday, December 5, 2019 10:33 AM
To: Engel, Amit
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] nvmet: Fix req->data_len size in case of nvme_admin_get_features cmd, fid 0x81
[EXTERNAL EMAIL]
->data_len is gone in latest mainline, insteadnvmet_execute_get_features check the transfer_len. But your general scheme should apply there. I think a little nvmet_feature_data_len helper to calculate the required length would be nice, similar to what we do for read/write commands or log pages.
_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 6 lines · Amit
Hi,
Did you receive my latest patch fix for the below bug?
Thanks
Amit
There 3 patches on the mailing list.
I've just posted a patch with some fixes on the top of your patch.
_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme