get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/114492/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 114492,
    "url": "https://patches.dpdk.org/api/patches/114492/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20220802003948.22693-2-cfontana@suse.de/",
    "project": {
        "id": 1,
        "url": "https://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": "<20220802003948.22693-2-cfontana@suse.de>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220802003948.22693-2-cfontana@suse.de",
    "date": "2022-08-02T00:39:47",
    "name": "[1/2] vhost: check for nr_vec == 0 in desc_to_mbuf, mbuf_to_desc",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "6150be945b2a6d5c8dbf1e125a19b6d7c6dbb82c",
    "submitter": {
        "id": 2788,
        "url": "https://patches.dpdk.org/api/people/2788/?format=api",
        "name": "Claudio Fontana",
        "email": "cfontana@suse.de"
    },
    "delegate": {
        "id": 2642,
        "url": "https://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20220802003948.22693-2-cfontana@suse.de/mbox/",
    "series": [
        {
            "id": 24154,
            "url": "https://patches.dpdk.org/api/series/24154/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=24154",
            "date": "2022-08-02T00:39:46",
            "name": "vhost fixes for OVS SIGSEGV in PMD",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/24154/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/114492/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/114492/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 14CBDA00C3;\n\tTue,  2 Aug 2022 02:40:06 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 2DDE7410E7;\n\tTue,  2 Aug 2022 02:40:01 +0200 (CEST)",
            "from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29])\n by mails.dpdk.org (Postfix) with ESMTP id 46EE140141\n for <dev@dpdk.org>; Tue,  2 Aug 2022 02:39:59 +0200 (CEST)",
            "from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de\n [192.168.254.74])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)\n (No client certificate requested)\n by smtp-out2.suse.de (Postfix) with ESMTPS id 249261FB9A;\n Tue,  2 Aug 2022 00:39:59 +0000 (UTC)",
            "from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de\n [192.168.254.74])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)\n (No client certificate requested)\n by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E60E513AD8;\n Tue,  2 Aug 2022 00:39:58 +0000 (UTC)",
            "from dovecot-director2.suse.de ([192.168.254.65])\n by imap2.suse-dmz.suse.de with ESMTPSA id mHU+Nl5y6GK1MAAAMHmgww\n (envelope-from <cfontana@suse.de>); Tue, 02 Aug 2022 00:39:58 +0000"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1659400799;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=rHdHhn54Vs/3aj+NKNVtiSLjxgU2mf7Av0IIgaLiC5Y=;\n b=dyoZETDaQ4aHf58iFQKfmRxYwox8kPz/FGJ0QgOw/+anK8n9ADN/hm8K1IYgK1gulXeyNU\n F+REMMbg3FV0rKLjIoxRp7PvfMHuU+ikcKVuk3DLbwIomf77WePG0JeUnKqp2usxzwOOd4\n LSW6G31t0Z43ndyMfmAv5vkS6rgkmog=",
            "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1659400799;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=rHdHhn54Vs/3aj+NKNVtiSLjxgU2mf7Av0IIgaLiC5Y=;\n b=++wRHmj81020kb2buWth4qkzWNwSFlEPyz8UJBJvAkJFi25nLRoeQH++eDfOVwRvKjTlKw\n boEQ6zkrNk716oBg=="
        ],
        "From": "Claudio Fontana <cfontana@suse.de>",
        "To": "Maxime Coquelin <maxime.coquelin@redhat.com>,\n Chenbo Xia <chenbo.xia@intel.com>",
        "Cc": "dev@dpdk.org,\n\tClaudio Fontana <cfontana@suse.de>",
        "Subject": "[PATCH 1/2] vhost: check for nr_vec == 0 in desc_to_mbuf,\n mbuf_to_desc",
        "Date": "Tue,  2 Aug 2022 02:39:47 +0200",
        "Message-Id": "<20220802003948.22693-2-cfontana@suse.de>",
        "X-Mailer": "git-send-email 2.26.2",
        "In-Reply-To": "<20220802003948.22693-1-cfontana@suse.de>",
        "References": "<20220802003948.22693-1-cfontana@suse.de>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "in virtio_dev_split we cannot currently call desc_to_mbuf with\nnr_vec == 0, or we end up trying to rte_memcpy from a source address\nbuf_vec[0] that is an uninitialized stack variable.\n\nImprove this in general by having desc_to_mbuf and mbuf_to_desc\nreturn -1 when called with an invalid nr_vec == 0, which should\nfix any other instance of this problem.\n\nThis should fix errors that have been reported in multiple occasions\nfrom telcos to the DPDK, OVS and QEMU projects, as this affects in\nparticular the openvswitch/DPDK, QEMU vhost-user setup when the\nguest DPDK application abruptly goes away via SIGKILL and then\nreconnects.\n\nThe back trace looks roughly like this, depending on the specific\nrte_memcpy selected, etc, in any case the \"src\" parameter is garbage\n(in this example containing 0 + dev->host_hlen(12 = 0xc)).\n\nThread 153 \"pmd-c88/id:150\" received signal SIGSEGV, Segmentation fault.\n[Switching to Thread 0x7f64e5e6b700 (LWP 141373)]\nrte_mov128blocks (n=2048, src=0xc <error: Cannot access memory at 0xc>,\n             dst=0x150da4480) at ../lib/eal/x86/include/rte_memcpy.h:384\n(gdb) bt\n0  rte_mov128blocks (n=2048, src=0xc, dst=0x150da4480)\n1  rte_memcpy_generic (n=2048, src=0xc, dst=0x150da4480)\n2  rte_memcpy (n=2048, src=0xc, dst=<optimized out>)\n3  sync_fill_seg\n4  desc_to_mbuf\n5  virtio_dev_tx_split\n6  virtio_dev_tx_split_legacy\n7  0x00007f676fea0fef in rte_vhost_dequeue_burst\n8  0x00007f6772005a62 in netdev_dpdk_vhost_rxq_recv\n9  0x00007f6771f38116 in netdev_rxq_recv\n10 0x00007f6771f03d96 in dp_netdev_process_rxq_port\n11 0x00007f6771f04239 in pmd_thread_main\n12 0x00007f6771f92aff in ovsthread_wrapper\n13 0x00007f6771c1b6ea in start_thread\n14 0x00007f6771933a8f in clone\n\nTested-by: Claudio Fontana <cfontana@suse.de>\nSigned-off-by: Claudio Fontana <cfontana@suse.de>\n---\n lib/vhost/virtio_net.c | 11 ++++++++---\n 1 file changed, 8 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c\nindex 35fa4670fd..8d0d223983 100644\n--- a/lib/vhost/virtio_net.c\n+++ b/lib/vhost/virtio_net.c\n@@ -1153,7 +1153,7 @@ mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \tstruct virtio_net_hdr_mrg_rxbuf tmp_hdr, *hdr = NULL;\n \tstruct vhost_async *async = vq->async;\n \n-\tif (unlikely(m == NULL))\n+\tif (unlikely(m == NULL) || nr_vec == 0)\n \t\treturn -1;\n \n \tbuf_addr = buf_vec[vec_idx].buf_addr;\n@@ -2673,6 +2673,9 @@ desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \tstruct vhost_async *async = vq->async;\n \tstruct async_inflight_info *pkts_info;\n \n+        if (unlikely(nr_vec == 0)) {\n+\t\treturn -1;\n+        }\n \tbuf_addr = buf_vec[vec_idx].buf_addr;\n \tbuf_iova = buf_vec[vec_idx].buf_iova;\n \tbuf_len = buf_vec[vec_idx].buf_len;\n@@ -2917,9 +2920,11 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \t\t\t\t\t\tvq->last_avail_idx + i,\n \t\t\t\t\t\t&nr_vec, buf_vec,\n \t\t\t\t\t\t&head_idx, &buf_len,\n-\t\t\t\t\t\tVHOST_ACCESS_RO) < 0))\n+\t\t\t\t\t\tVHOST_ACCESS_RO) < 0)) {\n+\t\t\tdropped += 1;\n+\t\t\ti++;\n \t\t\tbreak;\n-\n+\t\t}\n \t\tupdate_shadow_used_ring_split(vq, head_idx, 0);\n \n \t\terr = virtio_dev_pktmbuf_prep(dev, pkts[i], buf_len);\n",
    "prefixes": [
        "1/2"
    ]
}