usb-mtp: add sanity checks on rootdir
commite4c1c64112565a9be50008e6f28dbc41b53da740
authorBandan Das <bsd@redhat.com>
Wed, 28 Aug 2019 12:49:28 +0000 (28 08:49 -0400)
committerGerd Hoffmann <kraxel@redhat.com>
Thu, 29 Aug 2019 05:31:12 +0000 (29 07:31 +0200)
treeb2d6ad76ba9f9e5937a654ba141735ca1a031a2e
parent7cec2ed9d7aeeb6f873188b96c9f8ae17ab88da1
usb-mtp: add sanity checks on rootdir

Currently, we don't check if rootdir exists and is accessible.
Furthermore, a trailing slash results in a null "desc" string which
ends up in the share not visible in the guest. Add some simple
sanity checks for appropriate permissions. Also, bail out if the
user does not supply an absolute path.

Signed-off-by: Bandan Das <bsd@redhat.com>
Message-id: jpga7bto3on.fsf@linux.bootlegged.copy
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/dev-mtp.c