From 83a7310ca22035305bd14a8d0b0e9cfa726ac5a1 Mon Sep 17 00:00:00 2001 From: Ondrej Kozina Date: Thu, 31 Jul 2025 13:29:18 +0200 Subject: [PATCH] opal: do not initialize LRs array in activation. The lr member in opal_lr_act kernel structure is ingnored unless the device is being activated in SUM mode. See kernel implementation of IOC_OPAL_ACTIVATE_LSP in block/sed-opal.c --- lib/luks2/hw_opal/hw_opal.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/luks2/hw_opal/hw_opal.c b/lib/luks2/hw_opal/hw_opal.c index 8a63c811..ed527b3c 100644 --- a/lib/luks2/hw_opal/hw_opal.c +++ b/lib/luks2/hw_opal/hw_opal.c @@ -415,11 +415,8 @@ static int opal_activate_lsp(struct crypt_device *cd, int fd, .key = { .key_len = admin_key_len, }, - .num_lrs = 8, - /* A max of 9 segments are supported, enable them all as there's no reason not to - * (0 is whole-volume) - */ - .lr = { 1, 2, 3, 4, 5, 6, 7, 8 }, + /* useless but due to kernel bug it requires (num_lrs > 0 && num_lrs <= 9) */ + .num_lrs = 1, }; crypt_safe_memcpy(activate->key.key, admin_key, admin_key_len);