Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1060375ybk; Wed, 20 May 2020 20:23:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWyyUgHTxWQjnN7p04eMHkzjUrNne1JwJWH3Y6mID6Ou5IhuBp1i61lO0AJUX3xjcQbMUA X-Received: by 2002:aa7:d042:: with SMTP id n2mr4559876edo.226.1590031421165; Wed, 20 May 2020 20:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590031421; cv=none; d=google.com; s=arc-20160816; b=qPIPsZdMBfWAALgzRSJoQaBh0r6btgeeoqqAK0tbQejGs/Bw7g0JOH7B+Hi6PGlZ78 zCbZ5bT7IAGAX8R/nKr1uoxbK7XVbGyrl9fYXjtry2Kosa2qg1k2eZzas63qaOHYU0J0 gyELlUdeHfEWCDMVDJYd06HzrK3O1dRFU5+kP7zSRCFGrZbm/YR9rXAf9eisTkmC+EGG O2o6G9BuxIeXkYx28/CHJ2wMh8DauRZq275AsoU1BBjycNqvad8YLrTIn0j8S3zC8Gaj JRYoGbcog/EslVxRYigTZetRiUjfsLkQ8msY32DsvwAgehjm3wwGirfukto7q0fC9/QP AatA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:cc:subject:date:to :from; bh=79h2xssw+IB6fhwgwg4iWHmsIu5pfaIAAJbaPRYYyuY=; b=bIj4YQVfQ7Wuijj7kO6kdOzur8Kfe3Jc8ThkamyBv8vqDvLkZmnDzAR3mr8ILCD5K1 fc9SW+v3mI9cRrS3w5c4fhJnlNUoTVWz3TEQgaoAjCgKCcW9iMlDZt10ig133FYWiSb+ dV40jdSU9ofpFmrVS31T90TOpPE4lrIlPttw6EhR3DOwE5oP9DbywgI6VLLhaxdEK0HF 5hnyts30GxYSsB+M8mK6jk+5HnFlL1nBAH8eyrCkkxPTw5YE1GCc1TR6mdM5z8GpDc/N PoSvbsiCJ8I2ReQEY6ShRKgtWhlNwrooN+0x7AHEufrji4JihYoKseKtTsf9ph6zsHxY ZZTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c5si2741723ejr.521.2020.05.20.20.23.18; Wed, 20 May 2020 20:23:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728064AbgEUDXG (ORCPT + 99 others); Wed, 20 May 2020 23:23:06 -0400 Received: from mx2.suse.de ([195.135.220.15]:59054 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727825AbgEUDXG (ORCPT ); Wed, 20 May 2020 23:23:06 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2BDE4B141; Thu, 21 May 2020 03:23:08 +0000 (UTC) From: NeilBrown To: "J. Bruce Fields" , Chuck Lever , kircherlike@outlook.com, Stephen Hemminger Date: Thu, 21 May 2020 13:21:41 +1000 Subject: [PATCH 2/3] sunrpc: svcauth_gss_register_pseudoflavor must reject duplicate registrations. Cc: linux-nfs@vger.kernel.org Message-ID: <159003130169.24897.13093682450013271796.stgit@noble> In-Reply-To: <159003086409.24897.4659128962844846611.stgit@noble> References: <159003086409.24897.4659128962844846611.stgit@noble> User-Agent: StGit/0.21 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 Signed-off-by: NeilBrown --- net/sunrpc/auth_gss/svcauth_gss.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 50d93c49ef1a..4aaaad794edb 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c @@ -826,9 +826,12 @@ 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 */ + printk(KERN_WARNING + "SUNRPC:svcauth_gss: duplicate pseudo flavour registration of %s\n", + name); + stat = -EALREADY; auth_domain_put(test); kfree(new->h.name); goto out_free_dom;