When unmarshalling a SCSI_PERSISTENT_RESERVE_READ_KEYS response, scsi_persistentreservein_datain_unmarshall() assumes that the ADDITIONAL LENGTH field represents the number of keys packed in the key array. This is incorrect as key array data buffer may be truncated while ADDITIONAL LENGTH is left in tact, as per SPC5r17 4.2.5.6: If the information being transferred to the Data-In Buffer includes fields containing counts ..., then the contents of these fields shall not be altered to reflect the truncation, if any, that results from an insufficient ALLOCATION LENGTH value, unless the standard that describes the Data-In Buffer format states otherwise. Determine the number of keys returned based on the minimum of the data-in length and the ADDITIONAL LENGTH value. Signed-off-by: David Disseldorp <ddiss@suse.de>
103 KiB
103 KiB