Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4487455ybx; Mon, 4 Nov 2019 14:14:38 -0800 (PST) X-Google-Smtp-Source: APXvYqw4nZlo3AmwQ22xB/Wud5F9xQKDAU4zPQvAdGrFjUDjNX4ohoYdTWK6VARdEbJqQqkURatj X-Received: by 2002:a17:906:1354:: with SMTP id x20mr10788664ejb.131.1572905678886; Mon, 04 Nov 2019 14:14:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572905678; cv=none; d=google.com; s=arc-20160816; b=cybKFfkAp+g9TZRfKa384cLRkQ2Z9pS8RgjpyLPYD/pP3rgLbjlGNIsxHIX5jqoVqc iZ3dKULnRi5yjJLplUCvX6AXcORvzK2MSpdST75oHavP0z9/Bn+mlWNXxIz7ZGdT5r1T mBGUO9KZ1C5gekmB0hDFrEjzC/hfX3by01J7uxebY3CnAGBgSReWtIraMg+3A7Caeu4Y izEwJ+WGPduFLo4NwigHR9kGAlowey+dMLJpc19Knj7wJqDxjfEPjeQr2KFD6RpxkwEY JLVJhpBHFae3Vj4XTWBVE8ilFtYJXkWLEXV58/vgNUP6cTohzxxNd00Ae9UA/gPvkFea ZELg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=R2pliwTKUnPdHcl/OqEPTyau6Bo+pMhLvFmGu4sZbGA=; b=RXOEMm32+rLdgz089yrYHn8VZnSfgSqMbTQtjoCjxD8NnZrHsXt+xvVr5KitIkQTpE +29psMJ3obwohCk32UHVWJMyNjGcg+cydpQi0jjo1d1mQ7YUHpu/wFBRQG7vKb4WMnfj xS4IAQkXE++4FPZGOLfMTTo3nGFn16lA+39eR+vIH3bqzF6UeKcpgUSgf7XZpG9rjqLp PB66ut27PUm3GZm4R0ebV/40AcvILRHM+7XvYcjtp78zdELBggEl6r2kY17ATQWiZZyV UHuVxPItCTvJCVV0N+hiumvIqK5j0iaRNlcWIkrJxVPMxBn5mo8HRXS19nRttz3eiE8Y P/LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=p5h0Y2pL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w7si8483873edj.96.2019.11.04.14.14.15; Mon, 04 Nov 2019 14:14:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=p5h0Y2pL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390697AbfKDWLp (ORCPT + 99 others); Mon, 4 Nov 2019 17:11:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:45094 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390713AbfKDWLk (ORCPT ); Mon, 4 Nov 2019 17:11:40 -0500 Received: from localhost (6.204-14-84.ripe.coltfrance.com [84.14.204.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E106E214D8; Mon, 4 Nov 2019 22:11:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572905500; bh=guiaCEQRulnqPPe4LKaYat2ZR/CL0oCOT0xWw2Mknns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p5h0Y2pL3T6ta/CVvdsNVP6KE+hZgwjs6zyxJixxmV/3i9VUTXIbLevIzonEqCGj5 FB6H+gDB5N/nHEMyT8Ul3X/mUyzZPcAKKXnuFnywbGkW1Bgsd42/ZTHHzFeYWb4On4 XgBI+tNZXFK4rT1Q/t4GYi5BWjaMb2l2xwEfBwQs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bijan Mottahedeh , Jens Axboe Subject: [PATCH 5.3 143/163] io_uring: ensure we clear io_kiocb->result before each issue Date: Mon, 4 Nov 2019 22:45:33 +0100 Message-Id: <20191104212150.683214210@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191104212140.046021995@linuxfoundation.org> References: <20191104212140.046021995@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jens Axboe commit 6873e0bd6a9cb14ecfadd89d9ed9698ff1761902 upstream. We use io_kiocb->result == -EAGAIN as a way to know if we need to re-submit a polled request, as -EAGAIN reporting happens out-of-line for IO submission failures. This field is cleared when we originally allocate the request, but it isn't reset when we retry the submission from async context. This can cause issues where we think something needs a re-issue, but we're really just reading stale data. Reset ->result whenever we re-prep a request for polled submission. Cc: stable@vger.kernel.org Fixes: 9e645e1105ca ("io_uring: add support for sqe links") Reported-by: Bijan Mottahedeh Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- fs/io_uring.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1078,6 +1078,7 @@ static int io_prep_rw(struct io_kiocb *r kiocb->ki_flags |= IOCB_HIPRI; kiocb->ki_complete = io_complete_rw_iopoll; + req->result = 0; } else { if (kiocb->ki_flags & IOCB_HIPRI) return -EINVAL;