diff options
author | Gerd Hoffmann | 2014-05-20 13:02:26 +0200 |
---|---|---|
committer | Gerd Hoffmann | 2014-05-26 08:41:07 +0200 |
commit | 68206d734233f6d2500762b93d81674a6f0aa033 (patch) | |
tree | e615fd9af55abe4de461ace11cfc574016379940 /hw/usb | |
parent | usb-mtp: use bool to track MTPObject init status (diff) | |
download | qemu-68206d734233f6d2500762b93d81674a6f0aa033.tar.gz qemu-68206d734233f6d2500762b93d81674a6f0aa033.tar.xz qemu-68206d734233f6d2500762b93d81674a6f0aa033.zip |
usb-mtp: handle lseek failure
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb')
-rw-r--r-- | hw/usb/dev-mtp.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index c2750e4bd2..a95298bd34 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -702,7 +702,10 @@ static MTPData *usb_mtp_get_partial_object(MTPState *s, MTPControl *c, if (offset > o->stat.st_size) { offset = o->stat.st_size; } - lseek(d->fd, offset, SEEK_SET); + if (lseek(d->fd, offset, SEEK_SET) < 0) { + usb_mtp_data_free(d); + return NULL; + } d->length = c->argv[2]; if (d->length > o->stat.st_size - offset) { |