diff options
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r-- | net/sunrpc/clnt.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 3ca518386d1..836f15c0c4a 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -197,6 +197,12 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, stru | |||
197 | 197 | ||
198 | clnt->cl_rtt = &clnt->cl_rtt_default; | 198 | clnt->cl_rtt = &clnt->cl_rtt_default; |
199 | rpc_init_rtt(&clnt->cl_rtt_default, clnt->cl_timeout->to_initval); | 199 | rpc_init_rtt(&clnt->cl_rtt_default, clnt->cl_timeout->to_initval); |
200 | clnt->cl_principal = NULL; | ||
201 | if (args->client_name) { | ||
202 | clnt->cl_principal = kstrdup(args->client_name, GFP_KERNEL); | ||
203 | if (!clnt->cl_principal) | ||
204 | goto out_no_principal; | ||
205 | } | ||
200 | 206 | ||
201 | kref_init(&clnt->cl_kref); | 207 | kref_init(&clnt->cl_kref); |
202 | 208 | ||
@@ -226,6 +232,8 @@ out_no_auth: | |||
226 | rpc_put_mount(); | 232 | rpc_put_mount(); |
227 | } | 233 | } |
228 | out_no_path: | 234 | out_no_path: |
235 | kfree(clnt->cl_principal); | ||
236 | out_no_principal: | ||
229 | rpc_free_iostats(clnt->cl_metrics); | 237 | rpc_free_iostats(clnt->cl_metrics); |
230 | out_no_stats: | 238 | out_no_stats: |
231 | if (clnt->cl_server != clnt->cl_inline_name) | 239 | if (clnt->cl_server != clnt->cl_inline_name) |
@@ -354,6 +362,11 @@ rpc_clone_client(struct rpc_clnt *clnt) | |||
354 | new->cl_metrics = rpc_alloc_iostats(clnt); | 362 | new->cl_metrics = rpc_alloc_iostats(clnt); |
355 | if (new->cl_metrics == NULL) | 363 | if (new->cl_metrics == NULL) |
356 | goto out_no_stats; | 364 | goto out_no_stats; |
365 | if (clnt->cl_principal) { | ||
366 | new->cl_principal = kstrdup(clnt->cl_principal, GFP_KERNEL); | ||
367 | if (new->cl_principal == NULL) | ||
368 | goto out_no_principal; | ||
369 | } | ||
357 | kref_init(&new->cl_kref); | 370 | kref_init(&new->cl_kref); |
358 | err = rpc_setup_pipedir(new, clnt->cl_program->pipe_dir_name); | 371 | err = rpc_setup_pipedir(new, clnt->cl_program->pipe_dir_name); |
359 | if (err != 0) | 372 | if (err != 0) |
@@ -366,6 +379,8 @@ rpc_clone_client(struct rpc_clnt *clnt) | |||
366 | rpciod_up(); | 379 | rpciod_up(); |
367 | return new; | 380 | return new; |
368 | out_no_path: | 381 | out_no_path: |
382 | kfree(new->cl_principal); | ||
383 | out_no_principal: | ||
369 | rpc_free_iostats(new->cl_metrics); | 384 | rpc_free_iostats(new->cl_metrics); |
370 | out_no_stats: | 385 | out_no_stats: |
371 | kfree(new); | 386 | kfree(new); |
@@ -417,6 +432,7 @@ rpc_free_client(struct kref *kref) | |||
417 | out_free: | 432 | out_free: |
418 | rpc_unregister_client(clnt); | 433 | rpc_unregister_client(clnt); |
419 | rpc_free_iostats(clnt->cl_metrics); | 434 | rpc_free_iostats(clnt->cl_metrics); |
435 | kfree(clnt->cl_principal); | ||
420 | clnt->cl_metrics = NULL; | 436 | clnt->cl_metrics = NULL; |
421 | xprt_put(clnt->cl_xprt); | 437 | xprt_put(clnt->cl_xprt); |
422 | rpciod_down(); | 438 | rpciod_down(); |