nvmet: do not allow model_number exceed 40 bytes
Subsystems (2)
PATCH 1/1 nvmet: do not allow model_number exceed 40 bytes
From: Noam Gottlieb <[email protected]>
According to the NVM specifications, the model number size should be 40 bytes (bytes 63:24 of the Identify Controller data structure). Therefore, any attempt to store a value into model_number which exceeds 40 bytes should return an error.
--- drivers/nvme/target/configfs.c | 6 ++++++ drivers/nvme/target/nvmet.h | 1 + 2 files changed, 7 insertions(+)
drivers/nvme/target/configfs.c +6 -0
@@ -1150,6 +1150,12 @@ static ssize_t nvmet_subsys_attr_model_store(struct config_item *item,if (!len)return -EINVAL ; +if (len >NVMET_MN_MAX_SIZE ) { +pr_err ("Model nubmer size can not exceed %d Bytes\n" , +NVMET_MN_MAX_SIZE ); +return -EINVAL ; + } +for (pos =0 ; pos < len; pos++) {if (!nvmet_is_ascii (page[pos]))return -EINVAL ;
drivers/nvme/target/nvmet.h +1 -0
@@ -27,6 +27,7 @@#define NVMET_ERROR_LOG_SLOTS 128#define NVMET_NO_ERROR_LOC ((u16)-1)#define NVMET_DEFAULT_CTRL_MODEL "Linux" +#define NVMET_MN_MAX_SIZE 40/* * Supported optional AENs:
Signature · 7 lines
2.18.2 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 9 lines · On 3/15/21 07:56, [email protected] wrote:
From: Noam Gottlieb <[email protected]>
According to the NVM specifications, the model number size should be 40 bytes (bytes 63:24 of the Identify Controller data structure). Therefore, any attempt to store a value into
model_numberwhich exceeds 40 bytes should return an error.Reviewed-by Max Gurtovoy <[email protected]>Signed-off-by Noam Gottlieb <[email protected]>
The patch looks good to me, but is this patch not intended for 5.13 ?
Since for 5.13 we have nvmet_subsys_attr_model_store_locked(), this patch uses nvmet_subsys_attr_model_store().
Is this a fix for 5.12-rc ?
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Sagi Grimberg
maintainerQuoted 9 lines
Quoted 8 lines
According to the NVM specifications, the model number size should be 40 bytes (bytes 63:24 of the Identify Controller data structure). Therefore, any attempt to store a value into
model_numberwhich exceeds 40 bytes should return an error.Reviewed-by Max Gurtovoy <[email protected]>Signed-off-by Noam Gottlieb <[email protected]>
Quoted 6 lines
The patch looks good to me, but is this patch not intended for 5.13 ?
Since for 5.13 we have
nvmet_subsys_attr_model_store_locked(), this patch usesnvmet_subsys_attr_model_store().Is this a fix for 5.12-rc ?
I think this patch can wait for 5.13 for sure, maybe needs a Fixes tag to help it get back to stable...
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Max,
Quoted 7 lines · Sagi Grimberg
Quoted 7 lines
Quoted 7 lines
According to the NVM specifications, the model number size should be 40 bytes (bytes 63:24 of the Identify Controller data structure). Therefore, any attempt to store a value into
model_numberwhich exceeds 40 bytes should return an error.Reviewed-by Max Gurtovoy <[email protected]>Signed-off-by Noam Gottlieb <[email protected]>
Quoted 9 lines
Quoted 6 lines
The patch looks good to me, but is this patch not intended for 5.13 ?
Since for 5.13 we have
nvmet_subsys_attr_model_store_locked(), this patch usesnvmet_subsys_attr_model_store().Is this a fix for 5.12-rc ?
I think this patch can wait for 5.13 for sure, maybe needs a Fixes tag to help it get back to stable...
That's what I thought, can you please respin unless there is a reason for this to be in 5.12 ?
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 15 lines · Chaitanya Kulkarni
Max,
Quoted 12 lines · Sagi Grimberg
Quoted 12 lines
Quoted 7 lines
According to the NVM specifications, the model number size should be 40 bytes (bytes 63:24 of the Identify Controller data structure). Therefore, any attempt to store a value into
model_numberwhich exceeds 40 bytes should return an error.Reviewed-by Max Gurtovoy <[email protected]>Signed-off-by Noam Gottlieb <[email protected]>The patch looks good to me, but is this patch not intended for 5.13 ?
Since for 5.13 we have
nvmet_subsys_attr_model_store_locked(), this patch usesnvmet_subsys_attr_model_store().
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Is this a fix for 5.12-rc ?
I think this patch can wait for 5.13 for sure, maybe needs a Fixes tag to help it get back to stable...
That's what I thought, can you please respin unless there is a reason for this to be in 5.12 ?
The function nvmet_subsys_attr_model_store_locked also exist in 5.12 and this patch applies on it.
I'm not sure it can't go to 5.12 but no problem we can re-spin it for 5.13.
I guess for Fixes tag we can use commit "013b7ebe5a0d70e nvmet: make ctrl model configurable" , right ?
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Sagi Grimberg
maintainerQuoted 2 lines
I guess for Fixes tag we can use commit "
013b7ebe5a0d70envmet: make ctrl model configurable" , right ?
Yes
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 8 lines · Max Gurtovoy
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Is this a fix for 5.12-rc ?
I think this patch can wait for 5.13 for sure, maybe needs a Fixes tag to help it get back to stable...
That's what I thought, can you please respin unless there is a reason for this to be in 5.12 ?
The function
nvmet_subsys_attr_model_store_lockedalso exist in 5.12 and this patch applies on it.
I see.
Quoted 4 lines
I'm not sure it can't go to 5.12 but no problem we can re-spin it for 5.13.
I guess for Fixes tag we can use commit "
013b7ebe5a0d70envmet: make ctrl model configurable" , right ?
Yes, except sha should be 12 digit 013b7ebe5a0d like :-
Quoted 1 line
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Thanks,
applied to nvme-5.13.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme