Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1902034ybk; Thu, 21 May 2020 19:04:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysYt+9syUrVhTFnsVleySgr0IYxcbicBn4WzpS1CxA8cR8XUdradrHqOsnb+Ph0nnOTRTu X-Received: by 2002:a50:eb0c:: with SMTP id y12mr1230570edp.165.1590113052470; Thu, 21 May 2020 19:04:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590113052; cv=none; d=google.com; s=arc-20160816; b=XHmDZLfeEB6wKnKRsJwFGZEQU0gLOMOb1i+QbC/2A6u5htKvm0QIeyOzRINPUhIFav k88YDBi0ogQZIETgI7RtADEnG5TbotIHBZrINl8pzzYwDF4bd9DpIPTKCc3guBYCc0G4 HQDD1Zx4SgKSE9olBlob06kM+qSs+9JJ77ZjvmRns+DxRKaSW1GlhfPCRfQRTV7SpXBF U7uj0z8a8cK+d0/FG/j2iMSv8iyWvOxOHQGXn7fxuBI+wEp4P+Z1o15otW1cytiAF1B3 Ww1xzwuX7X38E6FTC9UfRY5QpJYeHlb5WWWUhlSqPJg5Uh3Gry12qZhRBh/0rzbfeJ6S 1AFA== 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=hLZhvBJWa6S8w2gRsQLdQ7OvtCRoKsjneuRTgMH9CsU=; b=B09MvCyWlTtBwVwsNAyRY83qsUzyPNUI7FcEuhgckOiEDosCp1uoOCOONduE/ZINV+ bzl9mne6D1YlgqTri+wKoUs1YsvnaC0jgn5uXkop1YFxHlhoPYS+8OD2qEJjHP/F9dmr ydYOcXGSuDWxLbQC3uOs8kse+SubDW/PaShDXv2LiNC3UITwHgAQYn1ZvNq1u+nAVa+Z Ex5knQ3O1qNHPR7/n04LXVIkSokvp0QMvjLUuSbIULHsgC+aUH6FniS3ODONF4iDslMC b37H/ZpyMR8CWQBth0MDkKEuPfIH0rBRMcTCYfG/kDx6YKQM4zmKe8HWoAhg/6caHJDw MIkg== 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 jp7si4408306ejb.617.2020.05.21.19.03.44; Thu, 21 May 2020 19:04:12 -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 S1727065AbgEVCDm (ORCPT + 99 others); Thu, 21 May 2020 22:03:42 -0400 Received: from mx2.suse.de ([195.135.220.15]:47192 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726335AbgEVCDm (ORCPT ); Thu, 21 May 2020 22:03:42 -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 453AAB007; Fri, 22 May 2020 02:03:44 +0000 (UTC) From: NeilBrown To: "J. Bruce Fields" , Chuck Lever , kircherlike@outlook.com, Stephen Hemminger Date: Fri, 22 May 2020 12:01:33 +1000 Subject: [PATCH 2/3] sunrpc: svcauth_gss_register_pseudoflavor must reject duplicate registrations. Cc: linux-nfs@vger.kernel.org Message-ID: <159011289297.29107.15128425916228317497.stgit@noble> In-Reply-To: <159011265914.29107.13764997801950546826.stgit@noble> References: <159011265914.29107.13764997801950546826.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 (v2.6.12+) Signed-off-by: NeilBrown --- 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;