From d0a7eee654cf31dcfd4582edf3fe2878108ab9f7 Mon Sep 17 00:00:00 2001 From: Srinivasarao Pathipati Date: Mon, 23 May 2022 17:27:20 +0530 Subject: [PATCH] haven: hh_rm_core: fix ID leaking Remove IDs from hh_rm_call_idr in failure paths of hh_rm_call(). Change-Id: I2e2817bdd22f570ebb299ceebed0677817815194 Signed-off-by: Srinivasarao Pathipati --- drivers/virt/haven/hh_rm_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/virt/haven/hh_rm_core.c b/drivers/virt/haven/hh_rm_core.c index 551397120848..2a66a690b9c5 100644 --- a/drivers/virt/haven/hh_rm_core.c +++ b/drivers/virt/haven/hh_rm_core.c @@ -644,14 +644,14 @@ void *hh_rm_call(hh_rm_msgid_t message_id, connection->recv_buff, connection->recv_buff_size, false); - mutex_lock(&hh_rm_call_idr_lock); - idr_remove(&hh_rm_call_idr, connection->seq); - mutex_unlock(&hh_rm_call_idr_lock); - ret = connection->recv_buff; *resp_buff_size = connection->recv_buff_size; out: + mutex_lock(&hh_rm_call_idr_lock); + idr_remove(&hh_rm_call_idr, connection->seq); + mutex_unlock(&hh_rm_call_idr_lock); + kfree(connection); return ret; }