Skip to contentSkip to conversation

gss-proxy fixes for 3.11

PATCH New J. Bruce Fields 1 participant 5 messages Aug 1, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover gss-proxy fixes for 3.11

From: "J. Bruce Fields" <[email protected]>

These are few gss proxy bugfixes, two found during the original testing that I mistakenly dropped, two more than I found during more recent testing (the last a regression introduced in 3.11).

With these applied I can do a krb5 mount with either rpc.svcgssd or gss-proxy.

I intend to submit them for 3.11.

--b.

J. Bruce Fields (4):
svcrpc: fix gss_rpc_upcall create error
svcrpc: fix gss-proxy xdr decoding oops
svcrpc: fix kfree oops in gss-proxy code
svcrpc: set cr_gss_mech from gss-proxy as well as legacy upcall

 net/sunrpc/auth_gss/gss_rpc_upcall.c |    3 +--
 net/sunrpc/auth_gss/gss_rpc_xdr.c    |    9 +++++----
 net/sunrpc/auth_gss/svcauth_gss.c    |    2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/4 svcrpc: fix gss_rpc_upcall create error

From: "J. Bruce Fields" <[email protected]>

---
 net/sunrpc/auth_gss/gss_rpc_upcall.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/auth_gss/gss_rpc_upcall.c +1 -1
index d304f41..1e1ccf5 100644
@@ -120,7 +120,7 @@ static int gssp_rpc_create(struct net *net, struct rpc_clnt **_clnt)
 	if (IS_ERR(clnt)) {
 		dprintk("RPC:       failed to create AF_LOCAL gssproxy "
 				"client (errno %ld).\n", PTR_ERR(clnt));
-		result = -PTR_ERR(clnt);
+		result = PTR_ERR(clnt);
 		*_clnt = NULL;
 		goto out;
 	}
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/4 svcrpc: fix gss-proxy xdr decoding oops

In reply to J. Bruce Fields

From: "J. Bruce Fields" <[email protected]>

Uninitialized stack data was being used as the destination for memcpy's.

Longer term we'll just delete some of this code; all we're doing is skipping over xdr that we don't care about.

---
 net/sunrpc/auth_gss/gss_rpc_xdr.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
net/sunrpc/auth_gss/gss_rpc_xdr.c +5 -4
index 357f613..3c85d1c 100644
@@ -430,7 +430,7 @@ static int dummy_enc_nameattr_array(struct xdr_stream *xdr,
 static int dummy_dec_nameattr_array(struct xdr_stream *xdr,
 				    struct gssx_name_attr_array *naa)
 {
-	struct gssx_name_attr dummy;
+	struct gssx_name_attr dummy = { .attr = {.len = 0} };
 	u32 count, i;
 	__be32 *p;
 
@@ -493,12 +493,13 @@ static int gssx_enc_name(struct xdr_stream *xdr,
 	return err;
 }
 
+
 static int gssx_dec_name(struct xdr_stream *xdr,
 			 struct gssx_name *name)
 {
-	struct xdr_netobj dummy_netobj;
-	struct gssx_name_attr_array dummy_name_attr_array;
-	struct gssx_option_array dummy_option_array;
+	struct xdr_netobj dummy_netobj = { .len = 0 };
+	struct gssx_name_attr_array dummy_name_attr_array = { .count = 0 };
+	struct gssx_option_array dummy_option_array = { .count = 0 };
 	int err;
 
 	/* name->display_name */
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/4 svcrpc: fix kfree oops in gss-proxy code

In reply to J. Bruce Fields

From: "J. Bruce Fields" <[email protected]>

mech_oid.data is an array, not kmalloc()'d memory.

---
 net/sunrpc/auth_gss/gss_rpc_upcall.c |    1 -
 1 file changed, 1 deletion(-)
net/sunrpc/auth_gss/gss_rpc_upcall.c +0 -1
index 1e1ccf5..af7ffd4 100644
@@ -328,7 +328,6 @@ void gssp_free_upcall_data(struct gssp_upcall_data *data)
 	kfree(data->in_handle.data);
 	kfree(data->out_handle.data);
 	kfree(data->out_token.data);
-	kfree(data->mech_oid.data);
 	free_svc_cred(&data->creds);
 }
 
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 4/4 svcrpc: set cr_gss_mech from gss-proxy as well as legacy upcall

In reply to J. Bruce Fields

From: "J. Bruce Fields" <[email protected]>

The change made to rsc_parse() in 0dc1531aca7fd1440918bd55844a054e9c29acad "svcrpc: store gss mech in svc_cred" should also have been propagated to the gss-proxy codepath. This fixes a crash in the gss-proxy case.

---
 net/sunrpc/auth_gss/svcauth_gss.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/auth_gss/svcauth_gss.c +1 -1
index d0347d1..09fb638 100644
@@ -1180,6 +1180,7 @@ static int gss_proxy_save_rsc(struct cache_detail *cd,
 		gm = gss_mech_get_by_OID(&ud->mech_oid);
 		if (!gm)
 			goto out;
+		rsci.cred.cr_gss_mech = gm;
 
 		status = -EINVAL;
 		/* mech-specific data: */
@@ -1195,7 +1196,6 @@ static int gss_proxy_save_rsc(struct cache_detail *cd,
 	rscp = rsc_update(cd, &rsci, rscp);
 	status = 0;
 out:
-	gss_mech_put(gm);
 	rsc_free(&rsci);
 	if (rscp)
 		cache_put(&rscp->h, cd);
Signature · 1 line
1.7.9.5