From patchwork Mon Aug 4 06:24:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 4667171 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 987FFC0338 for ; Mon, 4 Aug 2014 06:25:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 79A672021A for ; Mon, 4 Aug 2014 06:25:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8BDD62017A for ; Mon, 4 Aug 2014 06:25:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751326AbaHDGZX (ORCPT ); Mon, 4 Aug 2014 02:25:23 -0400 Received: from cantor2.suse.de ([195.135.220.15]:52685 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751053AbaHDGZX (ORCPT ); Mon, 4 Aug 2014 02:25:23 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8F885AAF3; Mon, 4 Aug 2014 06:25:22 +0000 (UTC) From: NeilBrown To: Trond Myklebust Date: Mon, 04 Aug 2014 16:24:00 +1000 Subject: [PATCH 2/2] SUNRPC: remove all refcounting of groupinfo from rpcauth_lookupcred Cc: linux-nfs@vger.kernel.org Message-ID: <20140804062400.7621.4909.stgit@notabene.brown> In-Reply-To: <20140804062225.7621.70050.stgit@notabene.brown> References: <20140804062225.7621.70050.stgit@notabene.brown> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP current_cred() can only be changed by 'current', and cred->group_info is never changed. If a new group_info is needed, a new 'cred' is created. Consequently it is always safe to access current_cred()->group_info without taking any further references. So drop the refcounting and the incorrect rcu_dereference(). Signed-off-by: NeilBrown --- net/sunrpc/auth.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 794fc0f4fc4c..df2bd96f129d 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c @@ -595,14 +595,8 @@ rpcauth_lookupcred(struct rpc_auth *auth, int flags) memset(&acred, 0, sizeof(acred)); acred.uid = cred->fsuid; acred.gid = cred->fsgid; - if (flags & RPCAUTH_LOOKUP_RCU) - acred.group_info = rcu_dereference(cred->group_info); - else - acred.group_info = get_group_info(((struct cred *)cred)->group_info); - + acred.group_info = cred->group_info; ret = auth->au_ops->lookup_cred(auth, &acred, flags); - if (!(flags & RPCAUTH_LOOKUP_RCU)) - put_group_info(acred.group_info); return ret; } EXPORT_SYMBOL_GPL(rpcauth_lookupcred);