]> Git Repo - J-linux.git/commitdiff
cxl/mbox: Fix missing variable payload checks in cmd size validation
authorVishal Verma <[email protected]>
Tue, 28 Jun 2022 22:01:09 +0000 (16:01 -0600)
committerDan Williams <[email protected]>
Wed, 29 Jun 2022 05:03:18 +0000 (22:03 -0700)
The conversion of command sizes to unsigned missed a couple of checks
against variable size payloads during command validation, which made all
variable payload commands unconditionally fail. Add the checks back using
the new CXL_VARIABLE_PAYLOAD scheme.

Fixes: 26f89535a5bb ("cxl/mbox: Use type __u32 for mailbox payload sizes")
Cc: <[email protected]>
Cc: Ira Weiny <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Alison Schofield <[email protected]>
Reported-by: Abhi Cs <[email protected]>
Reviewed-by: Dan Williams <[email protected]>
Reviewed-by: Alison Schofield <[email protected]>
Signed-off-by: Vishal Verma <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dan Williams <[email protected]>
drivers/cxl/core/mbox.c

index 54f434733b5623cc35d18c161479e40d8fc372b4..cbf23beebebefaf89df8bf7055b4ac765d5731b0 100644 (file)
@@ -355,11 +355,13 @@ static int cxl_to_mem_cmd(struct cxl_mem_command *mem_cmd,
                return -EBUSY;
 
        /* Check the input buffer is the expected size */
-       if (info->size_in != send_cmd->in.size)
+       if ((info->size_in != CXL_VARIABLE_PAYLOAD) &&
+           (info->size_in != send_cmd->in.size))
                return -ENOMEM;
 
        /* Check the output buffer is at least large enough */
-       if (send_cmd->out.size < info->size_out)
+       if ((info->size_out != CXL_VARIABLE_PAYLOAD) &&
+           (send_cmd->out.size < info->size_out))
                return -ENOMEM;
 
        *mem_cmd = (struct cxl_mem_command) {
This page took 0.052001 seconds and 4 git commands to generate.