Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2250383ybg; Sun, 27 Oct 2019 14:23:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxlL4BRKIOIQxFZUtxOtKokhVZuN5PNd9kCH9eIz1suZvUeytBOm9sfvMABMzaqyE2LAMk8 X-Received: by 2002:aa7:d60c:: with SMTP id c12mr15314559edr.14.1572211390713; Sun, 27 Oct 2019 14:23:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572211390; cv=none; d=google.com; s=arc-20160816; b=PvQE45/fesIXHOPKYarAh2Ujxl5TexAPx4RkLat5TqjIEj94gMAXzjg67nuZ9A5kTw GGAmiLNMXd+Sd6mV8dZwZ4MqJI+yEIj8TvdP1yAphUEr4skCFFqP/0qRe5zyAArgthiW qtbX5DaivXzBh0Z5ioDUE8h7BQhs5w1ZoqyyuwO4hMFpG3sVXj2C20bEf9lkT0XKQFad LeEeHNMu4vMsHWdsRfb4SZfo0PaBhZ81/gOzFvIA4cKqvIuPzCtE+iKKAS/U1HUVnEYA OGD9v4B/av5nZLLGebPS2H4i5UJ1OgKyhqfNVwgX2IWn7gNWll6tOKnFzezFR2wX6Uw4 jJNw== 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=KpjqR/2Vvi22B0IJFlTdpw/IUSBOhLtFRYcbakhn+1c=; b=PcpRbdl3DARyXQlXu2IdgaSMgGFqpUUH/2DSELJMIEwVbjUWf7hUmSbe7+LGp50uGV jB1nou7im/c5c2hyKioh6/snU+ddZB0ZpMvs/IGRN+mJe1tSbVwDndmbizUQtHIvyUAU zhAf50yfolwkSzfRSIsyK4sWiGmlIu41MrlAl5KJIflK298oNAwYoul7XRCWOhPL04LO IITyJnCNXnY41YS9K4v5jP6EyDt2pfgDo05QVeOFzHcTjVc8KNMXVMhHWTVG/7W7dqfu myj8xHvO3mz4fZLmT6tr/roOa+VPy0h8kjj+5XEVbHG+TwMTSfZuGLycGjRAFK3XS+Mg eNnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qW6gfRnt; 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 hb23si5137089ejb.377.2019.10.27.14.22.47; Sun, 27 Oct 2019 14:23:10 -0700 (PDT) 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=qW6gfRnt; 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 S1731910AbfJ0VVU (ORCPT + 99 others); Sun, 27 Oct 2019 17:21:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:42090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731895AbfJ0VVQ (ORCPT ); Sun, 27 Oct 2019 17:21:16 -0400 Received: from localhost (100.50.158.77.rev.sfr.net [77.158.50.100]) (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 6314121848; Sun, 27 Oct 2019 21:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572211275; bh=xHR9OMdzYSwoecyvK/JKv1Hak2Yx3n4gMedLK0dao54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qW6gfRntlQ7BDX+xaroiPjATgW7Vartf5WwK8llpihySJS0xE4ELZtXLs3TXfyCZl g/pI2A5sJVYwu+kCDWoiOwJ54oEK9rRj4zBGN7CA9XxD3ekZSHvgX4UGOR/2jvAhzt FGcKL+QCMEzpOphXvrFEElkLUCCBMZ06e9fBsdrk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 5.3 095/197] io_uring: Fix corrupted user_data Date: Sun, 27 Oct 2019 22:00:13 +0100 Message-Id: <20191027203356.899292969@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191027203351.684916567@linuxfoundation.org> References: <20191027203351.684916567@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: Pavel Begunkov commit 84d55dc5b9e57b513a702fbc358e1b5489651590 upstream. There is a bug, where failed linked requests are returned not with specified @user_data, but with garbage from a kernel stack. The reason is that io_fail_links() uses req->user_data, which is uninitialised when called from io_queue_sqe() on fail path. Signed-off-by: Pavel Begunkov Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- fs/io_uring.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2157,6 +2157,8 @@ err: return; } + req->user_data = s->sqe->user_data; + /* * If we already have a head request, queue this one for async * submittal once the head completes. If we don't have a head but