Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa6f4687 authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman
Browse files

drm/vmwgfx: fix memory leak when too many retries have occurred



[ Upstream commit 6b7c3b86f0b63134b2ab56508921a0853ffa687a ]

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: a9cd9c04 ("drm/vmwgfx: Add a check to handle host message failure")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Reviewed-by: default avatarDeepak Rawat <drawat@vmware.com>
Signed-off-by: default avatarDeepak Rawat <drawat@vmware.com>
Signed-off-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 923de016
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;