summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2019-06-24 09:39:59 -0700
committerThomas Hellstrom <thellstrom@vmware.com>2019-08-08 11:22:54 +0200
commit6b7c3b86f0b63134b2ab56508921a0853ffa687a (patch)
tree2d1c63d57abcf7ae63b81a4a5b08024cda989993 /drivers/gpu
parentf536579c148249505b388d525ac1866e080fd66a (diff)
downloadlinux-6b7c3b86f0b63134b2ab56508921a0853ffa687a.tar.bz2
drm/vmwgfx: fix memory leak when too many retries have occurred
Currently when too many retries have occurred there is a memory leak on the allocation for reply on the error return path. Fix this by kfree'ing reply before returning. Addresses-Coverity: ("Resource leak") Fixes: a9cd9c044aa9 ("drm/vmwgfx: Add a check to handle host message failure") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Deepak Rawat <drawat@vmware.com> Signed-off-by: Deepak Rawat <drawat@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_msg.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
index e4e09d47c5c0..59e9d05ab928 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
@@ -389,8 +389,10 @@ static int vmw_recv_msg(struct rpc_channel *channel, void **msg,
break;
}
- if (retries == RETRIES)
+ if (retries == RETRIES) {
+ kfree(reply);
return -EINVAL;
+ }
*msg_len = reply_len;
*msg = reply;