From 1ca4f45ea89f10621bf7e9cfea1705d0a7940bea Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Mon, 8 Aug 2022 11:21:54 -0700 Subject: cxgbe: Handle requests for TLS key allocations with no TLS key storage. If an adapter advertises support for TLS keys but an empty TLS key storage area in on-board memory, fail the request rather than invoking vmem_alloc on an uninitialized vmem. Sponsored by: Chelsio Communications --- sys/dev/cxgbe/crypto/t4_keyctx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/cxgbe/crypto/t4_keyctx.c b/sys/dev/cxgbe/crypto/t4_keyctx.c index 136aba759a08..a5b15e5243eb 100644 --- a/sys/dev/cxgbe/crypto/t4_keyctx.c +++ b/sys/dev/cxgbe/crypto/t4_keyctx.c @@ -640,6 +640,9 @@ t4_alloc_tls_keyid(struct adapter *sc) { vmem_addr_t addr; + if (sc->vres.key.size == 0) + return (-1); + if (vmem_alloc(sc->key_map, TLS_KEY_CONTEXT_SZ, M_NOWAIT | M_FIRSTFIT, &addr) != 0) return (-1); -- cgit v1.2.3