Since we report ANC_SUP==0 in VPD page B2h, we need to return
an error (ILLEGAL REQUEST/INVALID FIELD IN CDB) for all WRITE SAME
requests with ANCHOR==1.
Inspired by a similar patch to the LIO in-kernel target.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
int len = r->req.cmd.xfer;
UnmapCBData *data;
+ /* Reject ANCHOR=1. */
+ if (r->req.cmd.buf[1] & 0x1) {
+ goto invalid_field;
+ }
+
if (len < 8) {
goto invalid_param_len;
}
invalid_param_len:
scsi_check_condition(r, SENSE_CODE(INVALID_PARAM_LEN));
+ return;
+
+invalid_field:
+ scsi_check_condition(r, SENSE_CODE(INVALID_FIELD));
}
static void scsi_disk_emulate_write_data(SCSIRequest *req)
/*
* We only support WRITE SAME with the unmap bit set for now.
+ * Reject UNMAP=0 or ANCHOR=1.
*/
- if (!(req->cmd.buf[1] & 0x8)) {
+ if (!(req->cmd.buf[1] & 0x8) || (req->cmd.buf[1] & 0x10)) {
goto illegal_request;
}