Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5998856ybc; Wed, 27 Nov 2019 13:09:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxhV1frxAFFtO4nWu6vnGBQzsvN/FURFwozAW+x/6L0fakSy/tRqcmE0WsIFlLIvixzp0kp X-Received: by 2002:aa7:d517:: with SMTP id y23mr3616367edq.213.1574888961745; Wed, 27 Nov 2019 13:09:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574888961; cv=none; d=google.com; s=arc-20160816; b=yAm8bNDqnIWmiOS6JIjL83r/vNBPG7LMZitwaAz4pSR/7CzkV4V53C+WugyfmoCjF4 7LGtwHD/60CKywUdPO2BerotlEMVZH7QEF1rq4Sbsf3NGERJ+u8KENGep6hmM2u8FD1Y +stQGSJEyOQKaQFKV0VqlITaUgiTn/omzK49sM+spSHYU9IHxSTxPPL49cDBkBOI5Ezj jUnvrqsUdRQTaUB0mdLCxTh9XRFWmrcfHx5m1cD8TIAO8i3E06RSY1HKgs5KMb1k/iS4 jGTXQ7YYFIR9QRAhCC1GK3GbQiaqt4QuDpekWB6uwrfmhjxMHuUdJNCtMPSfpjpayKc6 X+cw== 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=983uCcMArufXvKTKWdwm9DBwCf1ve5C9mLbIyxUKUAc=; b=yF8iEtyDGhuYDS1cg4wu7SE98sAnOZICF11eE3YcOPQ/+yv+W1iEXNmtk1JApj+9Dr WnGVTbE535YdSsn1ypOVo/X5kQCIEwj4y6WaxsjRgPP5Z4/fS6ury10am3b6JkWBqOsF tmKhdD0T/VDkXFCOawxl+p5/vr9aoUwOlycIu3m+kHDnWUuOmtLhiiVRZgMFjJvltIru axbRYuZc0QwLp3+LpfMmqP9Ns63uEtbw+FSkWW24+VesfY28ljWPg7qCCNeWPsCYj7uG JzpbC9INvuC4p+2tF7Yge1ITjUGZSRxGOjm9GX5KqKshHdZyy9Ym3/w9Xjn53Fp4Nj96 Uecw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VTwUfNtv; 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 e7si12637439ede.66.2019.11.27.13.08.58; Wed, 27 Nov 2019 13:09:21 -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=VTwUfNtv; 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 S1732596AbfK0VHW (ORCPT + 99 others); Wed, 27 Nov 2019 16:07:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:33486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731987AbfK0VHV (ORCPT ); Wed, 27 Nov 2019 16:07:21 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 1855B2176D; Wed, 27 Nov 2019 21:07:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888840; bh=3zZtjhCk8Ii8Ma3TZ07AaIFsbKaaFjikQMnZkSiNm8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VTwUfNtv3BZn+R7yNGuI0myKu+1UWs1zssJB1zWFByfEP4SggBoLI+2DlbMcBROoB 45MmaNdWFP3Rhkk3k/6iDViAsmVQGDNEr6nYqwJ1x8UMiP3GTHDqO0WOIQcbCJw0kj 1gGZLMgjPYsyF3tDo9UxxxqzoE+Yz4CE2CsOXyfU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Halil Pasic , Michael Mueller , "Michael S. Tsirkin" , Sasha Levin Subject: [PATCH 4.19 291/306] virtio_ring: fix return code on DMA mapping fails Date: Wed, 27 Nov 2019 21:32:21 +0100 Message-Id: <20191127203136.015950334@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@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: Halil Pasic [ Upstream commit f7728002c1c7bfa787b276a31c3ef458739b8e7c ] Commit 780bc7903a32 ("virtio_ring: Support DMA APIs") makes virtqueue_add() return -EIO when we fail to map our I/O buffers. This is a very realistic scenario for guests with encrypted memory, as swiotlb may run out of space, depending on it's size and the I/O load. The virtio-blk driver interprets -EIO form virtqueue_add() as an IO error, despite the fact that swiotlb full is in absence of bugs a recoverable condition. Let us change the return code to -ENOMEM, and make the block layer recover form these failures when virtio-blk encounters the condition described above. Cc: stable@vger.kernel.org Fixes: 780bc7903a32 ("virtio_ring: Support DMA APIs") Signed-off-by: Halil Pasic Tested-by: Michael Mueller Signed-off-by: Michael S. Tsirkin Signed-off-by: Sasha Levin --- drivers/virtio/virtio_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 9529e28e18222..6228b48d1e127 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -431,7 +431,7 @@ unmap_release: kfree(desc); END_USE(vq); - return -EIO; + return -ENOMEM; } /** -- 2.20.1