summaryrefslogtreecommitdiff
path: root/hw/usb
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2014-05-20 13:02:26 +0200
committerGerd Hoffmann <kraxel@redhat.com>2014-05-26 08:41:07 +0200
commit68206d734233f6d2500762b93d81674a6f0aa033 (patch)
treee615fd9af55abe4de461ace11cfc574016379940 /hw/usb
parent36084d7e31997d0f4aec67e05c2ef44de89bc4de (diff)
downloadqemu-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.c5
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) {