Skip to content

Commit 8fe4345

Browse files
Frederic Barratgregkh
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: 0712dc7 ("cxl: Fix issues when unmapping contexts") Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com> Reviewed-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com> Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f0d2e15 commit 8fe4345

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

drivers/misc/cxl/file.c

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

159159
/* Do this outside the status_mutex to avoid a circular dependency with
160160
* the locking in cxl_mmap_fault() */
161-
if (copy_from_user(&work, uwork,
162-
sizeof(struct cxl_ioctl_start_work))) {
163-
rc = -EFAULT;
164-
goto out;
165-
}
161+
if (copy_from_user(&work, uwork, sizeof(work)))
162+
return -EFAULT;
166163

167164
mutex_lock(&ctx->status_mutex);
168165
if (ctx->status != OPENED) {

0 commit comments

Comments
 (0)