From 6d26b28aa008ecb8872525bf0faea04fa1b14e56 Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Tue, 18 Mar 2025 17:14:16 +0100 Subject: [PATCH] LU-18825 gss: survive improper import at ctx init GSS context init requests can happen even after a client has been unmounted, because they are coming from userspace (request-key, lgss_keyring). In this case they must be ignored, and code must be robust to survive improper, already or partially shutdown import. Test-Parameters: kerberos=true testlist=sanity-krb5 Signed-off-by: Sebastien Buisson Change-Id: I06d031c28c769d1383d37de1d2c94ef64eb0eda3 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58454 Reviewed-by: Aurelien Degremont Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- lustre/ptlrpc/gss/gss_cli_upcall.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lustre/ptlrpc/gss/gss_cli_upcall.c b/lustre/ptlrpc/gss/gss_cli_upcall.c index 73f4894..67db6fe 100644 --- a/lustre/ptlrpc/gss/gss_cli_upcall.c +++ b/lustre/ptlrpc/gss/gss_cli_upcall.c @@ -57,6 +57,13 @@ int ctx_init_pack_request(struct obd_import *imp, LASSERT(req->rq_cli_ctx); LASSERT(req->rq_cli_ctx->cc_sec); + if (!imp->imp_sec) { + CDEBUG(D_SEC, + "%s: no sec on import, ctx init request is too late or too soon: rc = %d\n", + imp->imp_obd->obd_name, -EINVAL); + return -EINVAL; + } + /* gss hdr */ ghdr = lustre_msg_buf(msg, 0, sizeof(*ghdr)); ghdr->gh_version = PTLRPC_GSS_VERSION; -- 1.8.3.1