Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/810512/?format=api
{ "id": 810512, "url": "http://patchwork.ozlabs.org/api/1.2/patches/810512/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170906111419.5115-1-jiri@resnulli.us/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/1.2/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170906111419.5115-1-jiri@resnulli.us>", "list_archive_url": null, "date": "2017-09-06T11:14:19", "name": "[net] net: sched: fix memleak for chain zero", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "c64f6e4c8bab6cd13866af0ceef465b5e4b45f03", "submitter": { "id": 15321, "url": "http://patchwork.ozlabs.org/api/1.2/people/15321/?format=api", "name": "Jiri Pirko", "email": "jiri@resnulli.us" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/1.2/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170906111419.5115-1-jiri@resnulli.us/mbox/", "series": [ { "id": 1766, "url": "http://patchwork.ozlabs.org/api/1.2/series/1766/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=1766", "date": "2017-09-06T11:14:19", "name": "[net] net: sched: fix memleak for chain zero", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/1766/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/810512/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/810512/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=resnulli-us.20150623.gappssmtp.com\n\theader.i=@resnulli-us.20150623.gappssmtp.com\n\theader.b=\"SEEGKiN5\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xnLZV56k0z9s76\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 6 Sep 2017 21:14:26 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753103AbdIFLOX (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 6 Sep 2017 07:14:23 -0400", "from mail-wm0-f65.google.com ([74.125.82.65]:33884 \"EHLO\n\tmail-wm0-f65.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752485AbdIFLOW (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 6 Sep 2017 07:14:22 -0400", "by mail-wm0-f65.google.com with SMTP id l19so2084632wmi.1\n\tfor <netdev@vger.kernel.org>; Wed, 06 Sep 2017 04:14:22 -0700 (PDT)", "from localhost (ip-89-177-125-82.net.upcbroadband.cz.\n\t[89.177.125.82]) by smtp.gmail.com with ESMTPSA id\n\tr15sm1113463wrc.30.2017.09.06.04.14.20\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tWed, 06 Sep 2017 04:14:20 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=resnulli-us.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id;\n\tbh=9qRKfTmlWHhGkTtniZtuewnc7znKtwnUnROKk7mOlvU=;\n\tb=SEEGKiN5jlS8rNQcaoWILbfKp9QmHHlBXSJ1lT4Vbm4ZBv4NXtj3MXk01DzJFR3ADe\n\t2jKI537/DT9ZPXc+TH1wv++zzdONLT2VuMdTn5OoYGMdIDjns9EMIYpQpTGu3uZ1xB2x\n\tVN7jW/fmttZqsnJ+NWIBtwJ/nYwtxMLXen74ZM/+O0O4dnBHkOpsjCdmje28kb+FReid\n\tnOEuUWNm6c1j4DSbwuHiQ9BsuZvL+YggkNF7BUxFa1tw5SBmhdTwo7/FmxIPmVrKl3uR\n\tc1qjmvq5nNLTugs/o+6pvs5lFc738zpfGEYqfnleWjlaFn2h3hVeNH6PJhbSHLbdJtqs\n\t0onA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=9qRKfTmlWHhGkTtniZtuewnc7znKtwnUnROKk7mOlvU=;\n\tb=O970wJDBadD9FGHfhQUlZT8Sr+ilIDb4gc5vNVUcN/iZopogruAwxNYbRV3bxV2zzn\n\ti2ncbkzUehyN0mfGYzIqdK+I9z+RVgO6XWzh0CiIrDVI1L7Xe/V6vhM0k4Y1LV3wDQRt\n\tnoWxmz1UrmZf8Th5QSNoqloGkPCp+WMU0FK3PNtb+wpXmHS9rIz4WX5ot5FTK7i+zHnR\n\tzJfkEmNVyRh2SWhg+01CmpScLABEeIiynKyGtnixFo6e4ob7DyKM5fOc6wusdeZeOvYx\n\t957OToETHy1NjO/hYzCUXIVncRhy5nm7OrCdlbr3unkEYpXsgtswS0O6x58lfIMFY9Sv\n\trU/Q==", "X-Gm-Message-State": "AHPjjUjSnbuSn5TrVJ1deLY2kFa+F7DILVeJwu0xSJVQlzdIOW7fN1tk\n\tKOefCbfuCjzXQ7wJD/w=", "X-Google-Smtp-Source": "ADKCNb5aAlwzyV1xI1cpFUixkoTMwqohOZgdJ+gf+i8DqdGzOMDFNO0Q/6DVJIR6Mf+mVNPilTMy7A==", "X-Received": "by 10.28.191.155 with SMTP id o27mr1354899wmi.190.1504696461127; \n\tWed, 06 Sep 2017 04:14:21 -0700 (PDT)", "From": "Jiri Pirko <jiri@resnulli.us>", "To": "netdev@vger.kernel.org", "Cc": "davem@davemloft.net, jhs@mojatatu.com, xiyou.wangcong@gmail.com,\n\tkubakici@wp.pl, mlxsw@mellanox.com", "Subject": "[patch net] net: sched: fix memleak for chain zero", "Date": "Wed, 6 Sep 2017 13:14:19 +0200", "Message-Id": "<20170906111419.5115-1-jiri@resnulli.us>", "X-Mailer": "git-send-email 2.9.3", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "From: Jiri Pirko <jiri@mellanox.com>\n\nThere's a memleak happening for chain 0. The thing is, chain 0 needs to\nbe always present, not created on demand. Therefore tcf_block_get upon\ncreation of block calls the tcf_chain_create function directly. The\nchain is created with refcnt == 1, which is not correct in this case and\ncauses the memleak. So move the refcnt increment into tcf_chain_get\nfunction even for the case when chain needs to be created.\n\nReported-by: Jakub Kicinski <kubakici@wp.pl>\nFixes: 5bc1701881e3 (\"net: sched: introduce multichain support for filters\")\nSigned-off-by: Jiri Pirko <jiri@mellanox.com>\n---\n net/sched/cls_api.c | 18 +++++++++---------\n 1 file changed, 9 insertions(+), 9 deletions(-)", "diff": "diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c\nindex 6c5ea84..30ef466 100644\n--- a/net/sched/cls_api.c\n+++ b/net/sched/cls_api.c\n@@ -197,7 +197,7 @@ static struct tcf_chain *tcf_chain_create(struct tcf_block *block,\n \tlist_add_tail(&chain->list, &block->chain_list);\n \tchain->block = block;\n \tchain->index = chain_index;\n-\tchain->refcnt = 1;\n+\tchain->refcnt = 0;\n \treturn chain;\n }\n \n@@ -232,15 +232,15 @@ struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index,\n \tstruct tcf_chain *chain;\n \n \tlist_for_each_entry(chain, &block->chain_list, list) {\n-\t\tif (chain->index == chain_index) {\n-\t\t\tchain->refcnt++;\n-\t\t\treturn chain;\n-\t\t}\n+\t\tif (chain->index == chain_index)\n+\t\t\tgoto incref;\n \t}\n-\tif (create)\n-\t\treturn tcf_chain_create(block, chain_index);\n-\telse\n-\t\treturn NULL;\n+\tchain = create ? tcf_chain_create(block, chain_index) : NULL;\n+\n+incref:\n+\tif (chain)\n+\t\tchain->refcnt++;\n+\treturn chain;\n }\n EXPORT_SYMBOL(tcf_chain_get);\n \n", "prefixes": [ "net" ] }