Skip to content

Commit 88d6041

Browse files
RevanthRajashekaraxboe
authored andcommitted
block: sed-opal: Change the check condition for regular session validity
This patch changes the check condition for the validity/authentication of the session. 1. The Host Session Number(HSN) in the response should match the HSN for the session. 2. The TPER Session Number(TSN) can never be less than 4096 for a regular session. Reference: Section 3.2.2.1 of https://trustedcomputinggroup.org/wp-content/uploads/TCG_Storage_Opal_SSC_Application_Note_1-00_1-00-Final.pdf Section 3.3.7.1.1 of https://trustedcomputinggroup.org/wp-content/uploads/TCG_Storage_Architecture_Core_Spec_v2.01_r1.00.pdf Co-developed-by: Andrzej Jakowski <andrzej.jakowski@linux.intel.com> Signed-off-by: Andrzej Jakowski <andrzej.jakowski@linux.intel.com> Signed-off-by: Revanth Rajashekar <revanth.rajashekar@intel.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 9243c6f commit 88d6041

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

‎block/opal_proto.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ enum opal_response_token {
3636

3737
#define DTAERROR_NO_METHOD_STATUS 0x89
3838
#define GENERIC_HOST_SESSION_NUM 0x41
39+
#define FIRST_TPER_SESSION_NUM 4096
3940

4041
#define TPER_SYNC_SUPPORTED 0x01
4142
#define MBR_ENABLED_MASK 0x10

‎block/sed-opal.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ static int start_opal_session_cont(struct opal_dev *dev)
10561056
hsn = response_get_u64(&dev->parsed, 4);
10571057
tsn = response_get_u64(&dev->parsed, 5);
10581058

1059-
if (hsn == 0 && tsn == 0) {
1059+
if (hsn != GENERIC_HOST_SESSION_NUM || tsn < FIRST_TPER_SESSION_NUM) {
10601060
pr_debug("Couldn't authenticate session\n");
10611061
return -EPERM;
10621062
}

0 commit comments

Comments
 (0)