Skip to content

Commit 9356f29

Browse files
author
CKI KWF Bot
committed
Merge: Update the nvme drivers to kernel v6.16
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7518 # Merge Request Required Information ## Summary of Changes JIRA: https://issues.redhat.com/browse/RHEL-114502 Update the nvme drivers and sync them with kernel version 6.16 Signed-off-by: Maurizio Lombardi <mlombard@redhat.com> ## Approved Development Ticket(s) All submissions to CentOS Stream must reference a ticket in [Red Hat Jira](https://issues.redhat.com/). <details><summary>Click for formatting instructions</summary> Please follow the CentOS Stream [contribution documentation](https://docs.centos.org/en-US/stream-contrib/quickstart/) for how to file this ticket and have it approved. List tickets each on their own line of this description using the format "Resolves: RHEL-76229", "Related: RHEL-76229" or "Reverts: RHEL-76229", as appropriate. </details> Approved-by: Ewan D. Milne <emilne@redhat.com> Approved-by: Ming Lei <ming.lei@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 039d7c3 + 366af48 commit 9356f29

File tree

30 files changed

+994
-461
lines changed

30 files changed

+994
-461
lines changed

drivers/nvme/common/auth.c

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ struct nvme_dhchap_key *nvme_auth_transform_key(
242242
{
243243
const char *hmac_name;
244244
struct crypto_shash *key_tfm;
245-
struct shash_desc *shash;
245+
SHASH_DESC_ON_STACK(shash, key_tfm);
246246
struct nvme_dhchap_key *transformed_key;
247247
int ret, key_len;
248248

@@ -267,19 +267,11 @@ struct nvme_dhchap_key *nvme_auth_transform_key(
267267
if (IS_ERR(key_tfm))
268268
return ERR_CAST(key_tfm);
269269

270-
shash = kmalloc(sizeof(struct shash_desc) +
271-
crypto_shash_descsize(key_tfm),
272-
GFP_KERNEL);
273-
if (!shash) {
274-
ret = -ENOMEM;
275-
goto out_free_key;
276-
}
277-
278270
key_len = crypto_shash_digestsize(key_tfm);
279271
transformed_key = nvme_auth_alloc_key(key_len, key->hash);
280272
if (!transformed_key) {
281273
ret = -ENOMEM;
282-
goto out_free_shash;
274+
goto out_free_key;
283275
}
284276

285277
shash->tfm = key_tfm;
@@ -299,15 +291,12 @@ struct nvme_dhchap_key *nvme_auth_transform_key(
299291
if (ret < 0)
300292
goto out_free_transformed_key;
301293

302-
kfree(shash);
303294
crypto_free_shash(key_tfm);
304295

305296
return transformed_key;
306297

307298
out_free_transformed_key:
308299
nvme_auth_free_key(transformed_key);
309-
out_free_shash:
310-
kfree(shash);
311300
out_free_key:
312301
crypto_free_shash(key_tfm);
313302

@@ -482,7 +471,7 @@ EXPORT_SYMBOL_GPL(nvme_auth_generate_key);
482471
* @c1: Value of challenge C1
483472
* @c2: Value of challenge C2
484473
* @hash_len: Hash length of the hash algorithm
485-
* @ret_psk: Pointer too the resulting generated PSK
474+
* @ret_psk: Pointer to the resulting generated PSK
486475
* @ret_len: length of @ret_psk
487476
*
488477
* Generate a PSK for TLS as specified in NVMe base specification, section
@@ -770,8 +759,8 @@ int nvme_auth_derive_tls_psk(int hmac_id, u8 *psk, size_t psk_len,
770759
goto out_free_prk;
771760

772761
/*
773-
* 2 addtional bytes for the length field from HDKF-Expand-Label,
774-
* 2 addtional bytes for the HMAC ID, and one byte for the space
762+
* 2 additional bytes for the length field from HDKF-Expand-Label,
763+
* 2 additional bytes for the HMAC ID, and one byte for the space
775764
* separator.
776765
*/
777766
info_len = strlen(psk_digest) + strlen(psk_prefix) + 5;

drivers/nvme/host/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ config NVME_TCP_TLS
101101
help
102102
Enables TLS encryption for NVMe TCP using the netlink handshake API.
103103

104-
The TLS handshake daemon is availble at
104+
The TLS handshake daemon is available at
105105
https://github.com/oracle/ktls-utils.
106106

107107
If unsure, say N.

drivers/nvme/host/auth.c

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct nvme_dhchap_queue_context {
3131
u32 s1;
3232
u32 s2;
3333
bool bi_directional;
34+
bool authenticated;
3435
u16 transaction;
3536
u8 status;
3637
u8 dhgroup_id;
@@ -682,6 +683,7 @@ static void nvme_auth_reset_dhchap(struct nvme_dhchap_queue_context *chap)
682683
static void nvme_auth_free_dhchap(struct nvme_dhchap_queue_context *chap)
683684
{
684685
nvme_auth_reset_dhchap(chap);
686+
chap->authenticated = false;
685687
if (chap->shash_tfm)
686688
crypto_free_shash(chap->shash_tfm);
687689
if (chap->dh_tfm)
@@ -930,12 +932,14 @@ static void nvme_queue_auth_work(struct work_struct *work)
930932
}
931933
if (!ret) {
932934
chap->error = 0;
935+
chap->authenticated = true;
933936
if (ctrl->opts->concat &&
934937
(ret = nvme_auth_secure_concat(ctrl, chap))) {
935938
dev_warn(ctrl->device,
936939
"%s: qid %d failed to enable secure concatenation\n",
937940
__func__, chap->qid);
938941
chap->error = ret;
942+
chap->authenticated = false;
939943
}
940944
return;
941945
}
@@ -1023,21 +1027,30 @@ static void nvme_ctrl_auth_work(struct work_struct *work)
10231027
return;
10241028

10251029
for (q = 1; q < ctrl->queue_count; q++) {
1026-
ret = nvme_auth_negotiate(ctrl, q);
1027-
if (ret) {
1028-
dev_warn(ctrl->device,
1029-
"qid %d: error %d setting up authentication\n",
1030-
q, ret);
1031-
break;
1032-
}
1030+
struct nvme_dhchap_queue_context *chap =
1031+
&ctrl->dhchap_ctxs[q];
1032+
/*
1033+
* Skip re-authentication if the queue had
1034+
* not been authenticated initially.
1035+
*/
1036+
if (!chap->authenticated)
1037+
continue;
1038+
cancel_work_sync(&chap->auth_work);
1039+
queue_work(nvme_auth_wq, &chap->auth_work);
10331040
}
10341041

10351042
/*
10361043
* Failure is a soft-state; credentials remain valid until
10371044
* the controller terminates the connection.
10381045
*/
10391046
for (q = 1; q < ctrl->queue_count; q++) {
1040-
ret = nvme_auth_wait(ctrl, q);
1047+
struct nvme_dhchap_queue_context *chap =
1048+
&ctrl->dhchap_ctxs[q];
1049+
if (!chap->authenticated)
1050+
continue;
1051+
flush_work(&chap->auth_work);
1052+
ret = chap->error;
1053+
nvme_auth_reset_dhchap(chap);
10411054
if (ret)
10421055
dev_warn(ctrl->device,
10431056
"qid %d: authentication failed\n", q);
@@ -1076,6 +1089,7 @@ int nvme_auth_init_ctrl(struct nvme_ctrl *ctrl)
10761089
chap = &ctrl->dhchap_ctxs[i];
10771090
chap->qid = i;
10781091
chap->ctrl = ctrl;
1092+
chap->authenticated = false;
10791093
INIT_WORK(&chap->auth_work, nvme_queue_auth_work);
10801094
}
10811095

drivers/nvme/host/constants.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ static const char * const nvme_statuses[] = {
145145
[NVME_SC_BAD_ATTRIBUTES] = "Conflicting Attributes",
146146
[NVME_SC_INVALID_PI] = "Invalid Protection Information",
147147
[NVME_SC_READ_ONLY] = "Attempted Write to Read Only Range",
148-
[NVME_SC_ONCS_NOT_SUPPORTED] = "ONCS Not Supported",
148+
[NVME_SC_CMD_SIZE_LIM_EXCEEDED ] = "Command Size Limits Exceeded",
149149
[NVME_SC_ZONE_BOUNDARY_ERROR] = "Zoned Boundary Error",
150150
[NVME_SC_ZONE_FULL] = "Zone Is Full",
151151
[NVME_SC_ZONE_READ_ONLY] = "Zone Is Read Only",

0 commit comments

Comments
 (0)