]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xen/blkback: do not BUG() for invalid blkif_request from frontend
authorDongli Zhang <dongli.zhang@oracle.com>
Wed, 23 Jan 2019 07:47:33 +0000 (15:47 +0800)
committerBrian Maly <brian.maly@oracle.com>
Wed, 30 Jan 2019 04:09:57 +0000 (23:09 -0500)
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 <dongli.zhang@oracle.com>
Reviewed-by: Joe Jin <joe.jin@oracle.com>
Reviewed-by: Ankur Arora <ankur.a.arora@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/block/xen-blkback/blkback.c

index 28ecd79ba157274dfe6f97009dd5adcc90986ca1..34067af643d27c81203885448018dd22904ce72f 100644 (file)
@@ -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. */