* [PATCH] VMCI: Fix dereference before NULL-check of context ptr
@ 2020-03-16 16:18 Xiyu Yang
2020-03-16 17:45 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Xiyu Yang @ 2020-03-16 16:18 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman, Xiyu Yang, Xin Tan,
Kate Stewart, Allison Randal, Ira Weiny, Thomas Gleixner,
linux-kernel
Cc: yuanxzhang, kjlu
A NULL pointer can be returned by vmci_ctx_get(). Thus add a
corresponding check so that a NULL pointer dereference will
be avoided in vmci_ctx_put().
Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
---
drivers/misc/vmw_vmci/vmci_queue_pair.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c
index 032617101ebc..b6ba00ad9ec8 100644
--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
+++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
@@ -1808,7 +1808,8 @@ static int qp_alloc_host_work(struct vmci_handle *handle,
pr_devel("queue pair broker failed to alloc (result=%d)\n",
result);
}
- vmci_ctx_put(context);
+ if (context)
+ vmci_ctx_put(context);
return result;
}
--
2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] VMCI: Fix dereference before NULL-check of context ptr
2020-03-16 16:18 [PATCH] VMCI: Fix dereference before NULL-check of context ptr Xiyu Yang
@ 2020-03-16 17:45 ` Greg Kroah-Hartman
0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2020-03-16 17:45 UTC (permalink / raw)
To: Xiyu Yang
Cc: Arnd Bergmann, Xin Tan, Kate Stewart, Allison Randal, Ira Weiny,
Thomas Gleixner, linux-kernel, yuanxzhang, kjlu
On Tue, Mar 17, 2020 at 12:18:33AM +0800, Xiyu Yang wrote:
> A NULL pointer can be returned by vmci_ctx_get(). Thus add a
> corresponding check so that a NULL pointer dereference will
> be avoided in vmci_ctx_put().
>
> Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
> Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
> ---
> drivers/misc/vmw_vmci/vmci_queue_pair.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
You sent 2 different patches with the same subject, yet they did
different things :(
Please fix this up, make them unique, and send a patch series.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] VMCI: Fix dereference before NULL-check of context ptr
@ 2020-03-16 16:05 Xiyu Yang
0 siblings, 0 replies; 3+ messages in thread
From: Xiyu Yang @ 2020-03-16 16:05 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman, Ira Weiny, Andrew Morton,
Alexios Zavras, Mike Marshall, Xiyu Yang, Thomas Gleixner,
linux-kernel
Cc: yuanxzhang, kjlu, Xin Tan
A NULL pointer can be returned by vmci_ctx_get(). Thus add a
corresponding check so that a NULL pointer dereference will
be avoided in vmci_ctx_put().
Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
---
drivers/misc/vmw_vmci/vmci_queue_pair.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c
index 8531ae781195..032617101ebc 100644
--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
+++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
@@ -1859,7 +1859,8 @@ static int qp_detatch_host_work(struct vmci_handle handle)
result = vmci_qp_broker_detach(handle, context);
- vmci_ctx_put(context);
+ if (context)
+ vmci_ctx_put(context);
return result;
}
--
2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-16 17:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-16 16:18 [PATCH] VMCI: Fix dereference before NULL-check of context ptr Xiyu Yang
2020-03-16 17:45 ` Greg Kroah-Hartman
-- strict thread matches above, loose matches on Subject: below --
2020-03-16 16:05 Xiyu Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®