Received: by 10.223.185.116 with SMTP id b49csp971114wrg; Wed, 21 Feb 2018 09:53:04 -0800 (PST) X-Google-Smtp-Source: AH8x225wSKVp/jLCE+tijBqOCYoOQTLXGYhYOQdcM/d2UJ8cifVHi9fdbCdduIvZA8D9JYLJwZ4y X-Received: by 2002:a17:902:b582:: with SMTP id a2-v6mr3927402pls.349.1519235584254; Wed, 21 Feb 2018 09:53:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519235584; cv=none; d=google.com; s=arc-20160816; b=I43alrzqRlPFWmXScD6j/wGiIXoZOfkyzi7Zk7Yck1aOaEo3gAlWLZ9a2ziJUX2vwm zkBRnjbeJrC4l1kjFZOBBbcikGuxLxXV09DQbuAY389H1u5+UP1Zq2XlXPb3dp2JsmVq utDmwITBk8RNK4jSHcp8fz0wWJAOT8P5yzTKfAlPZ1fmhCfcVgSB0fEy5gXiumE1R0Rx wPD8MnPvVrhdBtEvH6GP2aVeZq2mx62YqGRhfh7+CTD5D0TucZXy3JsRPLwq3Qjlb7+K y1HBmmqQ4IY4OvheTWjwfqsMzP00mz3CJuzCVUob02LgBDPQB2XzxBaIoTDz54OHEuGr iJAg== 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=Nn4CxJkf06pHhRRfrHCF7VzhUJkCs9Q//h9T/tiljpE=; b=RgKqcWOZfJqc90TsNmWNKRlmNIZnmUhtTcTOXy5tmaOCCJmN4gv7IW16x0uQ7V7cJB m9noDRhNGo54Jn9SkAq6rjUSuSXlKjFR2ZKe0/DjVXFrN3WwNxLG2KSs/eLmfrPYmVlZ LMBAGAwCyuJ8jV5Oy8VSBP6rTGvcpkuMmHbE6sGI+HB1g5C9LOcErXAO5sBDA6G5EOpP DtAf1dIC3ah6xdnFpahXTZSS9CTx35TSXvATdwIUKWXTAHOMuWeTwSbVE6kk7b9/nL4V qb42P7Pg12QnRv0Sxk6Lefy4ZbguuJHFcoJdfB8bTRx4ylGVGUSiXhwsBo1WJnaBmEbw YTwQ== 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 i4si99673pgr.266.2018.02.21.09.52.50; Wed, 21 Feb 2018 09:53:04 -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 S934175AbeBUMy6 (ORCPT + 99 others); Wed, 21 Feb 2018 07:54:58 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:34272 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934114AbeBUMy4 (ORCPT ); Wed, 21 Feb 2018 07:54:56 -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 AE5E31180; Wed, 21 Feb 2018 12:54:55 +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.9 23/77] 9p/trans_virtio: discard zero-length reply Date: Wed, 21 Feb 2018 13:48:32 +0100 Message-Id: <20180221124433.163224691@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124432.172390020@linuxfoundation.org> References: <20180221124432.172390020@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.9-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); } }