aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c95
1 files changed, 73 insertions, 22 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index f684ce606667..1a6fa9173519 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -757,6 +757,73 @@ gss_pipe_destroy_msg(struct rpc_pipe_msg *msg)
757 } 757 }
758} 758}
759 759
760static void gss_pipes_dentries_destroy(struct rpc_auth *auth)
761{
762 struct gss_auth *gss_auth;
763
764 gss_auth = container_of(auth, struct gss_auth, rpc_auth);
765 rpc_unlink(gss_auth->pipe[0]->dentry);
766 rpc_unlink(gss_auth->pipe[1]->dentry);
767}
768
769static int gss_pipes_dentries_create(struct rpc_auth *auth)
770{
771 int err;
772 struct gss_auth *gss_auth;
773 struct rpc_clnt *clnt;
774
775 gss_auth = container_of(auth, struct gss_auth, rpc_auth);
776 clnt = gss_auth->client;
777
778 gss_auth->pipe[1]->dentry = rpc_mkpipe_dentry(clnt->cl_path.dentry,
779 "gssd",
780 clnt, gss_auth->pipe[1]);
781 if (IS_ERR(gss_auth->pipe[1]->dentry))
782 return PTR_ERR(gss_auth->pipe[1]->dentry);
783 gss_auth->pipe[0]->dentry = rpc_mkpipe_dentry(clnt->cl_path.dentry,
784 gss_auth->mech->gm_name,
785 clnt, gss_auth->pipe[0]);
786 if (IS_ERR(gss_auth->pipe[0]->dentry)) {
787 err = PTR_ERR(gss_auth->pipe[0]->dentry);
788 goto err_unlink_pipe_1;
789 }
790 return 0;
791
792err_unlink_pipe_1:
793 rpc_unlink(gss_auth->pipe[1]->dentry);
794 return err;
795}
796
797static void gss_pipes_dentries_destroy_net(struct rpc_clnt *clnt,
798 struct rpc_auth *auth)
799{
800 struct net *net = clnt->cl_xprt->xprt_net;
801 struct super_block *sb;
802
803 sb = rpc_get_sb_net(net);
804 if (sb) {
805 if (clnt->cl_path.dentry)
806 gss_pipes_dentries_destroy(auth);
807 rpc_put_sb_net(net);
808 }
809}
810
811static int gss_pipes_dentries_create_net(struct rpc_clnt *clnt,
812 struct rpc_auth *auth)
813{
814 struct net *net = clnt->cl_xprt->xprt_net;
815 struct super_block *sb;
816 int err = 0;
817
818 sb = rpc_get_sb_net(net);
819 if (sb) {
820 if (clnt->cl_path.dentry)
821 err = gss_pipes_dentries_create(auth);
822 rpc_put_sb_net(net);
823 }
824 return err;
825}
826
760/* 827/*
761 * NOTE: we have the opportunity to use different 828 * NOTE: we have the opportunity to use different
762 * parameters based on the input flavor (which must be a pseudoflavor) 829 * parameters based on the input flavor (which must be a pseudoflavor)
@@ -812,31 +879,16 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
812 err = PTR_ERR(gss_auth->pipe[0]); 879 err = PTR_ERR(gss_auth->pipe[0]);
813 goto err_destroy_pipe_1; 880 goto err_destroy_pipe_1;
814 } 881 }
815 882 err = gss_pipes_dentries_create_net(clnt, auth);
816 gss_auth->pipe[1]->dentry = rpc_mkpipe_dentry(clnt->cl_path.dentry, 883 if (err)
817 "gssd",
818 clnt, gss_auth->pipe[1]);
819 if (IS_ERR(gss_auth->pipe[1]->dentry)) {
820 err = PTR_ERR(gss_auth->pipe[1]->dentry);
821 goto err_destroy_pipe_0; 884 goto err_destroy_pipe_0;
822 }
823
824 gss_auth->pipe[0]->dentry = rpc_mkpipe_dentry(clnt->cl_path.dentry,
825 gss_auth->mech->gm_name,
826 clnt, gss_auth->pipe[0]);
827 if (IS_ERR(gss_auth->pipe[0]->dentry)) {
828 err = PTR_ERR(gss_auth->pipe[0]->dentry);
829 goto err_unlink_pipe_1;
830 }
831 err = rpcauth_init_credcache(auth); 885 err = rpcauth_init_credcache(auth);
832 if (err) 886 if (err)
833 goto err_unlink_pipe_0; 887 goto err_unlink_pipes;
834 888
835 return auth; 889 return auth;
836err_unlink_pipe_0: 890err_unlink_pipes:
837 rpc_unlink(gss_auth->pipe[0]->dentry); 891 gss_pipes_dentries_destroy_net(clnt, auth);
838err_unlink_pipe_1:
839 rpc_unlink(gss_auth->pipe[1]->dentry);
840err_destroy_pipe_0: 892err_destroy_pipe_0:
841 rpc_destroy_pipe_data(gss_auth->pipe[0]); 893 rpc_destroy_pipe_data(gss_auth->pipe[0]);
842err_destroy_pipe_1: 894err_destroy_pipe_1:
@@ -853,8 +905,7 @@ out_dec:
853static void 905static void
854gss_free(struct gss_auth *gss_auth) 906gss_free(struct gss_auth *gss_auth)
855{ 907{
856 rpc_unlink(gss_auth->pipe[0]->dentry); 908 gss_pipes_dentries_destroy_net(gss_auth->client, &gss_auth->rpc_auth);
857 rpc_unlink(gss_auth->pipe[1]->dentry);
858 rpc_destroy_pipe_data(gss_auth->pipe[0]); 909 rpc_destroy_pipe_data(gss_auth->pipe[0]);
859 rpc_destroy_pipe_data(gss_auth->pipe[1]); 910 rpc_destroy_pipe_data(gss_auth->pipe[1]);
860 gss_mech_put(gss_auth->mech); 911 gss_mech_put(gss_auth->mech);