Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/21721/?format=api
http://patches.dpdk.org/api/patches/21721/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1489417755-17074-1-git-send-email-liuwf@arraynetworks.com.cn/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<1489417755-17074-1-git-send-email-liuwf@arraynetworks.com.cn>", "list_archive_url": "https://inbox.dpdk.org/dev/1489417755-17074-1-git-send-email-liuwf@arraynetworks.com.cn", "date": "2017-03-13T15:09:15", "name": "[dpdk-dev] net/virtio-user: fix overflow", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "2f70d00dfe39ad3943f525582d2d4da5b332e26d", "submitter": { "id": 254, "url": "http://patches.dpdk.org/api/people/254/?format=api", "name": "Wenfeng Liu", "email": "liuwf@arraynetworks.com.cn" }, "delegate": { "id": 355, "url": "http://patches.dpdk.org/api/users/355/?format=api", "username": "yliu", "first_name": "Yuanhan", "last_name": "Liu", "email": "yuanhan.liu@linux.intel.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1489417755-17074-1-git-send-email-liuwf@arraynetworks.com.cn/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/21721/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/21721/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 9B70ED145;\n\tMon, 13 Mar 2017 08:10:56 +0100 (CET)", "from mail01.arraynetworks.com.cn (mail.arraynetworks.com.cn\n\t[124.42.99.121]) by dpdk.org (Postfix) with ESMTP id 258F4D142\n\tfor <dev@dpdk.org>; Mon, 13 Mar 2017 08:10:53 +0100 (CET)", "from localhost.localdomain.localdomain (192.168.4.200) by\n\tmail01.arraynetworks.com.cn (10.3.0.251) with Microsoft SMTP Server\n\tid 14.3.123.3; Mon, 13 Mar 2017 15:08:10 +0800" ], "From": "Wenfeng Liu <liuwf@arraynetworks.com.cn>", "To": "<yuanhan.liu@linux.intel.com>, <maxime.coquelin@redhat.com>", "CC": "<dev@dpdk.org>", "Date": "Mon, 13 Mar 2017 15:09:15 +0000", "Message-ID": "<1489417755-17074-1-git-send-email-liuwf@arraynetworks.com.cn>", "X-Mailer": "git-send-email 1.8.3.1", "MIME-Version": "1.0", "Content-Type": "text/plain", "X-Originating-IP": "[192.168.4.200]", "Subject": "[dpdk-dev] [PATCH] net/virtio-user: fix overflow", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "This commit fixes an array overflow when number of queues is higher than 8.\n\nFixes: 37a7eb2ae816 (\"net/virtio-user: add device emulation layer\")\n\nSigned-off-by: Wenfeng Liu <liuwf@arraynetworks.com.cn>\n---\n drivers/net/virtio/virtio_pci.h | 3 ++-\n drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 +-\n drivers/net/virtio/virtio_user/virtio_user_dev.h | 6 +++---\n drivers/net/virtio/virtio_user_ethdev.c | 7 +++++++\n 4 files changed, 13 insertions(+), 5 deletions(-)", "diff": "diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h\nindex 59e45c4..bd940b4 100644\n--- a/drivers/net/virtio/virtio_pci.h\n+++ b/drivers/net/virtio/virtio_pci.h\n@@ -160,7 +160,8 @@\n /*\n * Maximum number of virtqueues per device.\n */\n-#define VIRTIO_MAX_VIRTQUEUES 8\n+#define VIRTIO_MAX_VIRTQUEUE_PAIRS 8\n+#define VIRTIO_MAX_VIRTQUEUES VIRTIO_MAX_VIRTQUEUE_PAIRS * 2 + 1\n \n /* Common configuration */\n #define VIRTIO_PCI_CAP_COMMON_CFG\t1\ndiff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c\nindex e7fd65f..5b81676 100644\n--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c\n+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c\n@@ -234,7 +234,7 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)\n \tuint32_t i, q;\n \n \tdev->vhostfd = -1;\n-\tfor (i = 0; i < VIRTIO_MAX_VIRTQUEUES * 2 + 1; ++i) {\n+\tfor (i = 0; i < VIRTIO_MAX_VIRTQUEUES; ++i) {\n \t\tdev->kickfds[i] = -1;\n \t\tdev->callfds[i] = -1;\n \t}\ndiff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h\nindex 6ecb91e..ba80d05 100644\n--- a/drivers/net/virtio/virtio_user/virtio_user_dev.h\n+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h\n@@ -49,8 +49,8 @@ struct virtio_user_dev {\n \tint\t\t*tapfds;\n \n \t/* for both vhost_user and vhost_kernel */\n-\tint\t\tcallfds[VIRTIO_MAX_VIRTQUEUES * 2 + 1];\n-\tint\t\tkickfds[VIRTIO_MAX_VIRTQUEUES * 2 + 1];\n+\tint\t\tcallfds[VIRTIO_MAX_VIRTQUEUES];\n+\tint\t\tkickfds[VIRTIO_MAX_VIRTQUEUES];\n \tint\t\tmac_specified;\n \tuint32_t\tmax_queue_pairs;\n \tuint32_t\tqueue_pairs;\n@@ -62,7 +62,7 @@ struct virtio_user_dev {\n \tuint8_t\t\tstatus;\n \tuint8_t\t\tmac_addr[ETHER_ADDR_LEN];\n \tchar\t\tpath[PATH_MAX];\n-\tstruct vring\tvrings[VIRTIO_MAX_VIRTQUEUES * 2 + 1];\n+\tstruct vring\tvrings[VIRTIO_MAX_VIRTQUEUES];\n \tstruct virtio_user_backend_ops *ops;\n };\n \ndiff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c\nindex 16d1526..d476a2d 100644\n--- a/drivers/net/virtio/virtio_user_ethdev.c\n+++ b/drivers/net/virtio/virtio_user_ethdev.c\n@@ -433,6 +433,13 @@\n \t\tgoto end;\n \t}\n \n+\tif (queues > VIRTIO_MAX_VIRTQUEUE_PAIRS) {\n+\t\tPMD_INIT_LOG(ERR, \"arg %s %u exceeds the limit %u\",\n+\t\t\tVIRTIO_USER_ARG_QUEUES_NUM, queues,\n+\t\t\tVIRTIO_MAX_VIRTQUEUE_PAIRS);\n+\t\tgoto end;\n+\t}\n+\n \teth_dev = virtio_user_eth_dev_alloc(name);\n \tif (!eth_dev) {\n \t\tPMD_INIT_LOG(ERR, \"virtio_user fails to alloc device\");\n", "prefixes": [ "dpdk-dev" ] }{ "id": 21721, "url": "