[PATCH] nvme: validate maxcmd before use it

Hannes Reinecke hare at suse.de
Fri Dec 15 04:30:48 PST 2023


On 12/15/23 09:43, Guixin Liu wrote:
> According to the NVMe specification, if the 'maximum outstanding
> commands' (maxcmd) field is not utilized, it must be set to 0h.
> When a host connects to a target that does not employ the maxcmd
> field, the queue size (sqsize) gets set to an excessively large
> value due to the calculation (u16)(0 - 1) = 65535.
> As a result, such a misconfiguration leads to the failure of the
> connection establishment.
> 
> Signed-off-by: Guixin Liu <kanie at linux.alibaba.com>
> ---
>   drivers/nvme/host/fc.c   | 3 ++-
>   drivers/nvme/host/rdma.c | 3 ++-
>   drivers/nvme/host/tcp.c  | 3 ++-
>   3 files changed, 6 insertions(+), 3 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare at suse.de>

Cheers,

Hannes





More information about the Linux-nvme mailing list