Skip to content

Commit 6b7c3b8

Browse files
Colin Ian Kingthomashvmw
authored andcommitted
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: a9cd9c0 ("drm/vmwgfx: Add a check to handle host message failure") Signed-off-by: Colin Ian King <[email protected]> Reviewed-by: Deepak Rawat <[email protected]> Signed-off-by: Deepak Rawat <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]>
1 parent f536579 commit 6b7c3b8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/gpu/drm/vmwgfx/vmwgfx_msg.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,10 @@ static int vmw_recv_msg(struct rpc_channel *channel, void **msg,
389389
break;
390390
}
391391

392-
if (retries == RETRIES)
392+
if (retries == RETRIES) {
393+
kfree(reply);
393394
return -EINVAL;
395+
}
394396

395397
*msg_len = reply_len;
396398
*msg = reply;

0 commit comments

Comments
 (0)