OSDN Git Service

9p: Treat multiple devices on one export as an error
authorAntonios Motakis <antonios.motakis@huawei.com>
Thu, 10 Oct 2019 09:36:05 +0000 (11:36 +0200)
committerGreg Kurz <groug@kaod.org>
Thu, 10 Oct 2019 09:36:05 +0000 (11:36 +0200)
commit3b5ee9e86b68fff5db5f68499311239485776ea9
tree9c3407e38aaf2604bb2e846170dce6f782b7f15c
parentea52cdd443840448c198fec48e5a9ea5f40564f0
9p: Treat multiple devices on one export as an error

The QID path should uniquely identify a file. However, the
inode of a file is currently used as the QID path, which
on its own only uniquely identifies files within a device.
Here we track the device hosting the 9pfs share, in order
to prevent security issues with QID path collisions from
other devices.

We only print a warning for now but a subsequent patch will
allow users to have finer control over the desired behaviour.
Failing the I/O will be one the proposed behaviour, so we
also change stat_to_qid() to return an error here in order to
keep other patches simpler.

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
[CS: - Assign dev_id to export root's device already in
       v9fs_device_realize_common(), not postponed in
       stat_to_qid().
     - error_report_once() if more than one device was
       shared by export.
     - Return -ENODEV instead of -ENOSYS in stat_to_qid().
     - Fixed typo in log comment. ]
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
[groug, changed to warning, updated message and changelog]
Signed-off-by: Greg Kurz <groug@kaod.org>
hw/9pfs/9p.c
hw/9pfs/9p.h