diff options
Diffstat (limited to 'drivers/misc/cxl/api.c')
-rw-r--r-- | drivers/misc/cxl/api.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c index f3d34b941f85..2e5233b60971 100644 --- a/drivers/misc/cxl/api.c +++ b/drivers/misc/cxl/api.c | |||
@@ -229,6 +229,14 @@ int cxl_start_context(struct cxl_context *ctx, u64 wed, | |||
229 | if (ctx->status == STARTED) | 229 | if (ctx->status == STARTED) |
230 | goto out; /* already started */ | 230 | goto out; /* already started */ |
231 | 231 | ||
232 | /* | ||
233 | * Increment the mapped context count for adapter. This also checks | ||
234 | * if adapter_context_lock is taken. | ||
235 | */ | ||
236 | rc = cxl_adapter_context_get(ctx->afu->adapter); | ||
237 | if (rc) | ||
238 | goto out; | ||
239 | |||
232 | if (task) { | 240 | if (task) { |
233 | ctx->pid = get_task_pid(task, PIDTYPE_PID); | 241 | ctx->pid = get_task_pid(task, PIDTYPE_PID); |
234 | ctx->glpid = get_task_pid(task->group_leader, PIDTYPE_PID); | 242 | ctx->glpid = get_task_pid(task->group_leader, PIDTYPE_PID); |
@@ -239,7 +247,10 @@ int cxl_start_context(struct cxl_context *ctx, u64 wed, | |||
239 | cxl_ctx_get(); | 247 | cxl_ctx_get(); |
240 | 248 | ||
241 | if ((rc = cxl_ops->attach_process(ctx, kernel, wed, 0))) { | 249 | if ((rc = cxl_ops->attach_process(ctx, kernel, wed, 0))) { |
250 | put_pid(ctx->glpid); | ||
242 | put_pid(ctx->pid); | 251 | put_pid(ctx->pid); |
252 | ctx->glpid = ctx->pid = NULL; | ||
253 | cxl_adapter_context_put(ctx->afu->adapter); | ||
243 | cxl_ctx_put(); | 254 | cxl_ctx_put(); |
244 | goto out; | 255 | goto out; |
245 | } | 256 | } |