From patchwork Thu Sep 29 15:22:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 16710 X-Patchwork-Delegate: sven@narfation.org Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id CE75F8193A; Thu, 29 Sep 2016 17:23:19 +0200 (CEST) Authentication-Results: open-mesh.org; dmarc=none header.from=open-mesh.com Authentication-Results: open-mesh.org; dkim=fail reason="verification failed; unprotected key" header.d=open-mesh-com.20150623.gappssmtp.com header.i=@open-mesh-com.20150623.gappssmtp.com header.b=FfJLgJ2m; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received-SPF: Neutral (access neither permitted nor denied) identity=mailfrom; client-ip=2a00:1450:400c:c09::229; helo=mail-wm0-x229.google.com; envelope-from=sven.eckelmann@open-mesh.com; receiver=b.a.t.m.a.n@lists.open-mesh.org Authentication-Results: open-mesh.org; dmarc=none header.from=open-mesh.com Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) by open-mesh.org (Postfix) with ESMTPS id A21E180E0B for ; Thu, 29 Sep 2016 17:23:17 +0200 (CEST) Received: by mail-wm0-x229.google.com with SMTP id b130so138982788wmc.0 for ; Thu, 29 Sep 2016 08:23:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=/wjUYCWxbdaWwxt0qHTfa/E4ccey/xeBvx1lJVd7+dc=; b=FfJLgJ2myyQnwNTCMrGNpN1Cmk01fF8v3Fj9o2mfp5UbVS26Uhj353/AD8OnAM4Ai2 k7KbwhguSVHtQDpGgB0yBShLajfapKrvRuVT5tuwou04aaQWj3D0XpXIoA+rnnQfuQhW vuPjog2nAR0heAsuWaEqy3uZDWcNUbWRnh724dTVU+/UxqvzHqI5qT73x5l83EyMNJW7 9xG7RobiFPE7AmIIKA7KMh8gTk9WT8Bhg6w/GRnI12Eo2rYbpfkV7TWgP8DruUj2yHAG Alf4W3K6sv4jpFi+zG0V2lKa4lnn7ESMEsVNdHsfl1CUZcYfYgkdkENOBtIQgE1pDR94 40fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/wjUYCWxbdaWwxt0qHTfa/E4ccey/xeBvx1lJVd7+dc=; b=WPpwwnjoNFBKfB8lrhMX0jglXAHI+t3BGI0y28QD/zVLC4vul6rJxxj0g6FwoDg+QR giWV2mKQkvh5fEr09+A7h2ykKDzfyzbdjGEXeRi2NAjqn3Lvz/lXb6oXTzSmRqeZ5d/k zTdTwKKAnIsdWiKM0UXKVDa3tGV+AYAIBvqp+lE4pbK3MAVUeKhMiKOmLWRoxsvII5OJ f8zxV6LzyXKm+dFuPcQIrnJy9/6QGM5VE9ycpCF5C17b0Z76KghMiATEecgcymRz+C4A POuKXc0mulNoOCDT7lvl29Er3cTk4zYgQ6M11cHIoaUzZzYEqxi8SeGSqjuINIfiwT8g Ks2Q== X-Gm-Message-State: AA6/9RnS0bqBFSyosXSvlCXHT4aSsm1piaiwAkbVXeIfAf3sW0RP4tb292FicapvagkWCZKg X-Received: by 10.28.70.70 with SMTP id t67mr3165390wma.35.1475162596861; Thu, 29 Sep 2016 08:23:16 -0700 (PDT) Received: from sven-desktop.home.narfation.org ([2003:c5:93c1:acf9::2e16]) by smtp.gmail.com with ESMTPSA id f69sm28797656wmg.19.2016.09.29.08.23.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Sep 2016 08:23:16 -0700 (PDT) From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Thu, 29 Sep 2016 17:22:58 +0200 Message-Id: <20160929152258.8217-1-sven.eckelmann@open-mesh.com> X-Mailer: git-send-email 2.9.3 Cc: Sven Eckelmann Subject: [B.A.T.M.A.N.] [PATCH maint] batman-adv: Modify neigh_list only with rcu-list functions X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" The batadv_hard_iface::neigh_list is accessed via rcu based primitives. Thus all operations done on it have to fulfill the requirements by RCU. So using non-RCU mechanisms like hlist_add_head is not allowed because it misses the barriers required to protect concurrent readers when accessing the data behind the pointer. Fixes: fed2826b490c ("batman-adv: add list of unique single hop neighbors per hard-interface") Signed-off-by: Sven Eckelmann Acked-by: Linus Lüssing --- net/batman-adv/originator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index 3940b5d..3e9667e 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c @@ -537,7 +537,7 @@ batadv_hardif_neigh_create(struct batadv_hard_iface *hard_iface, if (bat_priv->algo_ops->neigh.hardif_init) bat_priv->algo_ops->neigh.hardif_init(hardif_neigh); - hlist_add_head(&hardif_neigh->list, &hard_iface->neigh_list); + hlist_add_head_rcu(&hardif_neigh->list, &hard_iface->neigh_list); out: spin_unlock_bh(&hard_iface->neigh_list_lock);