Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp33086pxh; Thu, 7 Apr 2022 13:07:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys0dwV2u+oE7YSd8qzj0iR0f7dOPrUDjxFQ7oigSv7pgue2UXq/Ar0U67R70HNM1ynwilw X-Received: by 2002:a17:903:22c9:b0:156:9c66:5cf4 with SMTP id y9-20020a17090322c900b001569c665cf4mr15442556plg.22.1649362021341; Thu, 07 Apr 2022 13:07:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649362021; cv=none; d=google.com; s=arc-20160816; b=acu9U0vMV1FeChu8CSK55UZwq6RGRlGMXTvamUjGzMJ8FF1TKHIXB5FbboXp/EXjD5 xRnXZn2qEcrdLIXmX4F37IdSsH8A+oijkD8zdU4Tfb/h31oROgOyPWcq6X5Bt/5ri8/F xaxCLw764Z8CYzaQ+QR99p5Zu966eFIdVuYwGuxhxoE5OpwA0/LQ0WMHhC9zjpKsKv2F YQ+/F7P1A3bf43AGvcnXNlQ0MSS5c6N2WyrFOddcFiien+3W0+aSp7YiflxiUzXgeXCu poQxzci5uLjVkLzngmIAneepsP/ADR+xQFWEaQ4P3QtQ+w6J39N7oKmE+C1mHg6vA6wY ubFg== 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:to:from :dkim-signature; bh=VV7GLXXS2ej9V/szY0NMQTHu8Xf/ma/M1roYSD415GU=; b=V9nOFhwOws5spVmsMfihWD6LxY4s15JNSQkw1UTYVhX3WpO94bXCzYW/HYpOrlGECc kwG09uEPZcJp8By0eAzKQOGN4J4b3G3FNNa3g/JpjOZI/Ehxftv6SIuqW6zD22tk1ZkF UM3rFA9Gn3I5+rHPZqM+ZevChmCUIMJ1HXxkiZ8jMW8K9e8rJxuzyo+G9tOucY0aBBz1 SBXegQ4D6MfUyx586ebTkanUV1FHdiyAklSH99jXWzGKsHemEDiwhJO42DNrSLRlQTPV bAsyvlCxQEtGu/6E9aeZ5nUoQCrFLAOt/QErjCggsB954ZdScDRskTEbQxKFAGYR2Q1W 3bWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=prNq6Kyp; 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 b10-20020a631b0a000000b0038653753857si19862477pgb.409.2022.04.07.13.07.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 13:07:01 -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=prNq6Kyp; 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 735E32A8DE9; Thu, 7 Apr 2022 12:30:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347003AbiDGSy2 (ORCPT + 99 others); Thu, 7 Apr 2022 14:54:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347005AbiDGSy2 (ORCPT ); Thu, 7 Apr 2022 14:54:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5C24194FD8 for ; Thu, 7 Apr 2022 11:52: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 7F69761DD8 for ; Thu, 7 Apr 2022 18:52:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2999C385A4 for ; Thu, 7 Apr 2022 18:52:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649357546; bh=Zscj20Ax5HbRGyhailQq0xwvJA8LRNJg/hclC6BAr+w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=prNq6Kyp0nk5e60FaFI1VU79hobISgr+5ob4JKrWBytBpFTCEmRsNlT0woKIUbKzy n74s82AdoshbMlWiGMGo8/CeLtLy0QXzE+aT30UttDBkshz6FqghqOQOlBQoY5TFnG GshykJa7l60Gl22PonFKEEVQBs1oZMQFQClhBxJxRAfS//eq3UDficZNzvAqo85PCN 79Umqek+CwNtHOouOmKIq0w5IAsFALcU49ZuFcsrkYGZDRms7SoaOaQL7TKDeehXhI iEKy5OL88pw5UZDLDw9OhlhvXo2a4fPez03Sa8JmduwfzDZ/nQpkmqRapZ7iZAsDEM dMZzTAcIEiKsQ== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH v2 5/8] NFS: Ensure rpc_run_task() cannot fail in nfs_async_rename() Date: Thu, 7 Apr 2022 14:45:58 -0400 Message-Id: <20220407184601.1064640-5-trondmy@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220407184601.1064640-4-trondmy@kernel.org> References: <20220407184601.1064640-1-trondmy@kernel.org> <20220407184601.1064640-2-trondmy@kernel.org> <20220407184601.1064640-3-trondmy@kernel.org> <20220407184601.1064640-4-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 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 Ensure the call to rpc_run_task() cannot fail by preallocating the rpc_task. Fixes: 910ad38697d9 ("NFS: Fix memory allocation in rpc_alloc_task()") Signed-off-by: Trond Myklebust --- fs/nfs/unlink.c | 1 + include/linux/nfs_xdr.h | 1 + 2 files changed, 2 insertions(+) diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c index 5fa11e1aca4c..6f325e10056c 100644 --- a/fs/nfs/unlink.c +++ b/fs/nfs/unlink.c @@ -347,6 +347,7 @@ nfs_async_rename(struct inode *old_dir, struct inode *new_dir, data = kzalloc(sizeof(*data), GFP_KERNEL); if (data == NULL) return ERR_PTR(-ENOMEM); + task_setup_data.task = &data->task; task_setup_data.callback_data = data; data->cred = get_current_cred(); diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 49ba486aea5f..2863e5a69c6a 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -1694,6 +1694,7 @@ struct nfs_unlinkdata { struct nfs_renamedata { struct nfs_renameargs args; struct nfs_renameres res; + struct rpc_task task; const struct cred *cred; struct inode *old_dir; struct dentry *old_dentry; -- 2.35.1