Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/620794/?format=api
{ "id": 620794, "url": "http://patchwork.ozlabs.org/api/patches/620794/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1462908605-27412-15-git-send-email-a@unstable.cc/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/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": "<1462908605-27412-15-git-send-email-a@unstable.cc>", "list_archive_url": null, "date": "2016-05-10T19:30:02", "name": "[14/17] batman-adv: Use kref_get for _batadv_update_route", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "8746756edde7349b2a95ae209da0508f82d3a1b1", "submitter": { "id": 67922, "url": "http://patchwork.ozlabs.org/api/people/67922/?format=api", "name": "Antonio Quartulli", "email": "a@unstable.cc" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/1462908605-27412-15-git-send-email-a@unstable.cc/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/620794/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/620794/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3r48hC1YL2z9sBR\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 11 May 2016 05:39:07 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752191AbcEJTi7 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 10 May 2016 15:38:59 -0400", "from s2.neomailbox.net ([5.148.176.60]:21705 \"EHLO\n\ts2.neomailbox.net\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751935AbcEJTi5 (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tTue, 10 May 2016 15:38:57 -0400" ], "From": "Antonio Quartulli <a@unstable.cc>", "To": "davem@davemloft.net", "Cc": "netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,\n\tSven Eckelmann <sven@narfation.org>,\n\tMarek Lindner <mareklindner@neomailbox.ch>,\n\tAntonio Quartulli <a@unstable.cc>", "Subject": "[PATCH 14/17] batman-adv: Use kref_get for _batadv_update_route", "Date": "Wed, 11 May 2016 03:30:02 +0800", "Message-Id": "<1462908605-27412-15-git-send-email-a@unstable.cc>", "In-Reply-To": "<1462908605-27412-1-git-send-email-a@unstable.cc>", "References": "<1462908605-27412-1-git-send-email-a@unstable.cc>", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "From: Sven Eckelmann <sven@narfation.org>\n\n_batadv_update_route requires that the caller already has a valid reference\nfor neigh_node. It is therefore not possible that it has an reference\ncounter of 0 and was still given to this function\n\nThe kref_get function instead WARNs (with debug information) when the\nreference counter would still be 0. This makes a bug in batman-adv better\nvisible because kref_get_unless_zero would have ignored this problem.\n\nSigned-off-by: Sven Eckelmann <sven@narfation.org>\nSigned-off-by: Marek Lindner <mareklindner@neomailbox.ch>\nSigned-off-by: Antonio Quartulli <a@unstable.cc>\n---\n net/batman-adv/routing.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)", "diff": "diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c\nindex 2ecfca246be4..b494e435686f 100644\n--- a/net/batman-adv/routing.c\n+++ b/net/batman-adv/routing.c\n@@ -100,10 +100,6 @@ static void _batadv_update_route(struct batadv_priv *bat_priv,\n \tif (curr_router)\n \t\tbatadv_neigh_node_put(curr_router);\n \n-\t/* increase refcount of new best neighbor */\n-\tif (neigh_node && !kref_get_unless_zero(&neigh_node->refcount))\n-\t\tneigh_node = NULL;\n-\n \tspin_lock_bh(&orig_node->neigh_list_lock);\n \t/* curr_router used earlier may not be the current orig_ifinfo->router\n \t * anymore because it was dereferenced outside of the neigh_list_lock\n@@ -114,6 +110,10 @@ static void _batadv_update_route(struct batadv_priv *bat_priv,\n \t */\n \tcurr_router = rcu_dereference_protected(orig_ifinfo->router, true);\n \n+\t/* increase refcount of new best neighbor */\n+\tif (neigh_node)\n+\t\tkref_get(&neigh_node->refcount);\n+\n \trcu_assign_pointer(orig_ifinfo->router, neigh_node);\n \tspin_unlock_bh(&orig_node->neigh_list_lock);\n \tbatadv_orig_ifinfo_put(orig_ifinfo);\n", "prefixes": [ "14/17" ] }