Received: by 10.223.185.116 with SMTP id b49csp1020872wrg; Wed, 21 Feb 2018 10:41:49 -0800 (PST) X-Google-Smtp-Source: AH8x226dUpnZOFEnnkY5eTejrEGPGlrIHPEYO/rgcRzCvRqDQBGhfg5Nn+QRAxieNBMUFOjrfAkq X-Received: by 2002:a17:902:8492:: with SMTP id c18-v6mr4001554plo.40.1519238509317; Wed, 21 Feb 2018 10:41:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519238509; cv=none; d=google.com; s=arc-20160816; b=R9ztuldbJYZ+5L9HP+1C2a/Z3yvR/cegk+KdRmybN8eYCw5u1Leue38V+amLN55FGS msvtwoUNxHBSQfmU//+wLN1cLqqlKhrS84xcAQ+5ElK1CjzlBGtKgC+HACBvN9vaUwEc oMDuRzPkGGQmv3Wb43zMwKSN/BLp9cwRpNmen0SHuZN+pvOp92K/nhJxhMUu/att6EjF zDnbNbRt8PtW7CvA0kx8vqayYdkzL2z42gkhK1CCmiv1iZvmpLF1mDLN8VIHZ8NakC0S k7mPygLS9lO/sFgKnXpAGeJadPPLzEmQBX+O/8I+ugkgCMiZqfwba6VBFom7kYG2g02X Pq8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=QBwTSRP3e4CDA/4j4ofTm2NRl0umK7RXC6XZMzDdNM4=; b=nTeiIBkKvIYSgSkK1G3pvvszG39xdDsI3lsUpsWKlbyHNd2+Zr1oqG9F4s2To4I7ce 72g5RE6apd0rbF6zovdGY5KmF/WwVz0bUdlnQLUxeC9gQKeqIxV1+9MOKViOM6I5Oi/t Z9smMxbTazUc2Zb/80EkSZBLeh3jx4S4wKOInDuPCG5NPP3Doa7tariYwxUO/8IZegR9 T1mXYjF/38rbdhluCQUri+6BdBsIj9u16cH5SgSjgwmE5tFdJ1mU5sh1zzoKlCdgBLxz sw7VYA12yu/f76nfglYc7nlUXpyCT63whqq4iVLRrmeBKXRIaB91lSbNJ7vyZeE7fZjo KfPA== ARC-Authentication-Results: i=1; mx.google.com; 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 k189si1701886pgc.598.2018.02.21.10.41.35; Wed, 21 Feb 2018 10:41:49 -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; 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 S936612AbeBUNWQ (ORCPT + 99 others); Wed, 21 Feb 2018 08:22:16 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:45508 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965591AbeBUNMA (ORCPT ); Wed, 21 Feb 2018 08:12:00 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 32597E7F; Wed, 21 Feb 2018 13:12:00 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Greg Kurz , "Michael S. Tsirkin" Subject: [PATCH 4.15 141/163] 9p/trans_virtio: discard zero-length reply Date: Wed, 21 Feb 2018 13:49:30 +0100 Message-Id: <20180221124537.930777399@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124529.931834518@linuxfoundation.org> References: <20180221124529.931834518@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Greg Kurz commit 26d99834f89e76514076d9cd06f61e56e6a509b8 upstream. When a 9p request is successfully flushed, the server is expected to just mark it as used without sending a 9p reply (ie, without writing data into the buffer). In this case, virtqueue_get_buf() will return len == 0 and we must not report a REQ_STATUS_RCVD status to the client, otherwise the client will erroneously assume the request has not been flushed. Cc: stable@vger.kernel.org Signed-off-by: Greg Kurz Signed-off-by: Michael S. Tsirkin Signed-off-by: Greg Kroah-Hartman --- net/9p/trans_virtio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -160,7 +160,8 @@ static void req_done(struct virtqueue *v spin_unlock_irqrestore(&chan->lock, flags); /* Wakeup if anyone waiting for VirtIO ring space. */ wake_up(chan->vc_wq); - p9_client_cb(chan->client, req, REQ_STATUS_RCVD); + if (len) + p9_client_cb(chan->client, req, REQ_STATUS_RCVD); } }