hw/9pfs: Fix segfault with 9p2000.u
When guest tries to chmod a block or char device file over 9pfs, the qemu process segfaults. With 9p2000.u protocol we use wstat to change mode bits and client don't send extension information for chmod. We need to check for size field to check whether extension info is present or not. Reported-by: Michael Tokarev <mjt@tls.msk.ru> Acked-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
This commit is contained in:
parent
371386fb60
commit
c7e587b73e
@ -658,7 +658,7 @@ static mode_t v9mode_to_mode(uint32_t mode, V9fsString *extension)
|
||||
ret |= S_IFIFO;
|
||||
}
|
||||
if (mode & P9_STAT_MODE_DEVICE) {
|
||||
if (extension && extension->data[0] == 'c') {
|
||||
if (extension->size && extension->data[0] == 'c') {
|
||||
ret |= S_IFCHR;
|
||||
} else {
|
||||
ret |= S_IFBLK;
|
||||
|
Loading…
Reference in New Issue
Block a user