]> git.ipfire.org Git - thirdparty/mdadm.git/commit
drive_encryption: Fix ata passthrough12 verify
authorBlazej Kucman <blazej.kucman@intel.com>
Tue, 23 Jul 2024 10:45:10 +0000 (12:45 +0200)
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Wed, 24 Jul 2024 11:13:32 +0000 (13:13 +0200)
commit2bb4efb504d0991eaba755242d3e70facb5d994b
treeb7cda9c5caad5948899bf7d6551262d9d7d86d09
parent5be749ce416852e7acbb2415be380be358859612
drive_encryption: Fix ata passthrough12 verify

Based on documentation SCSI Primary Commands - 4 (SPC-4) only first 7 bits
of first byte in sense data are used to store response code. The current
verification uses all 8 bits for comparison of response code.

Incorrect verification may make impossible to use SATA disks with IMSM,
because IMSM requires verification of the encryption state before use.

There was issue in kernel libata [1]. This issue hides bug in mdadm because
last bit was not set.

Example output with affected mdadm:

          Port3 : /dev/sde (BTPR212503EK120LGN)
mdadm: Failed ata passthrough12 ioctl. Device: /dev/sde.
mdadm: Failed to get drive encryption information

The fix is use the first 7 bits of Byte 0, to compare with the expected
values.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/libata/linux.git/commit/?id=38dab832c3f4

Fixes: df38df3052c3 ("Add reading SATA encryption information")
Signed-off-by: Blazej Kucman <blazej.kucman@intel.com>
drive_encryption.c