[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1584951832-120773-1-git-send-email-xiyuyang19@fudan.edu.cn>
Date: Mon, 23 Mar 2020 16:22:33 +0800
From: Xiyu Yang <xiyuyang19@...an.edu.cn>
To: Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alexios Zavras <alexios.zavras@...el.com>,
Allison Randal <allison@...utok.net>,
Adit Ranadive <aditr@...are.com>,
Jorgen Hansen <jhansen@...are.com>,
Thomas Gleixner <tglx@...utronix.de>,
Vishnu DASA <vdasa@...are.com>,
Xiyu Yang <xiyuyang19@...an.edu.cn>,
linux-kernel@...r.kernel.org
Cc: yuanxzhang@...an.edu.cn, kjlu@....edu,
Xin Tan <tanxin.ctf@...il.com>
Subject: [PATCH v2] VMCI: Fix NULL pointer dereference on context ptr
A NULL vmci_ctx object may pass to vmci_ctx_put() from its callers.
Add a NULL check to prevent NULL pointer dereference.
Signed-off-by: Xiyu Yang <xiyuyang19@...an.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@...il.com>
---
drivers/misc/vmw_vmci/vmci_context.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/vmw_vmci/vmci_context.c b/drivers/misc/vmw_vmci/vmci_context.c
index 16695366ec92..2f4963ab51bd 100644
--- a/drivers/misc/vmw_vmci/vmci_context.c
+++ b/drivers/misc/vmw_vmci/vmci_context.c
@@ -494,7 +494,8 @@ static void ctx_free_ctx(struct kref *kref)
*/
void vmci_ctx_put(struct vmci_ctx *context)
{
- kref_put(&context->kref, ctx_free_ctx);
+ if (context)
+ kref_put(&context->kref, ctx_free_ctx);
}
/*
--
2.7.4
Powered by blists - more mailing lists