Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2405244pxp; Mon, 21 Mar 2022 19:21:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlWcLtwqMN2ASd7x7yomwfb2Z5gJfJ19DlZoVcXIF8RWUvYPhVFEvtruovkvWJ7lDoJr8j X-Received: by 2002:a17:90a:f295:b0:1c6:d4ba:abfa with SMTP id fs21-20020a17090af29500b001c6d4baabfamr2288314pjb.159.1647915704061; Mon, 21 Mar 2022 19:21:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647915704; cv=none; d=google.com; s=arc-20160816; b=CrYSp2O/baor1SAWlO75v3gFyFlCLhANZAjz/pIom9dlDkAawSUgvWwjfWASNTNiQh /cfN7HVNrIW0HFTxR2vYXNoX6wbtQRHql1z6PD8CAYEmU5+W1GGUlmcZnCa2e8g784nd wRtqFIHVTI77zGxPb5SePQT9qRxrws3lN10fy4KW5SQDTHaLOSdHRBFil4Ymm39SRMlc 0Uu/aC9hcz10ATsx+0JDAEazV41WJiqMEdMVROavr11BPq3JxSegwZnK4vzEIhhc+TyW 1+Vvzei99BJp4VQiNFHKC752DcM/7grgaqhIVk44mvbrXuzZtWXwK/PkbwdcT8pKOmmD LPQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=k293GmLy7cyFtYjNKSEQgOke9PdrLCopwFvBuq4Sdww=; b=fVE75Lo4sc03WbZNQdmfz+i3owm92M74R3Q4VdTyKyY9sRLXIhvR/Gv/M5U3I2lPzj S03vmDn8yDwwcCbMlAE0UjD+Dm/BZtFxfbbWBJLZ0Mu2sD+jyGIGEuyDq8HqouGNYOOj fwLjCMGVZABQU3gEkenU9uPZguQnFiVYUDs8T7jUXZiZrYpEE4B7NnVF9PYZh2yvb5Lz WvlEO2RpKvm83iiycUnAhzVcTZHkNbMwSBjYcZd/Zyief034rsHzIqS08pru37XoFOMb +JKXn/dnlGM0l57Fg+ATl6P79rMJcSENvpHEdh1eG4FW/BDKROOLyhBCKIArnoKnCCxT vxlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vH9DpKgo; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 35-20020a631463000000b003820705eb26si14500903pgu.593.2022.03.21.19.21.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 19:21:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vH9DpKgo; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4FE591D314; Mon, 21 Mar 2022 18:54:44 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235190AbiCVB4G (ORCPT + 99 others); Mon, 21 Mar 2022 21:56:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235200AbiCVB4E (ORCPT ); Mon, 21 Mar 2022 21:56:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4846113E26 for ; Mon, 21 Mar 2022 18:54:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F21D3B81B2C for ; Tue, 22 Mar 2022 01:54:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57D96C340F0; Tue, 22 Mar 2022 01:54:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647914074; bh=t/mlxztyxuPpL7atLJv6aKFd6EHiGTobdIHMn4ysQIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vH9DpKgoBKnbF6appKmgx9X0wsJKyr6pRkuXqX2B0JZabzPK2DHQZ3FB4NLiMWeo1 v6Sscy/IjpxGqE7ssRmzR3g6Wae6O30AAAFVg3yEFlwoWKON+SYvCq6Npho1KM58He kHjZ7itlLH1HHOiit7IjL1+jo2skQlhJjtTDypehYKhm/VnzdPd+ZIkYgvJuLrKFU6 Cg231XU8c8gmkvwCuFBNMB42R8s3aCH0g3PadO4vVdj4B9gq3Ko7s/VRavPY4OKhnf pSra8h8U/JE50G/csoF+doy0SRxuH4uCH/lnzcRKzbunujLzgM0daY/IwnKnr8yWSA 0F8JI4oFdTSgQ== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Cc: Chuck Lever , Enrico Scholz Subject: [PATCH v2 3/9] SUNRPC: Fix unx_lookup_cred() allocation Date: Mon, 21 Mar 2022 21:47:40 -0400 Message-Id: <20220322014746.1052984-4-trondmy@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220322014746.1052984-3-trondmy@kernel.org> References: <20220322014746.1052984-1-trondmy@kernel.org> <20220322014746.1052984-2-trondmy@kernel.org> <20220322014746.1052984-3-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust Default to the same mempool allocation strategy as for rpc_malloc(). Signed-off-by: Trond Myklebust --- net/sunrpc/auth_unix.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c index c629d366030e..1e091d3fa607 100644 --- a/net/sunrpc/auth_unix.c +++ b/net/sunrpc/auth_unix.c @@ -40,17 +40,19 @@ unx_destroy(struct rpc_auth *auth) /* * Lookup AUTH_UNIX creds for current process */ -static struct rpc_cred * -unx_lookup_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags) +static struct rpc_cred *unx_lookup_cred(struct rpc_auth *auth, + struct auth_cred *acred, int flags) { - gfp_t gfp = GFP_KERNEL; struct rpc_cred *ret; - if (flags & RPCAUTH_LOOKUP_ASYNC) - gfp = GFP_NOWAIT | __GFP_NOWARN; - ret = mempool_alloc(unix_pool, gfp); - if (!ret) - return ERR_PTR(-ENOMEM); + ret = kmalloc(sizeof(*ret), rpc_task_gfp_mask()); + if (!ret) { + if (!(flags & RPCAUTH_LOOKUP_ASYNC)) + return ERR_PTR(-ENOMEM); + ret = mempool_alloc(unix_pool, GFP_NOWAIT); + if (!ret) + return ERR_PTR(-ENOMEM); + } rpcauth_init_cred(ret, acred, auth, &unix_credops); ret->cr_flags = 1UL << RPCAUTH_CRED_UPTODATE; return ret; -- 2.35.1