On Wed, 2012-01-18 at 14:04 +0100, Sebastian Andrzej Siewior wrote: > WindowsXP+BOT issues a MODE_SENSE request with page 0x1c which is not > suppoerted by target. Target rejects that command with > TCM_INVALID_CDB_FIELD, so far so good. On BOT I can't send the SENSE > response back, instead I can only reply that an error occured. The next > thing happens is a REQUEST_SENSE request with 18 bytes length. Since the > check here is more than 18 bytes I have to NACK that request as well. > This is not really required: We check for some additional room, but we > never use it. The additional length is set to 0xa so the total length is > 0xa + 8 = 18 which is fine with my 18 bytes. > > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> > --- > drivers/target/target_core_cdb.c | 14 ++++---------- > 1 files changed, 4 insertions(+), 10 deletions(-) > > diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c > index 2f2235e..2c61977 100644 > --- a/drivers/target/target_core_cdb.c > +++ b/drivers/target/target_core_cdb.c > @@ -1051,11 +1051,8 @@ int target_emulate_request_sense(struct se_task *task) > */ > buf[0] = 0x70; > buf[SPC_SENSE_KEY_OFFSET] = UNIT_ATTENTION; > - /* > - * Make sure request data length is enough for additional > - * sense data. > - */ > - if (cmd->data_length <= 18) { > + > + if (cmd->data_length < 18) { > buf[7] = 0x00; > err = -EINVAL; > goto end; > @@ -1072,11 +1069,8 @@ int target_emulate_request_sense(struct se_task *task) > */ > buf[0] = 0x70; > buf[SPC_SENSE_KEY_OFFSET] = NO_SENSE; > - /* > - * Make sure request data length is enough for additional > - * sense data. > - */ > - if (cmd->data_length <= 18) { > + > + if (cmd->data_length < 18) { > buf[7] = 0x00; > err = -EINVAL; > goto end; Hi Sebastian, Thanks for catching this one.. Patch applied to lio-core, and also will go into target-pending/3.3-rc-fixes. --nab -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html