aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHani Benhabiles <kroosec@gmail.com>2014-06-06 17:38:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-06 19:08:18 -0400
commit04cfac4e40b2b5dbaf8c0fc625878388a98bb9c6 (patch)
treebead85900cf46216b7f0ccdaaf2e0d43d73f61f9 /drivers
parentb1de0d139c97a6078bbada6cf2d27c30ce127a97 (diff)
nbd: zero from and len fields in NBD_CMD_DISCONNECT.
Len field is already set to zero, but not the from field which is sent as 0xfffffffffffffe00. This makes no sense, and may cause confuse server implementations doing sanity checks (qemu-nbd is an example.) Signed-off-by: Hani Benhabiles <hani@linux.com> Cc: Paul Clements <paul.clements@us.sios.com> Cc: Paul Clements <Paul.Clements@steeleye.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/nbd.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 56a027d6115e..fb31b8ee4372 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -243,14 +243,11 @@ static int nbd_send_req(struct nbd_device *nbd, struct request *req)
243 struct nbd_request request; 243 struct nbd_request request;
244 unsigned long size = blk_rq_bytes(req); 244 unsigned long size = blk_rq_bytes(req);
245 245
246 memset(&request, 0, sizeof(request));
246 request.magic = htonl(NBD_REQUEST_MAGIC); 247 request.magic = htonl(NBD_REQUEST_MAGIC);
247 request.type = htonl(nbd_cmd(req)); 248 request.type = htonl(nbd_cmd(req));
248 249
249 if (nbd_cmd(req) == NBD_CMD_FLUSH) { 250 if (nbd_cmd(req) != NBD_CMD_FLUSH && nbd_cmd(req) != NBD_CMD_DISC) {
250 /* Other values are reserved for FLUSH requests. */
251 request.from = 0;
252 request.len = 0;
253 } else {
254 request.from = cpu_to_be64((u64)blk_rq_pos(req) << 9); 251 request.from = cpu_to_be64((u64)blk_rq_pos(req) << 9);
255 request.len = htonl(size); 252 request.len = htonl(size);
256 } 253 }