Commit 5eae0e00 authored by Chuck Lever's avatar Chuck Lever
Browse files

lockd: Convert server-side undefined procedures to xdrgen



The NLMv4 protocol defines several procedure slots that are
not implemented. These undefined procedures need proper
handling to return rpc_proc_unavail to clients that
mistakenly invoke them.

This patch converts the three undefined procedure entries
(slots 17, 18, and 19) to use xdrgen functions
nlm4_svc_decode_void and nlm4_svc_encode_void. The
nlm4svc_proc_unused function is also moved earlier in the
file to follow the convention of placing procedure
implementations before the procedure table.

The pc_argsize, pc_ressize, and pc_argzero fields are now
correctly set to zero since no arguments or results are
processed. The pc_xdrressize field is updated to XDR_void
to accurately reflect the response size.

This conversion completes the migration of all NLMv4
server-side procedures to use xdrgen-generated XDR
functions, improving type safety and eliminating
hand-written XDR code.

Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 16099e10
Loading
Loading
Loading
Loading
+36 −30
Original line number Diff line number Diff line
@@ -1029,6 +1029,18 @@ static __be32 nlm4svc_proc_sm_notify(struct svc_rqst *rqstp)
	return rpc_success;
}

/**
 * nlm4svc_proc_unused - stub for unused procedures
 * @rqstp: RPC transaction context
 *
 * Returns:
 *   %rpc_proc_unavail:	Program can't support procedure.
 */
static __be32 nlm4svc_proc_unused(struct svc_rqst *rqstp)
{
	return rpc_proc_unavail;
}

/*
 * SHARE: create a DOS share or alter existing share.
 */
@@ -1133,12 +1145,6 @@ nlm4svc_proc_free_all(struct svc_rqst *rqstp)
	return rpc_success;
}

static __be32
nlm4svc_proc_unused(struct svc_rqst *rqstp)
{
	return rpc_proc_unavail;
}


/*
 * NLM Server procedures.
@@ -1324,32 +1330,32 @@ static const struct svc_procedure nlm4svc_procedures[24] = {
	},
	[17] = {
		.pc_func	= nlm4svc_proc_unused,
		.pc_decode = nlm4svc_decode_void,
		.pc_encode = nlm4svc_encode_void,
		.pc_argsize = sizeof(struct nlm_void),
		.pc_argzero = sizeof(struct nlm_void),
		.pc_ressize = sizeof(struct nlm_void),
		.pc_xdrressize = 0,
		.pc_decode	= nlm4_svc_decode_void,
		.pc_encode	= nlm4_svc_encode_void,
		.pc_argsize	= 0,
		.pc_argzero	= 0,
		.pc_ressize	= 0,
		.pc_xdrressize	= XDR_void,
		.pc_name	= "UNUSED",
	},
	[18] = {
		.pc_func	= nlm4svc_proc_unused,
		.pc_decode = nlm4svc_decode_void,
		.pc_encode = nlm4svc_encode_void,
		.pc_argsize = sizeof(struct nlm_void),
		.pc_argzero = sizeof(struct nlm_void),
		.pc_ressize = sizeof(struct nlm_void),
		.pc_xdrressize = 0,
		.pc_decode	= nlm4_svc_decode_void,
		.pc_encode	= nlm4_svc_encode_void,
		.pc_argsize	= 0,
		.pc_argzero	= 0,
		.pc_ressize	= 0,
		.pc_xdrressize	= XDR_void,
		.pc_name	= "UNUSED",
	},
	[19] = {
		.pc_func	= nlm4svc_proc_unused,
		.pc_decode = nlm4svc_decode_void,
		.pc_encode = nlm4svc_encode_void,
		.pc_argsize = sizeof(struct nlm_void),
		.pc_argzero = sizeof(struct nlm_void),
		.pc_ressize = sizeof(struct nlm_void),
		.pc_xdrressize = 0,
		.pc_decode	= nlm4_svc_decode_void,
		.pc_encode	= nlm4_svc_encode_void,
		.pc_argsize	= 0,
		.pc_argzero	= 0,
		.pc_ressize	= 0,
		.pc_xdrressize	= XDR_void,
		.pc_name	= "UNUSED",
	},
	[NLMPROC_SHARE] = {