* [Xen-devel] [PATCH] tools/xenstore: fix a use after free problem in xenstored
@ 2020-03-24 10:12 Juergen Gross
2020-04-02 14:25 ` Jürgen Groß
0 siblings, 1 reply; 2+ messages in thread
From: Juergen Gross @ 2020-03-24 10:12 UTC (permalink / raw)
To: xen-devel; +Cc: Juergen Gross, Ian Jackson, Wei Liu
Commit 562a1c0f7ef3fb ("tools/xenstore: dont unlink connection object
twice") introduced a potential use after free problem in
domain_cleanup(): after calling talloc_unlink() for domain->conn
domain->conn is set to NULL. The problem is that domain is registered
as talloc child of domain->conn, so it might be freed by the
talloc_unlink() call.
Fixes: 562a1c0f7ef3fb ("tools/xenstore: dont unlink connection object twice")
Signed-off-by: Juergen Gross <jgross@suse.com>
---
tools/xenstore/xenstored_domain.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index baddaba5df..5858185211 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -214,6 +214,7 @@ static void domain_cleanup(void)
{
xc_dominfo_t dominfo;
struct domain *domain;
+ struct connection *conn;
int notify = 0;
again:
@@ -230,8 +231,10 @@ static void domain_cleanup(void)
continue;
}
if (domain->conn) {
- talloc_unlink(talloc_autofree_context(), domain->conn);
+ /* domain is a talloc child of domain->conn. */
+ conn = domain->conn;
domain->conn = NULL;
+ talloc_unlink(talloc_autofree_context(), conn);
notify = 0; /* destroy_domain() fires the watch */
goto again;
}
--
2.16.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Xen-devel] [PATCH] tools/xenstore: fix a use after free problem in xenstored
2020-03-24 10:12 [Xen-devel] [PATCH] tools/xenstore: fix a use after free problem in xenstored Juergen Gross
@ 2020-04-02 14:25 ` Jürgen Groß
0 siblings, 0 replies; 2+ messages in thread
From: Jürgen Groß @ 2020-04-02 14:25 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson, Wei Liu
Ping?
On 24.03.20 11:12, Juergen Gross wrote:
> Commit 562a1c0f7ef3fb ("tools/xenstore: dont unlink connection object
> twice") introduced a potential use after free problem in
> domain_cleanup(): after calling talloc_unlink() for domain->conn
> domain->conn is set to NULL. The problem is that domain is registered
> as talloc child of domain->conn, so it might be freed by the
> talloc_unlink() call.
>
> Fixes: 562a1c0f7ef3fb ("tools/xenstore: dont unlink connection object twice")
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
> tools/xenstore/xenstored_domain.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
> index baddaba5df..5858185211 100644
> --- a/tools/xenstore/xenstored_domain.c
> +++ b/tools/xenstore/xenstored_domain.c
> @@ -214,6 +214,7 @@ static void domain_cleanup(void)
> {
> xc_dominfo_t dominfo;
> struct domain *domain;
> + struct connection *conn;
> int notify = 0;
>
> again:
> @@ -230,8 +231,10 @@ static void domain_cleanup(void)
> continue;
> }
> if (domain->conn) {
> - talloc_unlink(talloc_autofree_context(), domain->conn);
> + /* domain is a talloc child of domain->conn. */
> + conn = domain->conn;
> domain->conn = NULL;
> + talloc_unlink(talloc_autofree_context(), conn);
> notify = 0; /* destroy_domain() fires the watch */
> goto again;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-02 14:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-24 10:12 [Xen-devel] [PATCH] tools/xenstore: fix a use after free problem in xenstored Juergen Gross
2020-04-02 14:25 ` Jürgen Groß
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).