if the request has some misaligned buffers in-between. After all why would we crash the host if one of the guests is crazy.
https://virtuozzo.atlassian.net/browse/VSTOR-134034 Signed-off-by: Andrey Zhadchenko <[email protected]> --- drivers/vhost/blk.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/blk.c b/drivers/vhost/blk.c index 34edfe0934598..54df32be14953 100644 --- a/drivers/vhost/blk.c +++ b/drivers/vhost/blk.c @@ -338,7 +338,11 @@ static int vhost_blk_bio_make(struct vhost_blk_req *req, nr_pages = bio_iov_vecs_to_alloc(&iter, BIO_MAX_VECS); do { /* We can't handle next bio if it's start is not sector aligned */ - BUG_ON(pos & SECTOR_MASK); + if (pos & SECTOR_MASK) { + WARN_ONCE(1, "vhost-blk: guest provided unaligned buffers"); + ret = -EINVAL; + goto err_bio; + } bio = bio_alloc(bdev, nr_pages, req->bi_opf, GFP_KERNEL); if (!bio) { -- 2.43.5 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
