Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp462143pxb; Thu, 7 Apr 2022 09:59:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwk9MRsD3a8l8HuT2KL/PH5NSSkoloFKOEO9g5ZwlTUfdampMTtsaPVvTkM0eZdrZj6Zbt+ X-Received: by 2002:a17:906:1b46:b0:6e8:4cc:b381 with SMTP id p6-20020a1709061b4600b006e804ccb381mr14219377ejg.563.1649350788840; Thu, 07 Apr 2022 09:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649350788; cv=none; d=google.com; s=arc-20160816; b=GO2DLHJUxYx3lRLJBsDtcd6GXUDKd/SOvVnJE01AthsYOiJBiM4IgD4aCALm0W4K0D 2HjVO5cn0he09+ntdxBx43MXMqePYXlOS8frLAcBJQTQlCJHHQMBD8tQOtc27Q31wOyc GwjEoZoa7seDjFZ09gVei/NQXnogNW7ya7WEgKLu0HSVAK5pt5R4Ec1N0hvTsaBYB0MC nRw++9VenfdK8Z6CLmkL3oZCVpc8M1TeZljnh7/in1xUsGDf0QA5hyc668npBOp8c8IU kl++7HhjfcmOAY6nZwwET6V/Uu9MSm5eOw8ayReRRBkMTVfGDkgeLzT35wrGKa+Zc3R4 p8pQ== 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=me+LlITHG061eiojKGFEjoJ+nnFAcrvddWKe8CcoC/E=; b=CBW7N6stMg4IWV+bdj0EQp2OINO7cER5o3N/J89yXCO/M+8BJBfPIgJCBS91LMMxJm SS18UtFXW8ldW9HjRC34zLnWKhWIOr/2HnqF4QOZ39p3KvwfNoVB1LEFwvFfDaeN9FLS cQ7bIGGOZCwYdNX7Oe/bV8k+AsZc/Ic7/WEe3KS2toItepov860tcyzyeW3HO1Z0SSzn Vf+PZhspIt73oTmxlKOoVxDy/MOTPQ0wogK8XmULuePCguRJEio1SqJLMdphT+9+KoUs G5cc1XgtlU9UIRp+95c/ApkcDXR0AY4G4hazfMYY8pemto4aCBoatRlUJr1N5FSQ6UHT msxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PlTY2Bc6; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v17-20020a1709067d9100b006df76385d10si14759737ejo.432.2022.04.07.09.59.13; Thu, 07 Apr 2022 09:59:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PlTY2Bc6; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345188AbiDGPq5 (ORCPT + 99 others); Thu, 7 Apr 2022 11:46:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345131AbiDGPqh (ORCPT ); Thu, 7 Apr 2022 11:46:37 -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 C872AC6EEB for ; Thu, 7 Apr 2022 08:44:34 -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 D5DA761ECD for ; Thu, 7 Apr 2022 15:44:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE9BAC385A5 for ; Thu, 7 Apr 2022 15:44:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649346273; bh=w8nqzRSE2X/ijqhm1W+uvklvYb3WU3hFSLvEYTI4jWg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PlTY2Bc6kMhji+YCNY1zbyjEA9KYR4/0m7gKdJpVQkdKM69s4wLHQlCvlRdofLsDf Fk7kKqpAEFuW0C1mnDUhBA2W7oXtwSkb8KmfGz1Pwh1QxjOOWxcVMg8fL8gjcb8Hms szVyHCJAVhyxiQrLr1aeGJY3M2dbOhPZxrOicuO7FRXV04lErIj2aNIo3BsK/w1ZrF iEPz5hXkf4YC5dl1XZOa9tv9h5JlO8NavxH3uEp2srkXcOEqbd0pfPYQyqJzyvsglb 81fSGl+JbkPDJ/+YRxlN2DXsDPyf/9TAfMwkyosWM7H+LWU2u64Fh/PGDpWgUGOzbu C/xz/JeVzAodw== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH 5/7] NFS: Ensure rpc_run_task() cannot fail in nfs_async_rename() Date: Thu, 7 Apr 2022 11:38:07 -0400 Message-Id: <20220407153809.1053261-5-trondmy@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220407153809.1053261-4-trondmy@kernel.org> References: <20220407153809.1053261-1-trondmy@kernel.org> <20220407153809.1053261-2-trondmy@kernel.org> <20220407153809.1053261-3-trondmy@kernel.org> <20220407153809.1053261-4-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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. 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