diff mbox series

[SRU,oem-5.6,1/2] sunrpc: svcauth_gss_register_pseudoflavor must reject duplicate registrations.

Message ID 20200916180709.393355-2-cascardo@canonical.com
State New
Headers show
Series CVE-2020-12656 | expand

Commit Message

Thadeu Lima de Souza Cascardo Sept. 16, 2020, 6:07 p.m. UTC
From: NeilBrown <neilb@suse.de>

There is no valid case for supporting duplicate pseudoflavor
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>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
(cherry picked from commit d47a5dc2888fd1b94adf1553068b8dad76cec96c)
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
 net/sunrpc/auth_gss/svcauth_gss.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series


diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 322fd48887f9..271f72ecb9b7 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -820,9 +820,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;
 		goto out_free_dom;