aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/cxl/fault.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/cxl/fault.c')
-rw-r--r--drivers/misc/cxl/fault.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/drivers/misc/cxl/fault.c b/drivers/misc/cxl/fault.c
index 5286b8b704f5..25a5418c55cb 100644
--- a/drivers/misc/cxl/fault.c
+++ b/drivers/misc/cxl/fault.c
@@ -172,8 +172,8 @@ void cxl_handle_fault(struct work_struct *fault_work)
172 container_of(fault_work, struct cxl_context, fault_work); 172 container_of(fault_work, struct cxl_context, fault_work);
173 u64 dsisr = ctx->dsisr; 173 u64 dsisr = ctx->dsisr;
174 u64 dar = ctx->dar; 174 u64 dar = ctx->dar;
175 struct task_struct *task; 175 struct task_struct *task = NULL;
176 struct mm_struct *mm; 176 struct mm_struct *mm = NULL;
177 177
178 if (cxl_p2n_read(ctx->afu, CXL_PSL_DSISR_An) != dsisr || 178 if (cxl_p2n_read(ctx->afu, CXL_PSL_DSISR_An) != dsisr ||
179 cxl_p2n_read(ctx->afu, CXL_PSL_DAR_An) != dar || 179 cxl_p2n_read(ctx->afu, CXL_PSL_DAR_An) != dar ||
@@ -194,17 +194,19 @@ void cxl_handle_fault(struct work_struct *fault_work)
194 pr_devel("CXL BOTTOM HALF handling fault for afu pe: %i. " 194 pr_devel("CXL BOTTOM HALF handling fault for afu pe: %i. "
195 "DSISR: %#llx DAR: %#llx\n", ctx->pe, dsisr, dar); 195 "DSISR: %#llx DAR: %#llx\n", ctx->pe, dsisr, dar);
196 196
197 if (!(task = get_pid_task(ctx->pid, PIDTYPE_PID))) { 197 if (!ctx->kernel) {
198 pr_devel("cxl_handle_fault unable to get task %i\n", 198 if (!(task = get_pid_task(ctx->pid, PIDTYPE_PID))) {
199 pid_nr(ctx->pid)); 199 pr_devel("cxl_handle_fault unable to get task %i\n",
200 cxl_ack_ae(ctx); 200 pid_nr(ctx->pid));
201 return; 201 cxl_ack_ae(ctx);
202 } 202 return;
203 if (!(mm = get_task_mm(task))) { 203 }
204 pr_devel("cxl_handle_fault unable to get mm %i\n", 204 if (!(mm = get_task_mm(task))) {
205 pid_nr(ctx->pid)); 205 pr_devel("cxl_handle_fault unable to get mm %i\n",
206 cxl_ack_ae(ctx); 206 pid_nr(ctx->pid));
207 goto out; 207 cxl_ack_ae(ctx);
208 goto out;
209 }
208 } 210 }
209 211
210 if (dsisr & CXL_PSL_DSISR_An_DS) 212 if (dsisr & CXL_PSL_DSISR_An_DS)
@@ -214,9 +216,11 @@ void cxl_handle_fault(struct work_struct *fault_work)
214 else 216 else
215 WARN(1, "cxl_handle_fault has nothing to handle\n"); 217 WARN(1, "cxl_handle_fault has nothing to handle\n");
216 218
217 mmput(mm); 219 if (mm)
220 mmput(mm);
218out: 221out:
219 put_task_struct(task); 222 if (task)
223 put_task_struct(task);
220} 224}
221 225
222static void cxl_prefault_one(struct cxl_context *ctx, u64 ea) 226static void cxl_prefault_one(struct cxl_context *ctx, u64 ea)