Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3623696pxb; Tue, 19 Apr 2022 06:49:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxX6zp3h5U2IoiD4kH6R/9w3BMzFiezJcCfTqUB5xDb7Hv2zaxKuEYbm1i2ltRn+BzZOn3U X-Received: by 2002:a17:90a:2b0f:b0:1cb:a3e5:413b with SMTP id x15-20020a17090a2b0f00b001cba3e5413bmr18708123pjc.115.1650376175833; Tue, 19 Apr 2022 06:49:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650376175; cv=none; d=google.com; s=arc-20160816; b=jrWsQKhARd38LlDcH+ztBLb+TRzL3mjRikGL8qC10Z9aVn9U1lzpXksvZomBbt8P7h CSfmOwX8MrLw6ioQhaH3Kh0j//HsDTYQ3hQ2Mroehjrppkiti2rU6/DnGnFJoDnZWpik cefDsFL2SFTzt+ifvAnLwh+ryB/iHdUeTfdvKvEIIbJiOUbzM/RzdpI8r7gEaaIXYoAN 6+qnBZ24305Jx2bQl62Ou01GQraIM7j+xboobytRCdVXvT1h40i15n0UJ8Tl18GGCmql 9EkTG6ImNIZBt+ItrjlL+2rsT4MoJvm2GCElaor9BTDkunAhJjpJnt58MfXa9ly/kSfW uUCw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oSGWrUW4wYTdyzygdYF6vBr6zMixy9gs/XIzQDssTQg=; b=jEitNyfYVaZeuVKLE2puaYxqcKbQ/DARHVsbu+INlWd7Uk3vPHmI6rMW44bPs8vLd7 NnADQFhGTPZ+brTvmomLWs36S30xklhz4LrJgD9RnNYL6G7wzpePDUoaPv78vkPTsc1G RL6/YOyZsxJ1rSYzmKdwWA8azgn7OMZ+sSOCuMUdvhwC1eJj7jWHPCuYA8M75IdI51vL 6gA0vZoaOzttg5MRxM94fQRJYHAsPA+vJa2PBluUA1NAhdB88jp5VWxaaMOJohhy1mBT AfTp5uVeRAONo1lXuiuprvSGTKECNYtx3pE1SQV/ikryyXIrEkI2NJYJSOXYLSazA05d 623w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wCNrP5y6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u16-20020a170903125000b00153b2d164b1si11957696plh.185.2022.04.19.06.49.17; Tue, 19 Apr 2022 06:49:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=wCNrP5y6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241016AbiDRMjy (ORCPT + 99 others); Mon, 18 Apr 2022 08:39:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239789AbiDRMd2 (ORCPT ); Mon, 18 Apr 2022 08:33:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1CA61B796; Mon, 18 Apr 2022 05:26:11 -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 A9E86B80EDB; Mon, 18 Apr 2022 12:26:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED991C385A1; Mon, 18 Apr 2022 12:26:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650284770; bh=7lAvJYzy1QYp8+7W7uKPyGmGnOkYsJY8pHmnEPIg9bA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wCNrP5y617BKmWRSvpd9+RguckciNKFVLb2DNsoyAMOXMXeILJEQrgBxaaTkDDEHH Etb5bIigvpPyQQpoXr/ijOD7an3rloW6q+qgoxlY2s2lkOvXaHuihNTWGKDukRuuxj Jc2qhVgjaAH+Z1T+apuUtZ9RAa71f741noaDyFuo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe , Sasha Levin Subject: [PATCH 5.17 172/219] io_uring: zero tag on rsrc removal Date: Mon, 18 Apr 2022 14:12:21 +0200 Message-Id: <20220418121211.694562414@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121203.462784814@linuxfoundation.org> References: <20220418121203.462784814@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 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-kernel@vger.kernel.org From: Pavel Begunkov [ Upstream commit 8f0a24801bb44aa58496945aabb904c729176772 ] Automatically default rsrc tag in io_queue_rsrc_removal(), it's safer than leaving it there and relying on the rest of the code to behave and not use it. Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/1cf262a50df17478ea25b22494dcc19f3a80301f.1649336342.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- fs/io_uring.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 6f93bff7633c..53b20d8b1129 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -8536,13 +8536,15 @@ static int io_sqe_file_register(struct io_ring_ctx *ctx, struct file *file, static int io_queue_rsrc_removal(struct io_rsrc_data *data, unsigned idx, struct io_rsrc_node *node, void *rsrc) { + u64 *tag_slot = io_get_tag_slot(data, idx); struct io_rsrc_put *prsrc; prsrc = kzalloc(sizeof(*prsrc), GFP_KERNEL); if (!prsrc) return -ENOMEM; - prsrc->tag = *io_get_tag_slot(data, idx); + prsrc->tag = *tag_slot; + *tag_slot = 0; prsrc->rsrc = rsrc; list_add(&prsrc->list, &node->rsrc_list); return 0; -- 2.35.1