Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2387611pxp; Mon, 21 Mar 2022 18:48:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1ga97tVIuCw7a4PTJ79t77H5KGWcIdVdKZIKN6i2QvqUKji2nRxF5YnOj/YDu60oXrp7s X-Received: by 2002:a17:90b:3508:b0:1c6:e4f9:538b with SMTP id ls8-20020a17090b350800b001c6e4f9538bmr2247074pjb.158.1647913714955; Mon, 21 Mar 2022 18:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647913714; cv=none; d=google.com; s=arc-20160816; b=MnzMbUwLfshv4nPn7/wE1xZyDvxJG2ucqG/9aZUkRkUeRdEOb0hI1xbH/nlK0ovMru 5KN1LJXSqXf/IUIS4W7XfSuhf36UyxEv8ZrXy8FAF1snBVLBBRabY1MN+t5PC6PBvMwo BkFvtPbK4a7oXeE1nBGDUN1Vqej+Fj7B9ddG3vn/vekGclcWKtO/qCxDPOF1ZOSPyP3Z h0AN14ZavrpwTsc7ZQVA1OJbD6wrNPjk8V5D/m4m1O6MBsOBoJ6ca6nNUhGdBJxfkHan AAwIXAz7waiH50J/VR3sNNmnzIaXaaqoe3crfTwWSF8t1vzSfywwkVNJOTvf+SgmMcSf zuuA== 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=UcGNEzH3aF+p7Uf3GKR1x0agDbGTL8bctvvnjU5DWkUj+riSUr8UylBf1PcheiI5rr jnDtmErfgy6/1YJwRyqmXo9jyjY99c1VYO4E9DOxJbD6h9feRt9TDmVAOOTwMLoBLG6s Cd9/mBlJtketAo/+2YJ/BbQB3DI8KUXRNe0svh2ybQGKIMV9dhkN8x5iDIoKmX61nRaz m6qhd3G1sROWqkOQg3s+D9tBruwIIfnRjDIU6WMxwRE5wJnYwKoNQ8uWeUYIAHbKpHjb SXjbm5CY/arVPS7qLpf0Obhril+FjkcaHgTaHZepYEEm9nO9ISkwmse7vHpM4/efnw1Q 1Y+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rXH+CbFk; spf=softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id w3-20020a636203000000b0038207e0091dsi14440071pgb.249.2022.03.21.18.48.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 18:48:34 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rXH+CbFk; spf=softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 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 C70FA1D0D4; Mon, 21 Mar 2022 18:22:31 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234621AbiCVBXz (ORCPT + 99 others); Mon, 21 Mar 2022 21:23:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234622AbiCVBXy (ORCPT ); Mon, 21 Mar 2022 21:23:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FFD4289BC for ; Mon, 21 Mar 2022 18:22:27 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 50C87615E1 for ; Tue, 22 Mar 2022 01:22:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A852C340F2; Tue, 22 Mar 2022 01:22:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647912146; bh=t/mlxztyxuPpL7atLJv6aKFd6EHiGTobdIHMn4ysQIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rXH+CbFk4b8dW5ck0H8clQdF80O2umrC77b0xkWZMrgwaU9w6DpgUJklBL+6HmxVM LfssBO6kIWQJU4eg5t3BRXXZ9jvQWHABPmvb/DnPsCEpQ4CNjbESwLvHA6h4m5gpzE 4AxvVg2282nze0SkftB9RzWlT9fe3nkFscFuS2JcoKkvnBP5FYnPPXy/jSFk05zAEH dMcPik2A+ChxkJ63mkcqZM4oOOC49yFZx6PUWK8C8GzKtta3/bPoSE396aIHZzCca+ Irv4w2khkXMsLIRQc2dVKIECA7v2VrCDAjmRJIxrtSsq4C3PP6QP2ZqyT47CiqxLfp LYWakWDGkx96Q== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Cc: Neil Brown Subject: [PATCH v2 3/9] SUNRPC: Fix unx_lookup_cred() allocation Date: Mon, 21 Mar 2022 21:16:12 -0400 Message-Id: <20220322011618.1052288-4-trondmy@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220322011618.1052288-3-trondmy@kernel.org> References: <20220322011618.1052288-1-trondmy@kernel.org> <20220322011618.1052288-2-trondmy@kernel.org> <20220322011618.1052288-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