[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen stable-4.14] tools/oxenstored: Fix quota calculation for mkdir EEXIST

commit 004be86c81b866365919292f98a5d6effa6f053c
Author:     Edwin Török <edvin.torok@xxxxxxxxxx>
AuthorDate: Fri Jan 15 19:11:32 2021 +0000
Commit:     Ian Jackson <iwj@xxxxxxxxxxxxxx>
CommitDate: Fri Mar 19 13:43:36 2021 +0000

    tools/oxenstored: Fix quota calculation for mkdir EEXIST
    We increment the domain's quota on mkdir even when the node already exists.
    This results in a quota inconsistency after live update, where 
    the tree from scratch results in a different quota.
    Not a security issue because the domain uses up quota faster, so it will 
    get a Quota error sooner than it should.
    Found by the structured fuzzer.
    Signed-off-by: Edwin Török <edvin.torok@xxxxxxxxxx>
    Acked-by: Christian Lindig <christian.lindig@xxxxxxxxxx>
    Release-Acked-by: Ian Jackson <iwj@xxxxxxxxxxxxxx>
    (cherry picked from commit c8b96708252a436da44005307f7c195d699bd7c5)
 tools/ocaml/xenstored/store.ml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/ocaml/xenstored/store.ml b/tools/ocaml/xenstored/store.ml
index e20767372f..328d3a5198 100644
--- a/tools/ocaml/xenstored/store.ml
+++ b/tools/ocaml/xenstored/store.ml
@@ -421,6 +421,7 @@ let mkdir store perm path =
        (* It's upt to the mkdir logic to decide what to do with existing path 
        if not (existing || (Perms.Connection.is_dom0 perm)) then Quota.check 
store.quota owner 0;
        store.root <- path_mkdir store perm path;
+       if not existing then
        Quota.add_entry store.quota owner
 let rm store perm path =
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.