Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/57729/?format=api
https://patches.dpdk.org/api/patches/57729/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/156595762238.18723.10089009448135563310.stgit@jrharri1-skx/", "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": "<156595762238.18723.10089009448135563310.stgit@jrharri1-skx>", "list_archive_url": "https://inbox.dpdk.org/dev/156595762238.18723.10089009448135563310.stgit@jrharri1-skx", "date": "2019-08-16T12:13:42", "name": "vfio: free mp_reply msgs in failure cases", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "28862de14c7905f8674810479c64c5ec335dd0d4", "submitter": { "id": 84, "url": "https://patches.dpdk.org/api/people/84/?format=api", "name": "Harris, James R", "email": "james.r.harris@intel.com" }, "delegate": { "id": 24651, "url": "https://patches.dpdk.org/api/users/24651/?format=api", "username": "dmarchand", "first_name": "David", "last_name": "Marchand", "email": "david.marchand@redhat.com" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/156595762238.18723.10089009448135563310.stgit@jrharri1-skx/mbox/", "series": [ { "id": 6064, "url": "https://patches.dpdk.org/api/series/6064/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=6064", "date": "2019-08-16T12:13:42", "name": "vfio: free mp_reply msgs in failure cases", "version": 1, "mbox": "https://patches.dpdk.org/series/6064/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/57729/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/57729/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id DB5DE1BF15;\n\tFri, 16 Aug 2019 21:18:51 +0200 (CEST)", "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id A45F41BF0D\n\tfor <dev@dpdk.org>; Fri, 16 Aug 2019 21:18:50 +0200 (CEST)", "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t16 Aug 2019 12:18:49 -0700", "from jrharri1-skx.ch.intel.com (HELO [127.0.1.1])\n\t([143.182.137.73])\n\tby fmsmga006.fm.intel.com with ESMTP; 16 Aug 2019 12:18:49 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.64,394,1559545200\"; d=\"scan'208\";a=\"377512502\"", "From": "Jim Harris <james.r.harris@intel.com>", "To": "dev@dpdk.org, anatoly.burakov@intel.com", "Date": "Fri, 16 Aug 2019 05:13:42 -0700", "Message-ID": "<156595762238.18723.10089009448135563310.stgit@jrharri1-skx>", "User-Agent": "StGit/0.17.1-dirty", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Subject": "[dpdk-dev] [PATCH] vfio: free mp_reply msgs in failure cases", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "The code checks both rte_mp_request_sync() return\ncode and that the number of messages in the reply\nequals 1. If rte_mp_request_sync() succeeds but\nthere was more than one message, those messages\nwould get leaked.\n\nFound via code review by Anatoly Burakov of patches\nthat used the vhost code as a template for using\nrte_mp_request_sync().\n\nSigned-off-by: Jim Harris <james.r.harris@intel.com>\n---\n lib/librte_eal/linux/eal/eal_vfio.c | 16 ++++++++--------\n 1 file changed, 8 insertions(+), 8 deletions(-)", "diff": "diff --git a/lib/librte_eal/linux/eal/eal_vfio.c b/lib/librte_eal/linux/eal/eal_vfio.c\nindex 501c74f23..d9541b122 100644\n--- a/lib/librte_eal/linux/eal/eal_vfio.c\n+++ b/lib/librte_eal/linux/eal/eal_vfio.c\n@@ -264,7 +264,7 @@ vfio_open_group_fd(int iommu_group_num)\n \tint vfio_group_fd;\n \tchar filename[PATH_MAX];\n \tstruct rte_mp_msg mp_req, *mp_rep;\n-\tstruct rte_mp_reply mp_reply;\n+\tstruct rte_mp_reply mp_reply = {0};\n \tstruct timespec ts = {.tv_sec = 5, .tv_nsec = 0};\n \tstruct vfio_mp_param *p = (struct vfio_mp_param *)mp_req.param;\n \n@@ -320,9 +320,9 @@ vfio_open_group_fd(int iommu_group_num)\n \t\t\tRTE_LOG(ERR, EAL, \" bad VFIO group fd\\n\");\n \t\t\tvfio_group_fd = 0;\n \t\t}\n-\t\tfree(mp_reply.msgs);\n \t}\n \n+\tfree(mp_reply.msgs);\n \tif (vfio_group_fd < 0)\n \t\tRTE_LOG(ERR, EAL, \" cannot request group fd\\n\");\n \treturn vfio_group_fd;\n@@ -554,7 +554,7 @@ static int\n vfio_sync_default_container(void)\n {\n \tstruct rte_mp_msg mp_req, *mp_rep;\n-\tstruct rte_mp_reply mp_reply;\n+\tstruct rte_mp_reply mp_reply = {0};\n \tstruct timespec ts = {.tv_sec = 5, .tv_nsec = 0};\n \tstruct vfio_mp_param *p = (struct vfio_mp_param *)mp_req.param;\n \tint iommu_type_id;\n@@ -584,8 +584,8 @@ vfio_sync_default_container(void)\n \t\tp = (struct vfio_mp_param *)mp_rep->param;\n \t\tif (p->result == SOCKET_OK)\n \t\t\tiommu_type_id = p->iommu_type_id;\n-\t\tfree(mp_reply.msgs);\n \t}\n+\tfree(mp_reply.msgs);\n \tif (iommu_type_id < 0) {\n \t\tRTE_LOG(ERR, EAL, \"Could not get IOMMU type for default container\\n\");\n \t\treturn -1;\n@@ -1021,7 +1021,7 @@ int\n vfio_get_default_container_fd(void)\n {\n \tstruct rte_mp_msg mp_req, *mp_rep;\n-\tstruct rte_mp_reply mp_reply;\n+\tstruct rte_mp_reply mp_reply = {0};\n \tstruct timespec ts = {.tv_sec = 5, .tv_nsec = 0};\n \tstruct vfio_mp_param *p = (struct vfio_mp_param *)mp_req.param;\n \n@@ -1049,9 +1049,9 @@ vfio_get_default_container_fd(void)\n \t\t\tfree(mp_reply.msgs);\n \t\t\treturn mp_rep->fds[0];\n \t\t}\n-\t\tfree(mp_reply.msgs);\n \t}\n \n+\tfree(mp_reply.msgs);\n \tRTE_LOG(ERR, EAL, \" cannot request default container fd\\n\");\n \treturn -1;\n }\n@@ -1127,7 +1127,7 @@ rte_vfio_get_container_fd(void)\n {\n \tint ret, vfio_container_fd;\n \tstruct rte_mp_msg mp_req, *mp_rep;\n-\tstruct rte_mp_reply mp_reply;\n+\tstruct rte_mp_reply mp_reply = {0};\n \tstruct timespec ts = {.tv_sec = 5, .tv_nsec = 0};\n \tstruct vfio_mp_param *p = (struct vfio_mp_param *)mp_req.param;\n \n@@ -1181,9 +1181,9 @@ rte_vfio_get_container_fd(void)\n \t\t\tfree(mp_reply.msgs);\n \t\t\treturn vfio_container_fd;\n \t\t}\n-\t\tfree(mp_reply.msgs);\n \t}\n \n+\tfree(mp_reply.msgs);\n \tRTE_LOG(ERR, EAL, \" cannot request container fd\\n\");\n \treturn -1;\n }\n", "prefixes": [] }{ "id": 57729, "url": "