summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
diff options
context:
space:
mode:
authorSinclair Yeh <syeh@vmware.com>2016-06-29 16:31:01 -0700
committerSinclair Yeh <syeh@vmware.com>2016-07-01 10:47:47 -0700
commita9cd9c044aa90ba2b31d1bf3e3432f38fb1d25fe (patch)
tree48027336cfde7b01894711086e59caa183156594 /drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
parent81e257e964268d050f8e9188becd44d50f241d72 (diff)
drm/vmwgfx: Add a check to handle host message failure
Discovered by static code analysis tool. If for some reason communication with the host fails more than preset number of retries, return an error instead of return garbage. Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_msg.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_msg.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
index f0374f9b56ca..e57a0bad7a62 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
@@ -300,6 +300,9 @@ static int vmw_recv_msg(struct rpc_channel *channel, void **msg,
break;
}
+ if (retries == RETRIES)
+ return -EINVAL;
+
*msg_len = reply_len;
*msg = reply;