diff options
author | Kevin Wolf <mail@kevin-wolf.de> | 2010-09-10 12:27:02 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2010-09-13 14:34:56 +0200 |
commit | 1b191088aed81f1b3661b1554f98a038872a9423 (patch) | |
tree | f541031a6b025c40817ae3e1d1178467cf856690 | |
parent | 2c25b8131631c39145fe1f5b7745943e0e0c0406 (diff) | |
download | qemu-1b191088aed81f1b3661b1554f98a038872a9423.zip qemu-1b191088aed81f1b3661b1554f98a038872a9423.tar.gz qemu-1b191088aed81f1b3661b1554f98a038872a9423.tar.bz2 |
vvfat: Fix segfault on write to read-only disk
vvfat tries to set the readonly flag in its open function, but nowadays
this is overwritted with the readonly=... command line option. Check in
bdrv_write if the vvfat was opened read-only and return an error in this
case.
Without this check, vvfat tries to access the qcow bs, which is NULL
without enabled write support.
Signed-off-by: Kevin Wolf <mail@kevin-wolf.de>
(cherry picked from commit bfd0049440f53745d31eb93c208f0f3ab6308027)
-rw-r--r-- | block/vvfat.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/block/vvfat.c b/block/vvfat.c index 365332a..5898d66 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -2665,6 +2665,11 @@ static int vvfat_write(BlockDriverState *bs, int64_t sector_num, DLOG(checkpoint()); + /* Check if we're operating in read-only mode */ + if (s->qcow == NULL) { + return -EACCES; + } + vvfat_close_current_file(s); /* |