On Mon, 21 Feb 2011, Tanya Brokhman wrote: > Hi All > > I was looking at the current implementation of do_mode_sense() in > f_mass_storage.c (v2.6.38-rc5) and saw that there is no reference to the > ALLOCATION LENGTH value from the CDB when issuing the reply. Right. > It seems to me that this might be an issue. For example the UAS host driver > issues the following MODE SENSE CDB: > > 0x1a 0x00 0x3f 0x00 0x04 0x00 > Meaning: > PC = 0x00 Current values > Page Code = 0x3f all pages > Allocation Length = 0x04 > > According to the code in such case the MODE SENSE data reply length should > be 16 bytes while the host expects to receive only 4 bytes. Right. > Shouldn't there be some sort of a length adjustment according to the > Allocation Length value? Indeed yes. Have you read the code in the middle and near the end of do_scsi_cmnd()? case MODE_SENSE: common->data_size_from_cmnd = common->cmnd[4]; ... if (reply >= 0 && common->data_dir == DATA_DIR_TO_HOST) { reply = min((u32)reply, common->data_size_from_cmnd); bh->inreq->length = reply; Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html