linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: "J. Bruce Fields" <bfields@fieldses.org>,
	Chuck Lever <chuck.lever@oracle.com>,
	kircherlike@outlook.com,
	Stephen Hemminger <stephen@networkplumber.org>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 2/3] sunrpc: svcauth_gss_register_pseudoflavor must reject duplicate registrations.
Date: Fri, 22 May 2020 12:01:33 +1000	[thread overview]
Message-ID: <159011289297.29107.15128425916228317497.stgit@noble> (raw)
In-Reply-To: <159011265914.29107.13764997801950546826.stgit@noble>

There is no valid case for supporting duplicate pseudoflavor
registrations.
Currently the silent acceptance of such registrations is hiding a bug.
The rpcsec_gss_krb5 module registers 2 flavours but does not unregister
them, so if you load, unload, reload the module, it will happily
continue to use the old registration which now has pointers to the
memory were the module was originally loaded.  This could lead to
unexpected results.

So disallow duplicate registrations.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=206651
Cc: stable@vger.kernel.org (v2.6.12+)
Signed-off-by: NeilBrown <neilb@suse.de>
---
 net/sunrpc/auth_gss/svcauth_gss.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 50d93c49ef1a..49bb346a6215 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -826,9 +826,11 @@ svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name)
 	new->h.flavour = &svcauthops_gss;
 	new->pseudoflavor = pseudoflavor;
 
-	stat = 0;
 	test = auth_domain_lookup(name, &new->h);
-	if (test != &new->h) { /* Duplicate registration */
+	if (test != &new->h) {
+		pr_warn("svc: duplicate registration of gss pseudo flavour %s.\n",
+			name);
+		stat = -EADDRINUSE;
 		auth_domain_put(test);
 		kfree(new->h.name);
 		goto out_free_dom;



  parent reply	other threads:[~2020-05-22  2:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-22  2:01 [PATCH 0/3 - V2] SUNRPC/svc: fix gss flavour registration problems NeilBrown
2020-05-22  2:01 ` [PATCH 1/3] sunrpc: check that domain table is empty at module unload NeilBrown
2020-05-22  2:01 ` [PATCH 3/3] sunrpc: clean up properly in gss_mech_unregister() NeilBrown
2020-05-26  0:23   ` Sasha Levin
2020-05-26  0:50     ` NeilBrown
2020-05-22  2:01 ` NeilBrown [this message]
2020-05-28 22:26 ` [PATCH 0/3 - V2] SUNRPC/svc: fix gss flavour registration problems J. Bruce Fields
  -- strict thread matches above, loose matches on Subject: below --
2020-05-21  3:21 [PATCH 0/3] " NeilBrown
2020-05-21  3:21 ` [PATCH 2/3] sunrpc: svcauth_gss_register_pseudoflavor must reject duplicate registrations NeilBrown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=159011289297.29107.15128425916228317497.stgit@noble \
    --to=neilb@suse.de \
    --cc=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=kircherlike@outlook.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).