]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: sd: Clear sdkp->protection_type if disk is reformatted without PI
authorXiang Chen <chenxiang66@hisilicon.com>
Thu, 9 Jan 2020 01:12:24 +0000 (09:12 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 10 Jan 2020 06:28:56 +0000 (01:28 -0500)
commit027fabe77d148bded70819a79fa1352c2523d0b3
tree66f5d504778166f62f25fb0bc8c7d0e5491b92de
parent5ce6ff12343b9183e62972e692345fef968f1236
scsi: sd: Clear sdkp->protection_type if disk is reformatted without PI

If an attached disk with protection information enabled is reformatted
to Type 0 the revalidation code does not clear the original protection
type and subsequent accesses will keep setting RDPROTECT/WRPROTECT.

Set the protection type to 0 if the disk reports PROT_EN=0 in READ
CAPACITY(16).

[mkp: commit desc]

Fixes: a2e3e9b58746 ("[SCSI] sd: Ensure we correctly disable devices with unknown protection type")
Link: https://lore.kernel.org/r/1578532344-101668-1-git-send-email-chenxiang66@hisilicon.com
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sd.c