9pfs: fix potential segfault during walk
authorGreg Kurz <groug@kaod.org>
Fri, 16 Sep 2016 09:44:49 +0000 (11:44 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 20 Sep 2016 15:25:06 +0000 (10:25 -0500)
commit5e2c6fe7cc5314c13d96069328b603c40dc12b41
treefd2f300af529678e5eabda86833e7143ac5ab273
parentb9ab2f66716ad5bf18797e6844f6969e9a868633
9pfs: fix potential segfault during walk

If the call to fid_to_qid() returns an error, we will call v9fs_path_free()
on uninitialized paths.

It is a regression introduced by the following commit:

56f101ecce0e 9pfs: handle walk of ".." in the root directory

Let's fix this by initializing dpath and path before calling fid_to_qid().

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: C├ędric Le Goater <clg@kaod.org>
[groug: updated the changelog to indicate this is regression and to provide
        the offending commit SHA1]
Signed-off-by: Greg Kurz <groug@kaod.org>
(cherry picked from commit 13fd08e631ec0c3ff5ad1bdcb6a4474c7d9a024f)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/9pfs/9p.c