From: Dongli Zhang Date: Wed, 23 Jan 2019 07:47:33 +0000 (+0800) Subject: xen/blkback: do not BUG() for invalid blkif_request from frontend X-Git-Tag: v4.1.12-124.31.3~305 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5c82f4267ebdbf72fffbd94b403add2a7647677b;p=users%2Fjedix%2Flinux-maple.git xen/blkback: do not BUG() for invalid blkif_request from frontend Upstream commit 0e367ae46503 ("xen/blkback: correctly respond to unknown, non-native requests") fixed a bug to correctly respond to unknown, non-native requests, e.g., BLKIF_OP_RESERVED_1 or BLKIF_OP_PACKET for 64-bit SLES 11 guests when using a 32-bit backend. Although such fix is already in uek4, it is broken by commit f0af2f840606 ("xen-blkback: move indirect req allocation out-of-line") that introduced the BUG() again. This patch removes the BUG() to avoid panic backend by invalid blkif_request from frontend. Orabug: 29199843 Fixes: f0af2f840606 ("xen-blkback: move indirect req allocation out-of-line") Signed-off-by: Dongli Zhang Reviewed-by: Joe Jin Reviewed-by: Ankur Arora Signed-off-by: Brian Maly --- diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 28ecd79ba1572..34067af643d27 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -1254,26 +1254,28 @@ __do_block_io_op(struct xen_blkif_ring *ring) */ down_read(&ring->blkif->vbd_lock); - if (likely(valid_req)) { - switch (req.operation) { - case BLKIF_OP_READ: - case BLKIF_OP_WRITE: - case BLKIF_OP_WRITE_BARRIER: - case BLKIF_OP_FLUSH_DISKCACHE: - case BLKIF_OP_INDIRECT: - if (dispatch_rw_block_io(ring, &req, pending_req)) - goto done; - break; - case BLKIF_OP_DISCARD: - if (dispatch_discard_io(ring, &req)) - goto done; - break; - default: - BUG(); - } - } else { + if (unlikely(!valid_req)) { + if (dispatch_other_io(ring, &req)) + goto done; + } + + switch (req.operation) { + case BLKIF_OP_READ: + case BLKIF_OP_WRITE: + case BLKIF_OP_WRITE_BARRIER: + case BLKIF_OP_FLUSH_DISKCACHE: + case BLKIF_OP_INDIRECT: + if (dispatch_rw_block_io(ring, &req, pending_req)) + goto done; + break; + case BLKIF_OP_DISCARD: + if (dispatch_discard_io(ring, &req)) + goto done; + break; + default: if (dispatch_other_io(ring, &req)) goto done; + break; } /* Yield point for this unbounded loop. */