Commit 50e3950d77ba7d897c5509ca6192f1aaed426dd0
Committed by
Greg Kroah-Hartman
1 parent
e0d5bb92c0
Exists in
smarct4x-processor-sdk-04.01.00.06
and in
1 other branch
drm/msm: Put back the vaddr in submit_reloc()
[ Upstream commit 6490abc4bc35fa4f3bdb9c7e49096943c50e29ea ] The error cases in submit_reloc() need to put back the virtual address of the bo before failling. Add a single failure path for the function. Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org> Signed-off-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 9 additions and 6 deletions Side-by-side Diff
drivers/gpu/drm/msm/msm_gem_submit.c
... | ... | @@ -290,7 +290,7 @@ |
290 | 290 | { |
291 | 291 | uint32_t i, last_offset = 0; |
292 | 292 | uint32_t *ptr; |
293 | - int ret; | |
293 | + int ret = 0; | |
294 | 294 | |
295 | 295 | if (offset % 4) { |
296 | 296 | DRM_ERROR("non-aligned cmdstream buffer: %u\n", offset); |
297 | 297 | |
... | ... | @@ -317,12 +317,13 @@ |
317 | 317 | |
318 | 318 | ret = copy_from_user(&submit_reloc, userptr, sizeof(submit_reloc)); |
319 | 319 | if (ret) |
320 | - return -EFAULT; | |
320 | + goto out; | |
321 | 321 | |
322 | 322 | if (submit_reloc.submit_offset % 4) { |
323 | 323 | DRM_ERROR("non-aligned reloc offset: %u\n", |
324 | 324 | submit_reloc.submit_offset); |
325 | - return -EINVAL; | |
325 | + ret = -EINVAL; | |
326 | + goto out; | |
326 | 327 | } |
327 | 328 | |
328 | 329 | /* offset in dwords: */ |
329 | 330 | |
... | ... | @@ -331,12 +332,13 @@ |
331 | 332 | if ((off >= (obj->base.size / 4)) || |
332 | 333 | (off < last_offset)) { |
333 | 334 | DRM_ERROR("invalid offset %u at reloc %u\n", off, i); |
334 | - return -EINVAL; | |
335 | + ret = -EINVAL; | |
336 | + goto out; | |
335 | 337 | } |
336 | 338 | |
337 | 339 | ret = submit_bo(submit, submit_reloc.reloc_idx, NULL, &iova, &valid); |
338 | 340 | if (ret) |
339 | - return ret; | |
341 | + goto out; | |
340 | 342 | |
341 | 343 | if (valid) |
342 | 344 | continue; |
343 | 345 | |
... | ... | @@ -353,9 +355,10 @@ |
353 | 355 | last_offset = off; |
354 | 356 | } |
355 | 357 | |
358 | +out: | |
356 | 359 | msm_gem_put_vaddr_locked(&obj->base); |
357 | 360 | |
358 | - return 0; | |
361 | + return ret; | |
359 | 362 | } |
360 | 363 | |
361 | 364 | static void submit_cleanup(struct msm_gem_submit *submit) |