]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 28 Apr 2020 18:03:20 +0000 (19:03 +0100)
commit02f56a8486d10a37321a50e0aba739036eada641
tree507127724a25d6082a3645dbd38ce99e0e87b0fc
parent4a53d290900d7ae04a917ac8c2c5f0daf9eb434a
scsi: sd: Clear sdkp->protection_type if disk is reformatted without PI

commit 465f4edaecc6c37f81349233e84d46246bcac11a upstream.

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: fe542396da73 ("[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>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/scsi/sd.c