Skip to content

Commit 93a6504

Browse files
Colin Ian Kinggregkh
authored andcommitted
drm/vmwgfx: fix memory leak when too many retries have occurred
[ Upstream commit 6b7c3b8 ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 73898d7 commit 93a6504

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
@@ -300,8 +300,10 @@ static int vmw_recv_msg(struct rpc_channel *channel, void **msg,
300300
break;
301301
}
302302

303-
if (retries == RETRIES)
303+
if (retries == RETRIES) {
304+
kfree(reply);
304305
return -EINVAL;
306+
}
305307

306308
*msg_len = reply_len;
307309
*msg = reply;

0 commit comments

Comments
 (0)