Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp541318ybt; Fri, 19 Jun 2020 07:50:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6b2H9K4jCZWF423+ziQw6KWqivonjygR1zGFlojHT4AdskJNKzrqTJcemZrfAvJ9XsbxV X-Received: by 2002:a17:906:7c58:: with SMTP id g24mr4223163ejp.205.1592578202594; Fri, 19 Jun 2020 07:50:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592578202; cv=none; d=google.com; s=arc-20160816; b=v10Qdz0p/rO20e1D67b4TfGDsQ68ELJnBDg91U8/OuGWCwKB11C4CK8n+dor8DEYSa muyhvSOtuyhbyucwZrYS6o41XBG8jrq7+iwVoMW2qcydLwfzUu0vAkuxcOfD1ThTGA7V iTHnrB/mUQdX4ufkQoriyu3scT2WI15zjOGOafxR53E0z6loRppuR2tAcmN16IBPI3ra ccJSulL79Kfsyq7JTWkVM4db26XVJrQkwTJskEaKU+kpow8ZOVTBUQ+JtvTgLPmp8J/I JWNl2yRPlBdBz8mQRQ06MfdAzBcw/M24Fl2/M5niWRK1g14gQbQpGXE9oIlpPOQn/n3G nr4g== 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:date:subject:cc:to :from:dkim-signature; bh=vuHwfRdRkU1X6psS5HoyFqXQYbBg7ySQrXTP50TFpXI=; b=Vh27s/X6tX5hz+pOOg5K4Z34Igv6n4bFSV9On3a6symBmKbEmQl8i7oiVqWwIVbyiJ SPy9eUP3Hw1ZNapvZp32oxnGjU83jCYgrRyAL85wx2sJf4ih4Us8iH45e1zLY9TIU+57 8MuOMVSdfIAlp3fVxO6W8tqH70e2CGbdXiANC1gCfsHS0+YIv3lnFX1lIMQ3WmV88k44 5Gh90Y8wR4SGULkDW5bz/8Z7ARHHQHsz2ZlRUvXsorrZa1Pc9GeG8i8YGfrVIXrtITNF ODF+N2SY75oCrSgLa+dq2G/UP/u5GgeJQVzlzTuvzAPSU74UUCqs8wnGokapFQbUvSWy FD3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nWW7vKmu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 ss2si3957647ejb.1.2020.06.19.07.49.40; Fri, 19 Jun 2020 07:50:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nWW7vKmu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388655AbgFSOpH (ORCPT + 99 others); Fri, 19 Jun 2020 10:45:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:36034 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388511AbgFSOoq (ORCPT ); Fri, 19 Jun 2020 10:44:46 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D698D21556; Fri, 19 Jun 2020 14:44:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592577886; bh=hvxXd98s1xuuB7y/wMyWIq6EcmcDp8SLLGhH+YGV4hM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nWW7vKmurt21fiDv5bIVTAN21hRQoS7POH5N2lEw4+L8e4BB8HHl61/QdPG8fw5pj fjP3oCqEymX7zIijpmn3dMjrJqGTbdoFK9h/dR+JdyAy49nAFfedM2/ZrzX1G3eyOi EQHTnlhE63A0/T/Ra6/Py67oLnx5MESnfAPWT5aY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, NeilBrown , "J. Bruce Fields" Subject: [PATCH 4.9 122/128] sunrpc: svcauth_gss_register_pseudoflavor must reject duplicate registrations. Date: Fri, 19 Jun 2020 16:33:36 +0200 Message-Id: <20200619141626.552690183@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141620.148019466@linuxfoundation.org> References: <20200619141620.148019466@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: NeilBrown commit d47a5dc2888fd1b94adf1553068b8dad76cec96c upstream. 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 Signed-off-by: J. Bruce Fields Signed-off-by: Greg Kroah-Hartman --- net/sunrpc/auth_gss/svcauth_gss.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c @@ -796,9 +796,11 @@ svcauth_gss_register_pseudoflavor(u32 ps 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;