Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp103577imm; Thu, 2 Aug 2018 23:52:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdHu748dsBd6AE7TTl/ZfH4m2ZJxcTH7SpnWma6q0hyn5e+2R5SddP7+yrEAHlcwssKxKPl X-Received: by 2002:a63:d401:: with SMTP id a1-v6mr2407387pgh.414.1533279125203; Thu, 02 Aug 2018 23:52:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533279125; cv=none; d=google.com; s=arc-20160816; b=yJuSHyEt4NwGrUqAQsAjb4YK0GleOX4iIGDlf8G/JZt7lvf+BHloqK9GnIutXQ2xQ+ 30oEBLpcpbr641DUdVUwdEfU1y9TQEj0epyvLNVJgJuiOlNiU+gYijEx8Q/AUHDj2+7H zoggEUHfpjMNgFL+0tFcpRjzB6k6wbZGIseNbpsUvCRmxyG8RiD0ixc7ArLsLSc7JKRx xXgXmMWbSoIAVBeo4qZREhtKE3YYEtswba3SWS/7bSOqbIiCw/fx7C7+l5IPfqiWYgUm jcFyFAPUbLX+K1TmTaK5afEIOsKPf48fk8+TJtGH0YjTmPaMoN4nc/V26eakM5qqyK55 C0oQ== 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:date:message-id:subject:from:cc:to :arc-authentication-results; bh=dr9ucm0nNvdq10cVwlTstlz2mJ90ph4HvN4YGBy3BWI=; b=GUoy83Utyn+NpCunZ4ti9eFUVxLX125herlBDslqkQseibMJ7PYPNJU/9i8+IfWNLH nRtkygwe36wz6VmfP5OkRpNOxziWmPP5iVqWQqsn3eq2MxJFeuHGt1YIWcTSEOo0schd kTJ1THK3LLwHfRC2cOTmGNjbbtxkkLA0QQiqV57d7J5zcEEgrBb6RTdddVwiJxBb5GVg JhSDmARvp8s/RjojExOGjaHXixIgTXLz9ApVFC54nooUBHYbz9NhVL0ICa2i9H858ucW z3C2lRHssb3cowwt7a66LzI5bDMKqiSDsZ+EdOPo5Mn4+SgwTEImMoRR9BGWgSkf721W wY2g== 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 w185-v6si4107756pgd.133.2018.08.02.23.51.49; Thu, 02 Aug 2018 23:52:05 -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; 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 S1727848AbeHCIpv (ORCPT + 99 others); Fri, 3 Aug 2018 04:45:51 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:10222 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726833AbeHCIpv (ORCPT ); Fri, 3 Aug 2018 04:45:51 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id A0593B408BD4F; Fri, 3 Aug 2018 14:50:56 +0800 (CST) Received: from [127.0.0.1] (10.177.16.168) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.399.0; Fri, 3 Aug 2018 14:50:56 +0800 To: Eric Van Hensbergen , Ron Minnich , Latchesar Ionkov , Dominique Martinet CC: Linux Kernel Mailing List , , From: jiangyiwen Subject: [V9fs-developer] [PATCH] net/9p: avoid request size exceed to the virtqueue number in the zero copy Message-ID: <5B63FB4D.1050703@huawei.com> Date: Fri, 3 Aug 2018 14:50:53 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.16.168] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Unfortunately, when the address(input and response headers) are not at page boundary, it will need two extra entry in the zero copy, or else it will cause sg array out of bounds. To avoid the problem, we should subtract two pages for maxsize. Signed-off-by: Yiwen Jiang --- net/9p/trans_virtio.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 6265d1d..63591b2 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -754,11 +754,12 @@ static void p9_virtio_remove(struct virtio_device *vdev) .cancel = p9_virtio_cancel, /* * We leave one entry for input and one entry for response - * headers. We also skip one more entry to accomodate, address - * that are not at page boundary, that can result in an extra - * page in zero copy. + * headers. We also skip three more entrys to accomodate + * (input + response headers + data pages), address + * that are not at page boundary, that can result in + * an extra page in zero copy. */ - .maxsize = PAGE_SIZE * (VIRTQUEUE_NUM - 3), + .maxsize = PAGE_SIZE * (VIRTQUEUE_NUM - 5), .def = 1, .owner = THIS_MODULE, }; -- 1.8.3.1