提交 5e2c6fe7 编写于 作者: G Greg Kurz 提交者: Michael Roth

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:

56f101ec 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: NGreg Kurz <groug@kaod.org>
Reviewed-by: NCé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: NGreg Kurz <groug@kaod.org>

(cherry picked from commit 13fd08e6)
Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
上级 b9ab2f66
...@@ -1318,13 +1318,14 @@ static void v9fs_walk(void *opaque) ...@@ -1318,13 +1318,14 @@ static void v9fs_walk(void *opaque)
goto out_nofid; goto out_nofid;
} }
v9fs_path_init(&dpath);
v9fs_path_init(&path);
err = fid_to_qid(pdu, fidp, &qid); err = fid_to_qid(pdu, fidp, &qid);
if (err < 0) { if (err < 0) {
goto out; goto out;
} }
v9fs_path_init(&dpath);
v9fs_path_init(&path);
/* /*
* Both dpath and path initially poin to fidp. * Both dpath and path initially poin to fidp.
* Needed to handle request with nwnames == 0 * Needed to handle request with nwnames == 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册