diff options
Diffstat (limited to 'net/sunrpc/auth_gss/auth_gss.c')
| -rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 52 |
1 files changed, 23 insertions, 29 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 519ebc17c028..a6ed2d22a6e6 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
| @@ -88,7 +88,6 @@ struct gss_auth { | |||
| 88 | struct list_head upcalls; | 88 | struct list_head upcalls; |
| 89 | struct rpc_clnt *client; | 89 | struct rpc_clnt *client; |
| 90 | struct dentry *dentry; | 90 | struct dentry *dentry; |
| 91 | char path[48]; | ||
| 92 | spinlock_t lock; | 91 | spinlock_t lock; |
| 93 | }; | 92 | }; |
| 94 | 93 | ||
| @@ -225,9 +224,8 @@ gss_alloc_context(void) | |||
| 225 | { | 224 | { |
| 226 | struct gss_cl_ctx *ctx; | 225 | struct gss_cl_ctx *ctx; |
| 227 | 226 | ||
| 228 | ctx = kmalloc(sizeof(*ctx), GFP_KERNEL); | 227 | ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); |
| 229 | if (ctx != NULL) { | 228 | if (ctx != NULL) { |
| 230 | memset(ctx, 0, sizeof(*ctx)); | ||
| 231 | ctx->gc_proc = RPC_GSS_PROC_DATA; | 229 | ctx->gc_proc = RPC_GSS_PROC_DATA; |
| 232 | ctx->gc_seq = 1; /* NetApp 6.4R1 doesn't accept seq. no. 0 */ | 230 | ctx->gc_seq = 1; /* NetApp 6.4R1 doesn't accept seq. no. 0 */ |
| 233 | spin_lock_init(&ctx->gc_seq_lock); | 231 | spin_lock_init(&ctx->gc_seq_lock); |
| @@ -391,9 +389,8 @@ gss_alloc_msg(struct gss_auth *gss_auth, uid_t uid) | |||
| 391 | { | 389 | { |
| 392 | struct gss_upcall_msg *gss_msg; | 390 | struct gss_upcall_msg *gss_msg; |
| 393 | 391 | ||
| 394 | gss_msg = kmalloc(sizeof(*gss_msg), GFP_KERNEL); | 392 | gss_msg = kzalloc(sizeof(*gss_msg), GFP_KERNEL); |
| 395 | if (gss_msg != NULL) { | 393 | if (gss_msg != NULL) { |
| 396 | memset(gss_msg, 0, sizeof(*gss_msg)); | ||
| 397 | INIT_LIST_HEAD(&gss_msg->list); | 394 | INIT_LIST_HEAD(&gss_msg->list); |
| 398 | rpc_init_wait_queue(&gss_msg->rpc_waitqueue, "RPCSEC_GSS upcall waitq"); | 395 | rpc_init_wait_queue(&gss_msg->rpc_waitqueue, "RPCSEC_GSS upcall waitq"); |
| 399 | init_waitqueue_head(&gss_msg->waitqueue); | 396 | init_waitqueue_head(&gss_msg->waitqueue); |
| @@ -692,10 +689,8 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor) | |||
| 692 | if (err) | 689 | if (err) |
| 693 | goto err_put_mech; | 690 | goto err_put_mech; |
| 694 | 691 | ||
| 695 | snprintf(gss_auth->path, sizeof(gss_auth->path), "%s/%s", | 692 | gss_auth->dentry = rpc_mkpipe(clnt->cl_dentry, gss_auth->mech->gm_name, |
| 696 | clnt->cl_pathname, | 693 | clnt, &gss_upcall_ops, RPC_PIPE_WAIT_FOR_OPEN); |
| 697 | gss_auth->mech->gm_name); | ||
| 698 | gss_auth->dentry = rpc_mkpipe(gss_auth->path, clnt, &gss_upcall_ops, RPC_PIPE_WAIT_FOR_OPEN); | ||
| 699 | if (IS_ERR(gss_auth->dentry)) { | 694 | if (IS_ERR(gss_auth->dentry)) { |
| 700 | err = PTR_ERR(gss_auth->dentry); | 695 | err = PTR_ERR(gss_auth->dentry); |
| 701 | goto err_put_mech; | 696 | goto err_put_mech; |
| @@ -720,8 +715,7 @@ gss_destroy(struct rpc_auth *auth) | |||
| 720 | auth, auth->au_flavor); | 715 | auth, auth->au_flavor); |
| 721 | 716 | ||
| 722 | gss_auth = container_of(auth, struct gss_auth, rpc_auth); | 717 | gss_auth = container_of(auth, struct gss_auth, rpc_auth); |
| 723 | rpc_unlink(gss_auth->path); | 718 | rpc_unlink(gss_auth->dentry); |
| 724 | dput(gss_auth->dentry); | ||
| 725 | gss_auth->dentry = NULL; | 719 | gss_auth->dentry = NULL; |
| 726 | gss_mech_put(gss_auth->mech); | 720 | gss_mech_put(gss_auth->mech); |
| 727 | 721 | ||
| @@ -776,10 +770,9 @@ gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags) | |||
| 776 | dprintk("RPC: gss_create_cred for uid %d, flavor %d\n", | 770 | dprintk("RPC: gss_create_cred for uid %d, flavor %d\n", |
| 777 | acred->uid, auth->au_flavor); | 771 | acred->uid, auth->au_flavor); |
| 778 | 772 | ||
| 779 | if (!(cred = kmalloc(sizeof(*cred), GFP_KERNEL))) | 773 | if (!(cred = kzalloc(sizeof(*cred), GFP_KERNEL))) |
| 780 | goto out_err; | 774 | goto out_err; |
| 781 | 775 | ||
| 782 | memset(cred, 0, sizeof(*cred)); | ||
| 783 | atomic_set(&cred->gc_count, 1); | 776 | atomic_set(&cred->gc_count, 1); |
| 784 | cred->gc_uid = acred->uid; | 777 | cred->gc_uid = acred->uid; |
| 785 | /* | 778 | /* |
| @@ -833,14 +826,14 @@ out: | |||
| 833 | * Marshal credentials. | 826 | * Marshal credentials. |
| 834 | * Maybe we should keep a cached credential for performance reasons. | 827 | * Maybe we should keep a cached credential for performance reasons. |
| 835 | */ | 828 | */ |
| 836 | static u32 * | 829 | static __be32 * |
| 837 | gss_marshal(struct rpc_task *task, u32 *p) | 830 | gss_marshal(struct rpc_task *task, __be32 *p) |
| 838 | { | 831 | { |
| 839 | struct rpc_cred *cred = task->tk_msg.rpc_cred; | 832 | struct rpc_cred *cred = task->tk_msg.rpc_cred; |
| 840 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, | 833 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, |
| 841 | gc_base); | 834 | gc_base); |
| 842 | struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); | 835 | struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); |
| 843 | u32 *cred_len; | 836 | __be32 *cred_len; |
| 844 | struct rpc_rqst *req = task->tk_rqstp; | 837 | struct rpc_rqst *req = task->tk_rqstp; |
| 845 | u32 maj_stat = 0; | 838 | u32 maj_stat = 0; |
| 846 | struct xdr_netobj mic; | 839 | struct xdr_netobj mic; |
| @@ -901,12 +894,12 @@ gss_refresh(struct rpc_task *task) | |||
| 901 | return 0; | 894 | return 0; |
| 902 | } | 895 | } |
| 903 | 896 | ||
| 904 | static u32 * | 897 | static __be32 * |
| 905 | gss_validate(struct rpc_task *task, u32 *p) | 898 | gss_validate(struct rpc_task *task, __be32 *p) |
| 906 | { | 899 | { |
| 907 | struct rpc_cred *cred = task->tk_msg.rpc_cred; | 900 | struct rpc_cred *cred = task->tk_msg.rpc_cred; |
| 908 | struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); | 901 | struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); |
| 909 | u32 seq; | 902 | __be32 seq; |
| 910 | struct kvec iov; | 903 | struct kvec iov; |
| 911 | struct xdr_buf verf_buf; | 904 | struct xdr_buf verf_buf; |
| 912 | struct xdr_netobj mic; | 905 | struct xdr_netobj mic; |
| @@ -947,13 +940,14 @@ out_bad: | |||
| 947 | 940 | ||
| 948 | static inline int | 941 | static inline int |
| 949 | gss_wrap_req_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | 942 | gss_wrap_req_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx, |
| 950 | kxdrproc_t encode, struct rpc_rqst *rqstp, u32 *p, void *obj) | 943 | kxdrproc_t encode, struct rpc_rqst *rqstp, __be32 *p, void *obj) |
| 951 | { | 944 | { |
| 952 | struct xdr_buf *snd_buf = &rqstp->rq_snd_buf; | 945 | struct xdr_buf *snd_buf = &rqstp->rq_snd_buf; |
| 953 | struct xdr_buf integ_buf; | 946 | struct xdr_buf integ_buf; |
| 954 | u32 *integ_len = NULL; | 947 | __be32 *integ_len = NULL; |
| 955 | struct xdr_netobj mic; | 948 | struct xdr_netobj mic; |
| 956 | u32 offset, *q; | 949 | u32 offset; |
| 950 | __be32 *q; | ||
| 957 | struct kvec *iov; | 951 | struct kvec *iov; |
| 958 | u32 maj_stat = 0; | 952 | u32 maj_stat = 0; |
| 959 | int status = -EIO; | 953 | int status = -EIO; |
| @@ -1039,13 +1033,13 @@ out: | |||
| 1039 | 1033 | ||
| 1040 | static inline int | 1034 | static inline int |
| 1041 | gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | 1035 | gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, |
| 1042 | kxdrproc_t encode, struct rpc_rqst *rqstp, u32 *p, void *obj) | 1036 | kxdrproc_t encode, struct rpc_rqst *rqstp, __be32 *p, void *obj) |
| 1043 | { | 1037 | { |
| 1044 | struct xdr_buf *snd_buf = &rqstp->rq_snd_buf; | 1038 | struct xdr_buf *snd_buf = &rqstp->rq_snd_buf; |
| 1045 | u32 offset; | 1039 | u32 offset; |
| 1046 | u32 maj_stat; | 1040 | u32 maj_stat; |
| 1047 | int status; | 1041 | int status; |
| 1048 | u32 *opaque_len; | 1042 | __be32 *opaque_len; |
| 1049 | struct page **inpages; | 1043 | struct page **inpages; |
| 1050 | int first; | 1044 | int first; |
| 1051 | int pad; | 1045 | int pad; |
| @@ -1102,7 +1096,7 @@ gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | |||
| 1102 | 1096 | ||
| 1103 | static int | 1097 | static int |
| 1104 | gss_wrap_req(struct rpc_task *task, | 1098 | gss_wrap_req(struct rpc_task *task, |
| 1105 | kxdrproc_t encode, void *rqstp, u32 *p, void *obj) | 1099 | kxdrproc_t encode, void *rqstp, __be32 *p, void *obj) |
| 1106 | { | 1100 | { |
| 1107 | struct rpc_cred *cred = task->tk_msg.rpc_cred; | 1101 | struct rpc_cred *cred = task->tk_msg.rpc_cred; |
| 1108 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, | 1102 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, |
| @@ -1139,7 +1133,7 @@ out: | |||
| 1139 | 1133 | ||
| 1140 | static inline int | 1134 | static inline int |
| 1141 | gss_unwrap_resp_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | 1135 | gss_unwrap_resp_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx, |
| 1142 | struct rpc_rqst *rqstp, u32 **p) | 1136 | struct rpc_rqst *rqstp, __be32 **p) |
| 1143 | { | 1137 | { |
| 1144 | struct xdr_buf *rcv_buf = &rqstp->rq_rcv_buf; | 1138 | struct xdr_buf *rcv_buf = &rqstp->rq_rcv_buf; |
| 1145 | struct xdr_buf integ_buf; | 1139 | struct xdr_buf integ_buf; |
| @@ -1176,7 +1170,7 @@ gss_unwrap_resp_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | |||
| 1176 | 1170 | ||
| 1177 | static inline int | 1171 | static inline int |
| 1178 | gss_unwrap_resp_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | 1172 | gss_unwrap_resp_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, |
| 1179 | struct rpc_rqst *rqstp, u32 **p) | 1173 | struct rpc_rqst *rqstp, __be32 **p) |
| 1180 | { | 1174 | { |
| 1181 | struct xdr_buf *rcv_buf = &rqstp->rq_rcv_buf; | 1175 | struct xdr_buf *rcv_buf = &rqstp->rq_rcv_buf; |
| 1182 | u32 offset; | 1176 | u32 offset; |
| @@ -1205,13 +1199,13 @@ gss_unwrap_resp_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | |||
| 1205 | 1199 | ||
| 1206 | static int | 1200 | static int |
| 1207 | gss_unwrap_resp(struct rpc_task *task, | 1201 | gss_unwrap_resp(struct rpc_task *task, |
| 1208 | kxdrproc_t decode, void *rqstp, u32 *p, void *obj) | 1202 | kxdrproc_t decode, void *rqstp, __be32 *p, void *obj) |
| 1209 | { | 1203 | { |
| 1210 | struct rpc_cred *cred = task->tk_msg.rpc_cred; | 1204 | struct rpc_cred *cred = task->tk_msg.rpc_cred; |
| 1211 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, | 1205 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, |
| 1212 | gc_base); | 1206 | gc_base); |
| 1213 | struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); | 1207 | struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); |
| 1214 | u32 *savedp = p; | 1208 | __be32 *savedp = p; |
| 1215 | struct kvec *head = ((struct rpc_rqst *)rqstp)->rq_rcv_buf.head; | 1209 | struct kvec *head = ((struct rpc_rqst *)rqstp)->rq_rcv_buf.head; |
| 1216 | int savedlen = head->iov_len; | 1210 | int savedlen = head->iov_len; |
| 1217 | int status = -EIO; | 1211 | int status = -EIO; |
