]> xenbits.xensource.com Git - xen.git/commitdiff
tools/xenstore: fix connection->id usage
authorJuergen Gross <jgross@suse.com>
Tue, 13 Sep 2022 05:35:08 +0000 (07:35 +0200)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 1 Nov 2022 14:07:24 +0000 (14:07 +0000)
Don't use conn->id for privilege checks, but domain_is_unprivileged().

This is part of XSA-326.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
(cherry picked from commit 3047df38e1991510bc295e3e1bb6b6b6c4a97831)

tools/xenstore/xenstored_control.c
tools/xenstore/xenstored_core.h
tools/xenstore/xenstored_transaction.c

index 7b4300ef777716388ad33a321a5b43cbf291b6c8..adb8d51b043b4a167890ac7dbd920e493500d0f2 100644 (file)
@@ -891,7 +891,7 @@ int do_control(struct connection *conn, struct buffered_data *in)
        unsigned int cmd, num, off;
        char **vec = NULL;
 
-       if (conn->id != 0)
+       if (domain_is_unprivileged(conn))
                return EACCES;
 
        off = get_string(in, 0);
index b9b50e81c7b4f66f59f5e296b1a55d67b24b015b..b1a70488b98904bae24f5639316372a1a186fb1b 100644 (file)
@@ -123,7 +123,7 @@ struct connection
        /* The index of pollfd in global pollfd array */
        int pollfd_idx;
 
-       /* Who am I? 0 for socket connections. */
+       /* Who am I? Domid of connection. */
        unsigned int id;
 
        /* Is this connection ignored? */
index 54432907fc76fe3d78ff0e0d1db797a4f703bb20..ee1b09031a3b4d6e820b15f25ccc54a68166f50c 100644 (file)
@@ -477,7 +477,8 @@ int do_transaction_start(struct connection *conn, struct buffered_data *in)
        if (conn->transaction)
                return EBUSY;
 
-       if (conn->id && conn->transaction_started > quota_max_transaction)
+       if (domain_is_unprivileged(conn) &&
+           conn->transaction_started > quota_max_transaction)
                return ENOSPC;
 
        /* Attach transaction to input for autofree until it's complete */