Whamcloud - gitweb
LU-18825 gss: survive improper import at ctx init 54/58454/3
authorSebastien Buisson <sbuisson@ddn.com>
Tue, 18 Mar 2025 16:14:16 +0000 (17:14 +0100)
committerOleg Drokin <green@whamcloud.com>
Mon, 31 Mar 2025 05:57:22 +0000 (05:57 +0000)
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 <sbuisson@ddn.com>
Change-Id: I06d031c28c769d1383d37de1d2c94ef64eb0eda3
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58454
Reviewed-by: Aurelien Degremont <adegremont@nvidia.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/ptlrpc/gss/gss_cli_upcall.c

index 73f4894..67db6fe 100644 (file)
@@ -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;