[PATCH 4.13 092/110] etnaviv: fix submit error path

From: Greg Kroah-Hartman
Date: Tue Oct 03 2017 - 08:39:47 EST


4.13-stable review patch. If anyone has any objections, please let me know.

------------------

From: Lucas Stach <l.stach@xxxxxxxxxxxxxx>

commit 5a642e6bc49f59922e19ebd639e74f72753fc77b upstream.

If the gpu submit fails, bail out to avoid accessing a potentially
unititalized fence.

Signed-off-by: Lucas Stach <l.stach@xxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
@@ -445,8 +445,10 @@ int etnaviv_ioctl_gem_submit(struct drm_
cmdbuf->user_size = ALIGN(args->stream_size, 8);

ret = etnaviv_gpu_submit(gpu, submit, cmdbuf);
- if (ret == 0)
- cmdbuf = NULL;
+ if (ret)
+ goto out;
+
+ cmdbuf = NULL;

if (args->flags & ETNA_SUBMIT_FENCE_FD_OUT) {
/*