diff options
author | David Vrabel <david.vrabel@citrix.com> | 2013-03-07 12:32:01 -0500 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2013-03-11 13:54:28 -0400 |
commit | 0e367ae46503cfe7791460c8ba8434a5d60b2bd5 (patch) | |
tree | f3056dc8de11ab4431cb227f4417af810c7f31e9 /include/xen | |
parent | a72d9002f80bffd7e4c7d60e5a9caa0cddffe894 (diff) |
xen/blkback: correctly respond to unknown, non-native requests
If the frontend is using a non-native protocol (e.g., a 64-bit
frontend with a 32-bit backend) and it sent an unrecognized request,
the request was not translated and the response would have the
incorrect ID. This may cause the frontend driver to behave
incorrectly or crash.
Since the ID field in the request is always in the same place,
regardless of the request type we can get the correct ID and make a
valid response (which will report BLKIF_RSP_EOPNOTSUPP).
This bug affected 64-bit SLES 11 guests when using a 32-bit backend.
This guest does a BLKIF_OP_RESERVED_1 (BLKIF_OP_PACKET in the SLES
source) and would crash in blkif_int() as the ID in the response would
be invalid.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Cc: stable@vger.kernel.org
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'include/xen')
-rw-r--r-- | include/xen/interface/io/blkif.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h index 01c3d62436ef..ffd4652de91c 100644 --- a/include/xen/interface/io/blkif.h +++ b/include/xen/interface/io/blkif.h | |||
@@ -138,11 +138,21 @@ struct blkif_request_discard { | |||
138 | uint8_t _pad3; | 138 | uint8_t _pad3; |
139 | } __attribute__((__packed__)); | 139 | } __attribute__((__packed__)); |
140 | 140 | ||
141 | struct blkif_request_other { | ||
142 | uint8_t _pad1; | ||
143 | blkif_vdev_t _pad2; /* only for read/write requests */ | ||
144 | #ifdef CONFIG_X86_64 | ||
145 | uint32_t _pad3; /* offsetof(blkif_req..,u.other.id)==8*/ | ||
146 | #endif | ||
147 | uint64_t id; /* private guest value, echoed in resp */ | ||
148 | } __attribute__((__packed__)); | ||
149 | |||
141 | struct blkif_request { | 150 | struct blkif_request { |
142 | uint8_t operation; /* BLKIF_OP_??? */ | 151 | uint8_t operation; /* BLKIF_OP_??? */ |
143 | union { | 152 | union { |
144 | struct blkif_request_rw rw; | 153 | struct blkif_request_rw rw; |
145 | struct blkif_request_discard discard; | 154 | struct blkif_request_discard discard; |
155 | struct blkif_request_other other; | ||
146 | } u; | 156 | } u; |
147 | } __attribute__((__packed__)); | 157 | } __attribute__((__packed__)); |
148 | 158 | ||