Skip to content

Commit e35f571

Browse files
stellarhopperdjbw
authored andcommitted
cxl/mbox: Fix missing variable payload checks in cmd size validation
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: 26f8953 ("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]>
1 parent f50974e commit e35f571

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/cxl/core/mbox.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,13 @@ static int cxl_to_mem_cmd(struct cxl_mem_command *mem_cmd,
355355
return -EBUSY;
356356

357357
/* Check the input buffer is the expected size */
358-
if (info->size_in != send_cmd->in.size)
358+
if ((info->size_in != CXL_VARIABLE_PAYLOAD) &&
359+
(info->size_in != send_cmd->in.size))
359360
return -ENOMEM;
360361

361362
/* Check the output buffer is at least large enough */
362-
if (send_cmd->out.size < info->size_out)
363+
if ((info->size_out != CXL_VARIABLE_PAYLOAD) &&
364+
(send_cmd->out.size < info->size_out))
363365
return -ENOMEM;
364366

365367
*mem_cmd = (struct cxl_mem_command) {

0 commit comments

Comments
 (0)