From 206c546d6015fe3809b8e52ea95f56114b8e9f25 Mon Sep 17 00:00:00 2001 From: Pan Liu Date: Sat, 12 Nov 2016 23:26:57 +0800 Subject: [PATCH] rbd: fix crash with zero sized image When the user create a rbd image with size zero, and specify the "size" larger than zero in fio option, rbd will crash. Signed-off-by: Pan Liu Signed-off-by: Jens Axboe --- engines/rbd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engines/rbd.c b/engines/rbd.c index aa50c801..ee2ce813 100644 --- a/engines/rbd.c +++ b/engines/rbd.c @@ -595,7 +595,12 @@ static int fio_rbd_setup(struct thread_data *td) if (r < 0) { log_err("rbd_status failed.\n"); goto disconnect; + } else if (info.size == 0) { + log_err("image size should be larger than zero.\n"); + r = -EINVAL; + goto disconnect; } + dprint(FD_IO, "rbd-engine: image size: %lu\n", info.size); /* taken from "net" engine. Pretend we deal with files, -- 2.25.1