From ef8c4423d8faf324a4a58a7d1d16114d183c7f27 Mon Sep 17 00:00:00 2001 From: Robert Breker Date: Sun, 4 Oct 2015 23:07:55 +0000 Subject: [PATCH] Prevent discard requests from going beyond the disk size (to be squashed) Signed-off-by: Robert Breker --- drivers/tapdisk-image.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tapdisk-image.c b/drivers/tapdisk-image.c index eac7cdd1..b9732037 100644 --- a/drivers/tapdisk-image.c +++ b/drivers/tapdisk-image.c @@ -143,6 +143,7 @@ tapdisk_image_check_request(td_image_t *image, td_vbd_request_t *vreq) switch (vreq->op) { case TD_OP_DISCARD: + secs = vreq->discard_nr_sectors; /* fall through */ case TD_OP_WRITE: if (rdonly) {