]> 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 15:25:15 +0000 (15:25 +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 e4b8aa95abfd5be1d6eafc934a56f1515467b0b9..d3272e2ef9b536a93e4103a6c2f7c39e250e7db9 100644 (file)
@@ -180,7 +180,7 @@ int do_control(struct connection *conn, struct buffered_data *in)
        int cmd;
        char **vec;
 
-       if (conn->id != 0)
+       if (domain_is_unprivileged(conn))
                return EACCES;
 
        num = xs_count_strings(in->buffer, in->used);
index 1eb6131fc88d58262146c8bf66a07ffc2e58b3b3..98db4afcaabf613fe2885de1db3f7d7ac984e354 100644 (file)
@@ -93,7 +93,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 a read-only connection? */
index 6fbdb29dcdd71a804046f41c5b84efede665b38a..9bef6e72a56642b45014ed77ef0dd7bbb8c30bc3 100644 (file)
@@ -483,7 +483,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 */