Commit 12850626 authored by Nicholas Bellinger's avatar Nicholas Bellinger

target: Fix WRITE_SAME usage with transport_get_size

For all flavours of WRITE_SAME, we only expect to handle a single block
of data-out buffer payload, regardless of the number of logical blocks
presented in the CDB.  This patch changes all flavours of WRITE_SAME in
transport_generic_cmd_sequencer() to pass '1' into transport_get_size()
instead of the extracted 'sectors' to properly handle the default usage
of sg_write_same without the --xferlen parameter.
Reported-by: default avatarEric Seppanen <eric@purestorage.com>
Signed-off-by: default avatarNicholas Bellinger <nab@risingtidesystems.com>
parent 706d5860
...@@ -3103,7 +3103,7 @@ static int transport_generic_cmd_sequencer( ...@@ -3103,7 +3103,7 @@ static int transport_generic_cmd_sequencer(
goto out_unsupported_cdb; goto out_unsupported_cdb;
if (sectors) if (sectors)
size = transport_get_size(sectors, cdb, cmd); size = transport_get_size(1, cdb, cmd);
else { else {
pr_err("WSNZ=1, WRITE_SAME w/sectors=0 not" pr_err("WSNZ=1, WRITE_SAME w/sectors=0 not"
" supported\n"); " supported\n");
...@@ -3365,7 +3365,7 @@ static int transport_generic_cmd_sequencer( ...@@ -3365,7 +3365,7 @@ static int transport_generic_cmd_sequencer(
goto out_unsupported_cdb; goto out_unsupported_cdb;
if (sectors) if (sectors)
size = transport_get_size(sectors, cdb, cmd); size = transport_get_size(1, cdb, cmd);
else { else {
pr_err("WSNZ=1, WRITE_SAME w/sectors=0 not supported\n"); pr_err("WSNZ=1, WRITE_SAME w/sectors=0 not supported\n");
goto out_invalid_cdb_field; goto out_invalid_cdb_field;
...@@ -3383,7 +3383,7 @@ static int transport_generic_cmd_sequencer( ...@@ -3383,7 +3383,7 @@ static int transport_generic_cmd_sequencer(
goto out_unsupported_cdb; goto out_unsupported_cdb;
if (sectors) if (sectors)
size = transport_get_size(sectors, cdb, cmd); size = transport_get_size(1, cdb, cmd);
else { else {
pr_err("WSNZ=1, WRITE_SAME w/sectors=0 not supported\n"); pr_err("WSNZ=1, WRITE_SAME w/sectors=0 not supported\n");
goto out_invalid_cdb_field; goto out_invalid_cdb_field;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment