Received: by 10.223.185.116 with SMTP id b49csp6387955wrg; Wed, 28 Feb 2018 08:35:25 -0800 (PST) X-Google-Smtp-Source: AH8x2247L1mIyqv3ncpAI1fGzCNbjGnol8nFH42DEDDcFrx0svyLnVJSXgdyqp6vzTeix9NPZxqv X-Received: by 10.99.137.195 with SMTP id v186mr14593696pgd.90.1519835725106; Wed, 28 Feb 2018 08:35:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519835725; cv=none; d=google.com; s=arc-20160816; b=MeyLnID+60Gwre3ihrY0/3Lb89KI6KR7hKxvPzHWSXBQhkb5XBrnJrK6pJQjYmHa3W E/tspWAU6QFP0WDgOjYHN61kFlzEKrn8V7I+g/VqSM76ys6i3piZTHthWffaFkRw4YUp Rr+0PPH5l5iT4SwIWWkd2NGNz3SEfExCgdnUl2x9ITMfb0ekDPUqTloxsup/X7iXAqFx nhKsb3C8SLIA1/sEgW9rP3tqqHjGge/Nsrld+PncrRgjq6SHo2NuhKqL55nXfGTW4/dV 8cNv27J3E0vhe0etfc/8pE35tSHN3hCnvXaysMOg/CU8+v9YO6+Ofc4iy/PMLRJPby00 0eBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=8HANQijCt3ljXymQ6hRVKgALyVpqvOrtQ8k4SSV7FuA=; b=VhFgkkqpzuXHQXLgP9KPrMmYwIokF+IzP3Q5N0YhIBAkfqUZVp+rgB9I8pMyv0l75a o2sxbZxOqOO5iQ9XpBzU1cw/vjrPYJSFmV3ReKMGgcl4NVzZqqNP4lHsfrNoHFjZQ5ql nKc8gPNtwiMBPrn6anAh6uwi94YmjWBi/MU6rfx4MgkcVcKc6YwAgUSSkwLXVadJaJuK nHRdY0LmJdAKg9YpMYsmBZdW4yTl+JjBBm4wKVXTbgZGtfm+VvCrG1eWWin1xD7bBO3y j/3klZNHPoIpn0yoL1OrYycGZUwXAP0rxQ8chg8m+89zUrg96lRJKnWf+/Rbauh4R/Bk 5uMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l30-v6si1086800plg.346.2018.02.28.08.35.10; Wed, 28 Feb 2018 08:35:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933432AbeB1QeL (ORCPT + 99 others); Wed, 28 Feb 2018 11:34:11 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:35084 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934645AbeB1QOB (ORCPT ); Wed, 28 Feb 2018 11:14:01 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yu-0006XS-5j; Wed, 28 Feb 2018 15:22:32 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Ye-0008RC-Fo; Wed, 28 Feb 2018 15:22:16 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Sven Eckelmann" , "Simon Wunderlich" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 052/254] batman-adv: Fix lock for ogm cnt access in batadv_iv_ogm_calc_tq In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Sven Eckelmann commit 5ba7dcfe77037b67016263ea597a8b431692ecab upstream. The originator node object orig_neigh_node is used to when accessing the bcast_own(_sum) and real_packet_count information. The access to them has to be protected with the spinlock in orig_neigh_node. But the function uses the lock in orig_node instead. This is incorrect because they could be two different originator node objects. Fixes: 0ede9f41b217 ("batman-adv: protect bit operations to count OGMs with spinlock") Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich Signed-off-by: Ben Hutchings --- net/batman-adv/bat_iv_ogm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -1174,7 +1174,7 @@ static int batadv_iv_ogm_calc_tq(struct orig_node->last_seen = jiffies; /* find packet count of corresponding one hop neighbor */ - spin_lock_bh(&orig_node->bat_iv.ogm_cnt_lock); + spin_lock_bh(&orig_neigh_node->bat_iv.ogm_cnt_lock); if_num = if_incoming->if_num; orig_eq_count = orig_neigh_node->bat_iv.bcast_own_sum[if_num]; neigh_ifinfo = batadv_neigh_ifinfo_new(neigh_node, if_outgoing); @@ -1184,7 +1184,7 @@ static int batadv_iv_ogm_calc_tq(struct } else { neigh_rq_count = 0; } - spin_unlock_bh(&orig_node->bat_iv.ogm_cnt_lock); + spin_unlock_bh(&orig_neigh_node->bat_iv.ogm_cnt_lock); /* pay attention to not get a value bigger than 100 % */ if (orig_eq_count > neigh_rq_count)