mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 10:41:26 +00:00
Fix incorrect NUMBER OF LOGICAL BLOCKS handling in WRITE SAME command
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5015 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -2245,6 +2245,11 @@ static enum compl_status_e vdisk_exec_write_same(struct vdisk_cmd_params *p)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (unlikely(cmd->data_len <= 0)) {
|
||||
scst_set_invalid_field_in_cdb(cmd, cmd->len_off, 0);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (cmd->cdb[1] & 0x8) {
|
||||
vdisk_exec_write_same_unmap(p);
|
||||
goto out;
|
||||
@@ -2507,6 +2512,7 @@ static enum compl_status_e vdisk_exec_inquiry(struct vdisk_cmd_params *p)
|
||||
int max_transfer;
|
||||
buf[1] = 0xB0;
|
||||
buf[3] = 0x3C;
|
||||
buf[4] = 1; /* WSNZ set */
|
||||
/* Optimal transfer granuality is PAGE_SIZE */
|
||||
put_unaligned_be16(max_t(int, PAGE_SIZE/dev->block_size, 1), &buf[6]);
|
||||
|
||||
|
||||
@@ -4859,6 +4859,11 @@ void scst_write_same(struct scst_cmd *cmd)
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
if (unlikely(cmd->data_len <= 0)) {
|
||||
scst_set_invalid_field_in_cdb(cmd, cmd->len_off, 0);
|
||||
goto out_done;
|
||||
}
|
||||
|
||||
if (cmd->sg_cnt != 1) {
|
||||
PRINT_ERROR("WRITE SAME must contain only single block of data "
|
||||
"in a single SG (cmd %p)", cmd);
|
||||
|
||||
Reference in New Issue
Block a user