summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-11-09 10:54:10 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-11-09 10:54:10 +0000
commit160e5c22e55b3f775c2003dfc626fa872ee4a7a1 (patch)
treebd6d3255d4b23ed41a9b3aa9fe2200df55b463c1
parentd3c2bbb166f8cd840a3f4efec31d55485f1360ed (diff)
parent5b76ef50f62079a2389ba28cacaf6cce68b1a0ed (diff)
downloadfocaccia-qemu-160e5c22e55b3f775c2003dfc626fa872ee4a7a1.tar.gz
focaccia-qemu-160e5c22e55b3f775c2003dfc626fa872ee4a7a1.zip
Merge remote-tracking branch 'remotes/gkurz/tags/for-upstream' into staging
Fixes a potential use-after-free issue that could be triggered by a
misbehaving guest.

# gpg: Signature made Thu 08 Nov 2018 20:36:48 GMT
# gpg:                using RSA key 71D4D5E5822F73D6
# gpg: Good signature from "Greg Kurz <groug@kaod.org>"
# gpg:                 aka "Gregory Kurz <gregory.kurz@free.fr>"
# gpg:                 aka "[jpeg image of size 3330]"
# Primary key fingerprint: B482 8BAF 9431 40CE F2A3  4910 71D4 D5E5 822F 73D6

* remotes/gkurz/tags/for-upstream:
  9p: write lock path in v9fs_co_open2()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/9pfs/cofile.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/9pfs/cofile.c b/hw/9pfs/cofile.c
index 88791bc327..9c22837cda 100644
--- a/hw/9pfs/cofile.c
+++ b/hw/9pfs/cofile.c
@@ -140,10 +140,10 @@ int coroutine_fn v9fs_co_open2(V9fsPDU *pdu, V9fsFidState *fidp,
     cred.fc_gid = gid;
     /*
      * Hold the directory fid lock so that directory path name
-     * don't change. Read lock is fine because this fid cannot
-     * be used by any other operation.
+     * don't change. Take the write lock to be sure this fid
+     * cannot be used by another operation.
      */
-    v9fs_path_read_lock(s);
+    v9fs_path_write_lock(s);
     v9fs_co_run_in_worker(
         {
             err = s->ops->open2(&s->ctx, &fidp->path,