Skip to content

Commit 52c30ae

Browse files
Frederic BarratLee Jones
authored andcommitted
cxl: Fix error path on bad ioctl
commit cec422c11caeeccae709e9942058b6b644ce434c upstream. Fix error path if we can't copy user structure on CXL_IOCTL_START_WORK ioctl. We shouldn't unlock the context status mutex as it was not locked (yet). Fixes: 0712dc7e73e5 ("cxl: Fix issues when unmapping contexts") Signed-off-by: Frederic Barrat <[email protected]> Reviewed-by: Vaibhav Jain <[email protected]> Reviewed-by: Andrew Donnellan <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Lee Jones <[email protected]> Change-Id: I89526602b62553fa6963435261ef93467d03bb3a
1 parent 87f8e27 commit 52c30ae

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/misc/cxl/file.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,8 @@ static long afu_ioctl_start_work(struct cxl_context *ctx,
142142

143143
/* Do this outside the status_mutex to avoid a circular dependency with
144144
* the locking in cxl_mmap_fault() */
145-
if (copy_from_user(&work, uwork,
146-
sizeof(struct cxl_ioctl_start_work))) {
147-
rc = -EFAULT;
148-
goto out;
149-
}
145+
if (copy_from_user(&work, uwork, sizeof(work)))
146+
return -EFAULT;
150147

151148
mutex_lock(&ctx->status_mutex);
152149
if (ctx->status != OPENED) {

0 commit comments

Comments
 (0)