Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/53080/?format=api
http://patches.dpdk.org/api/patches/53080/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190425124817.28409-2-herakliusz.lipiec@intel.com/", "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": "<20190425124817.28409-2-herakliusz.lipiec@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20190425124817.28409-2-herakliusz.lipiec@intel.com", "date": "2019-04-25T12:48:16", "name": "[v4,1/2] ipc: fix rte_mp_request_sync memleak", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "1b898675e0f14fc1c8785c782c4746984e0ef675", "submitter": { "id": 742, "url": "http://patches.dpdk.org/api/people/742/?format=api", "name": "Herakliusz Lipiec", "email": "herakliusz.lipiec@intel.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190425124817.28409-2-herakliusz.lipiec@intel.com/mbox/", "series": [ { "id": 4466, "url": "http://patches.dpdk.org/api/series/4466/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4466", "date": "2019-04-25T12:48:15", "name": "ipc: fix possible memleaks", "version": 4, "mbox": "http://patches.dpdk.org/series/4466/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/53080/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/53080/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 AE2801B5B9;\n\tThu, 25 Apr 2019 14:47:55 +0200 (CEST)", "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby dpdk.org (Postfix) with ESMTP id 6A2761B5A9;\n\tThu, 25 Apr 2019 14:47:54 +0200 (CEST)", "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t25 Apr 2019 05:47:53 -0700", "from silpixa00399499.ir.intel.com (HELO\n\tsilpixa00399499.ger.corp.intel.com) ([10.237.222.133])\n\tby orsmga003.jf.intel.com with ESMTP; 25 Apr 2019 05:47:51 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.60,393,1549958400\"; d=\"scan'208\";a=\"145632804\"", "From": "Herakliusz Lipiec <herakliusz.lipiec@intel.com>", "To": "", "Cc": "dev@dpdk.org, anatoly.burakov@intel.com,\n\tHerakliusz Lipiec <herakliusz.lipiec@intel.com>, jianfeng.tan@intel.com, \n\tstable@dpdk.org", "Date": "Thu, 25 Apr 2019 13:48:16 +0100", "Message-Id": "<20190425124817.28409-2-herakliusz.lipiec@intel.com>", "X-Mailer": "git-send-email 2.17.2", "In-Reply-To": "<20190425124817.28409-1-herakliusz.lipiec@intel.com>", "References": "<20190425114324.611-1-herakliusz.lipiec@intel.com>\n\t<20190425124817.28409-1-herakliusz.lipiec@intel.com>", "Subject": "[dpdk-dev] [PATCH v4 1/2] ipc: fix rte_mp_request_sync memleak", "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": "When sending multiple requests, rte_mp_request_sync\ncan succeed sending a few of those requests, but then\nfail on a later one and in the end return with rc=-1.\nThe upper layers - e.g. device hotplug - currently\nhandles this case as if no messages were sent and no\nmemory for response buffers was allocated, which is\nnot true. Fixed by always freeing memory buffers on\nfailure.\n\nBugzilla ID: 228\nFixes: 783b6e54971d (\"eal: add synchronous multi-process communication\")\nCc: jianfeng.tan@intel.com\nCc: stable@dpdk.org\n\nSigned-off-by: Herakliusz Lipiec <herakliusz.lipiec@intel.com>\n---\n lib/librte_eal/common/eal_common_proc.c | 22 +++++++++++++++-------\n 1 file changed, 15 insertions(+), 7 deletions(-)", "diff": "diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c\nindex b46d644b3..ef5eddbea 100644\n--- a/lib/librte_eal/common/eal_common_proc.c\n+++ b/lib/librte_eal/common/eal_common_proc.c\n@@ -927,13 +927,13 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply,\n \n \tRTE_LOG(DEBUG, EAL, \"request: %s\\n\", req->name);\n \n-\tif (check_input(req) == false)\n-\t\treturn -1;\n-\n \treply->nb_sent = 0;\n \treply->nb_received = 0;\n \treply->msgs = NULL;\n \n+\tif (check_input(req) == false)\n+\t\tgoto err;\n+\n \tif (internal_config.no_shconf) {\n \t\tRTE_LOG(DEBUG, EAL, \"No shared files mode enabled, IPC is disabled\\n\");\n \t\treturn 0;\n@@ -942,7 +942,7 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply,\n \tif (gettimeofday(&now, NULL) < 0) {\n \t\tRTE_LOG(ERR, EAL, \"Failed to get current time\\n\");\n \t\trte_errno = errno;\n-\t\treturn -1;\n+\t\tgoto err;\n \t}\n \n \tend.tv_nsec = (now.tv_usec * 1000 + ts->tv_nsec) % 1000000000;\n@@ -954,6 +954,8 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply,\n \t\tpthread_mutex_lock(&pending_requests.lock);\n \t\tret = mp_request_sync(eal_mp_socket_path(), req, reply, &end);\n \t\tpthread_mutex_unlock(&pending_requests.lock);\n+\t\tif (ret)\n+\t\t\tgoto err;\n \t\treturn ret;\n \t}\n \n@@ -962,7 +964,7 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply,\n \tif (!mp_dir) {\n \t\tRTE_LOG(ERR, EAL, \"Unable to open directory %s\\n\", mp_dir_path);\n \t\trte_errno = errno;\n-\t\treturn -1;\n+\t\tgoto err;\n \t}\n \n \tdir_fd = dirfd(mp_dir);\n@@ -972,7 +974,7 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply,\n \t\t\tmp_dir_path);\n \t\tclosedir(mp_dir);\n \t\trte_errno = errno;\n-\t\treturn -1;\n+\t\tgoto err;\n \t}\n \n \tpthread_mutex_lock(&pending_requests.lock);\n@@ -989,7 +991,7 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply,\n \t\t * locks on receive\n \t\t */\n \t\tif (mp_request_sync(path, req, reply, &end))\n-\t\t\tret = -1;\n+\t\t\tgoto err;\n \t}\n \tpthread_mutex_unlock(&pending_requests.lock);\n \t/* unlock the directory */\n@@ -998,6 +1000,12 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply,\n \t/* dir_fd automatically closed on closedir */\n \tclosedir(mp_dir);\n \treturn ret;\n+\n+err:\n+\tfree(reply->msgs);\n+\treply->nb_received = 0;\n+\treply->msgs = NULL;\n+\treturn -1;\n }\n \n int __rte_experimental\n", "prefixes": [ "v4", "1/2" ] }{ "id": 53080, "url": "