From: Sebastien Buisson Date: Tue, 18 Mar 2025 16:14:16 +0000 (+0100) Subject: LU-18825 gss: survive improper import at ctx init X-Git-Tag: 2.16.54~36 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F54%2F58454%2F3;p=fs%2Flustre-release.git 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 --- 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;