diff options
| author | Niklas Cassel <cassel@kernel.org> | 2026-11-03 21:54:53 +0100 |
|---|---|---|
| committer | Niklas Cassel <cassel@kernel.org> | 2026-11-07 13:34:39 +0100 |
| commit | 2a4c61cf94d48ec8560473d4fd5383583ce8809c (patch) | |
| tree | e62095243025586c98204895c5123ac8542e5c03 /scripts/dummy-tools/python3 | |
| parent | a1eb72c477ec1320c540f27ce1e2f717d4518e62 (diff) | |
ata: libata-scsi: fix MODE SELECT field pointer for unsupported subpages
When the mode page of a MODE SELECT parameter list has an unsupported
SUBPAGE CODE, ata_scsi_mode_select_xlat() sets the FIELD POINTER of the
INVALID FIELD IN PARAMETER LIST sense data to the SUBPAGE CODE byte of
the mode page header (byte 1 of the page) if the SPF bit is set, and to
the PAGE CODE byte (byte 0 of the page) otherwise.
However, the SPF bit is tested on p[0] after p has already been advanced
past the mode page header, so the test reads bit 6 of the first byte of
the mode page data instead. If the parameter list ends with the mode
page header, it even reads the byte that follows the parameter list in
buffer, which is not initialized when no data beyond the parameter list
was transferred.
The test is not needed anyway: spg can only be non-zero for a mode page
in sub_page format, i.e. with the SPF bit set, and the field in error is
the SUBPAGE CODE. Always set the FIELD POINTER to the SUBPAGE CODE byte,
which follows the mode parameter header, the block descriptors and the
PAGE CODE byte.
Fixes: 7780081c1f04 ("libata-scsi: Set information sense field for invalid parameter")
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20261103205448.931471-14-cassel@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Diffstat (limited to 'scripts/dummy-tools/python3')
0 files changed, 0 insertions, 0 deletions
