Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp596684iog; Thu, 30 Jun 2022 06:45:01 -0700 (PDT) X-Google-Smtp-Source: AGRyM1txt0fjwYvgeCh89Y87WJKsqSAX6/ECc+znWFjWKBUK+TQTEhLhsdPA9EBlYtRgF+KnaXV7 X-Received: by 2002:a17:902:f642:b0:169:714:b079 with SMTP id m2-20020a170902f64200b001690714b079mr14556879plg.117.1656596701059; Thu, 30 Jun 2022 06:45:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656596701; cv=none; d=google.com; s=arc-20160816; b=JOtEEIDPTR8ER8Ilm8vhq8lWnzfb8XjBn/Y7Sfh4cTM4jTsFdeEmVVfPm5TBiZAl+A o7AVJ8ayQFvqU29UeJFe3PjUCGWB7Mw0oZ85/uaLUxH2KoQ0xckWBsfr+jCRkPC060nD AI7abku8vFJWauARqItzck9m6k+cGUPkKYVBCNaUDupdNrucFXklhlW24YCwrXnK6SYd 5GMKroIp9rvERIsaYVH+RCFn/FQ+q6kTxazW1IcAgyDlidIa/Ck85L+ItUOlWHPVUnXf dUevnFP1RF9DgdUy2dhZ2eiT2ngUmbuN33boKedJ282n/As0BWng++zvmgFa7g/AS/Qv 9ikQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=ZfX4dx+zHt+aWKlD2KZYhsibCaLAXeLuK8UfcMVi5VA=; b=wesdni/GuJ2MXQH+zxqKsAbw150R7IFUhQlokJ+RkN42ZwaHqVvvx4MNfCrMpd3Y4i wVF7ij7tvMD//5GdnIqTtMJZmABWJTD31mN7O0QOwvfmJp+A6J9eGthOBfrZcTNuijF3 72mgINkT+BNk7cWDRRmdvpAWi0r/CEIoXoKldjP2/r+OqggxjgK5LQFEL+qQveSMQI6q yYA6B8KWA9KfzjFMEWKCVD2Xt11Hd2zj6A/HQddwrKkEuPbftOyp3G9PsKcrM0mOKjTJ KG96/7+XDWlh+3WS6kYvZJBNyTbMewBELjLWAeTt6TGrIgxy8RQ0Z2pxVIiB4gFCZv0q Xf/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=UrR0gtor; 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=REJECT sp=REJECT dis=NONE) header.from=fb.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id je11-20020a170903264b00b00153b2d1659esi24005029plb.422.2022.06.30.06.44.49; Thu, 30 Jun 2022 06:45:01 -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=@fb.com header.s=facebook header.b=UrR0gtor; 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=REJECT sp=REJECT dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234738AbiF3NUu (ORCPT + 99 others); Thu, 30 Jun 2022 09:20:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230400AbiF3NUt (ORCPT ); Thu, 30 Jun 2022 09:20:49 -0400 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E797D2E681 for ; Thu, 30 Jun 2022 06:20:48 -0700 (PDT) Received: from pps.filterd (m0109334.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25U7Spxj021262 for ; Thu, 30 Jun 2022 06:20:48 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=facebook; bh=ZfX4dx+zHt+aWKlD2KZYhsibCaLAXeLuK8UfcMVi5VA=; b=UrR0gtorEBKBaIo/GYkV5z1yCKX9H9KizbmtWxktyKsnl4TurcOdUdThksAtnKWoK4M5 AdOJVTHkjyunQ7FgdkaUjn4isFURSXr5pRTuieHdVN/0GD5Qflv31wqQWl9Wsf5MadaK L5vnl90yussuvU7GojV6N+yWcIXiUY7LYrg= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3h17fmht1h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 30 Jun 2022 06:20:48 -0700 Received: from twshared22934.08.ash9.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 30 Jun 2022 06:20:47 -0700 Received: by devbig038.lla2.facebook.com (Postfix, from userid 572232) id A33BE25B9454; Thu, 30 Jun 2022 06:20:16 -0700 (PDT) From: Dylan Yudaken To: Jens Axboe , Pavel Begunkov , CC: , , Dylan Yudaken Subject: [PATCH 5.19] io_uring: fix provided buffer import Date: Thu, 30 Jun 2022 06:20:06 -0700 Message-ID: <20220630132006.2825668-1-dylany@fb.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-GUID: bT-a-VGO7Tn6QvQPV5S5-U_d5UFuxlVC X-Proofpoint-ORIG-GUID: bT-a-VGO7Tn6QvQPV5S5-U_d5UFuxlVC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-06-30_09,2022-06-28_01,2022-06-22_01 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, 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 io_import_iovec uses the s pointer, but this was changed immediately after the iovec was re-imported and so it was imported into the wrong place. Change the ordering. Fixes: 2be2eb02e2f5 ("io_uring: ensure reads re-import for selected buffe= rs") Signed-off-by: Dylan Yudaken --- fs/io_uring.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 5ff2cdb425bc..73ae92a62c2c 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -4314,6 +4314,9 @@ static int io_read(struct io_kiocb *req, unsigned i= nt issue_flags) if (unlikely(ret < 0)) return ret; } else { + rw =3D req->async_data; + s =3D &rw->s; + /* * Safe and required to re-import if we're using provided * buffers, as we dropped the selected one before retry. @@ -4324,8 +4327,6 @@ static int io_read(struct io_kiocb *req, unsigned i= nt issue_flags) return ret; } =20 - rw =3D req->async_data; - s =3D &rw->s; /* * We come here from an earlier attempt, restore our state to * match in case it doesn't. It's cheap enough that we don't --=20 2.30.2