Received: by 10.223.185.116 with SMTP id b49csp731770wrg; Wed, 21 Feb 2018 06:06:10 -0800 (PST) X-Google-Smtp-Source: AH8x226o2izQWIUw16+G7HDVWHo0eFTzCjQT8twts6wl2LsuhYEofT+EsZWiicX/lnEW7gZvmW+E X-Received: by 10.99.186.73 with SMTP id l9mr2775369pgu.83.1519221970053; Wed, 21 Feb 2018 06:06:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519221970; cv=none; d=google.com; s=arc-20160816; b=PCXX8w5+u1m0k2fSD+rhseNLT/Oga9Z9MSJ3ZgjXSdEwbnoWGUc2T23JlVenQfsiOi j9POwGRQVx+LMSNkoayqaieKkEV++cMQolFQJ4eAsj/Ir72WZR+y6kFKujCdpL6S9IPp kdCh1hl/OU5Byx8vvqGjroL5x54nDDhzU/JEuUrZ7J6UyJm5HMAlBVmIWc9LEruK08iZ z6fEc+xnMjncMNniV0BKMK19QHXSxIBllCtldElj5VfVZDkKFTblaE3W/QmMrIN3STvL 8yEyFR9dE4e7WhXE0fzEPvCEkA8I2n/z2jHt9egFamfyIEMNSlOPnCtkRj+nStvf9j3C ICMQ== 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=HzDuLndAUpzgD6SufT/1WhW7PIQDqI6gf1KFMJu5S8M=; b=lwEUDKvumb7BIpBVeTdAI2vIgi0mU7N6zecmf3WNlx50znomiQCSUOFkzzowhbm8FM kwcPp6n/nmKkE0ar6POWkkQ2VzYTXlDKvoW+sMYr6a355ZhSUS5dCQcaVZsW0p6cqDL1 ACiVVV9AU3XeuqrT/pNLVDkiDsF+VwdCk3V4As0ys8tSNUVIIb7tdMaBGElqUqD+U8am O4MqnAeDeHTmjsXK4Run1VJFq5t+n0cfhOOCEuJbs0KBe8IdP34stANVtjncEf2QqtqT sZmky7ly2cwdqI9RQchhk/PLgctlosuEY9B9CPMVteJPBPaMcC9OJdhHY7UirlYvxNMm fllg== 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 h34-v6si10638229pld.761.2018.02.21.06.05.53; Wed, 21 Feb 2018 06:06:10 -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 S935887AbeBUNEO (ORCPT + 99 others); Wed, 21 Feb 2018 08:04:14 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:39826 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933206AbeBUNEM (ORCPT ); Wed, 21 Feb 2018 08:04:12 -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 DD3331125; Wed, 21 Feb 2018 13:04:11 +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.14 140/167] 9p/trans_virtio: discard zero-length reply Date: Wed, 21 Feb 2018 13:49:11 +0100 Message-Id: <20180221124532.369609960@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124524.639039577@linuxfoundation.org> References: <20180221124524.639039577@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.14-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); } }