summaryrefslogtreecommitdiff
path: root/drivers/misc/cxl/file.c
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2015-01-19 18:57:20 +0300
committerFelipe Balbi <balbi@ti.com>2015-01-19 18:57:20 +0300
commitd1fc4440d761af47fd0c32661725011bf66ebb51 (patch)
treed2fdfe049eac9b45a9418bd1be103297b1c0c55e /drivers/misc/cxl/file.c
parentfe198e34a44ce7f27e39c303d62a754129938194 (diff)
parentec6f34e5b552fb0a52e6aae1a5afbbb1605cc6cc (diff)
downloadlinux-d1fc4440d761af47fd0c32661725011bf66ebb51.tar.xz
Merge tag 'v3.19-rc5' into next
Linux 3.19-rc5 Conflicts: drivers/usb/dwc2/gadget.c drivers/usb/gadget/udc/bdc/bdc_ep.c
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