summaryrefslogtreecommitdiffstats
path: root/drivers/misc/cxl/file.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2015-01-20 11:03:07 +0100
committerLinus Walleij <linus.walleij@linaro.org>2015-01-20 11:03:07 +0100
commitee65ef609aa81539ac3792df88f04bfe29a77546 (patch)
tree6816eaa3d45fa1078408f2ccfa5f88d32733d1d9 /drivers/misc/cxl/file.c
parentDocumentation: gpio: Add APM X-Gene standby GPIO controller DTS binding (diff)
parentLinux 3.19-rc5 (diff)
downloadlinux-ee65ef609aa81539ac3792df88f04bfe29a77546.tar.xz
linux-ee65ef609aa81539ac3792df88f04bfe29a77546.zip
Merge tag 'v3.19-rc5' into devel
Linux 3.19-rc5
Diffstat (limited to 'drivers/misc/cxl/file.c')
-rw-r--r--drivers/misc/cxl/file.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/misc/cxl/file.c b/drivers/misc/cxl/file.c
index e9f2f10dbb37..b15d8113877c 100644
--- a/drivers/misc/cxl/file.c
+++ b/drivers/misc/cxl/file.c
@@ -140,18 +140,20 @@ static long afu_ioctl_start_work(struct cxl_context *ctx,
pr_devel("%s: pe: %i\n", __func__, ctx->pe);
- mutex_lock(&ctx->status_mutex);
- if (ctx->status != OPENED) {
- rc = -EIO;
- goto out;
- }
-
+ /* Do this outside the status_mutex to avoid a circular dependency with
+ * the locking in cxl_mmap_fault() */
if (copy_from_user(&work, uwork,
sizeof(struct cxl_ioctl_start_work))) {
rc = -EFAULT;
goto out;
}
+ mutex_lock(&ctx->status_mutex);
+ if (ctx->status != OPENED) {
+ rc = -EIO;
+ goto out;
+ }
+
/*
* if any of the reserved fields are set or any of the unused
* flags are set it's invalid