소스 검색

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>
Sinclair Yeh 9 년 전
부모
커밋
a9cd9c044a
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      drivers/gpu/drm/vmwgfx/vmwgfx_msg.c

+ 3 - 0
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;