Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3703976pxk; Tue, 29 Sep 2020 04:16:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTsCqI3bI0etnmO8ORT5ELt9+z2GOn1lwtTDVUsBZknixTVcex7ca0DRCnUkNRRt07AFgn X-Received: by 2002:a50:fc87:: with SMTP id f7mr2627367edq.162.1601378168978; Tue, 29 Sep 2020 04:16:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601378168; cv=none; d=google.com; s=arc-20160816; b=SnR4r6K1PubgQTC3hANaMf5aTDZlVO8Ji9uRjrGC1/Tx76ZqvmTi3/p5t2JpMVzhae iKHSnXlpz5BWHYAqJCqNG1Paw/NZ8gMqm3H9w2MH5L3loLNuPmYg+0XZla1h8gAAZ9Bw JtCR49nYE5If22AXqKnhiLWA5Y4GF6CqS4WBEcaSpta5hLSEgGPAxuWCJX7xYrY/U8US 0hYVSABbDdjGUmNtoG839GgDmuHLURAKp5jCMvwPcsyZg+zG4aund+atAOmfTY9e1PoS oCZjqXgeD3Xn3D2TVYjppRSHaRJ62zjIzx52283/UGU7n5ezTUVTwAC12efiYHlGVDhX fEjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6BnD1yJLdPVEFUFuIaZKm+LP096YUNc4jfhybyf9ylE=; b=0z2hCqNzn74OKGfW/IwGcSbKuB/NL9/RNNGllp8pzYDfBwANn1kcuPF40AyCH9s4pP ISYtlkTBd3w72ckSZyVsI+IKv/sBob9yhoTyWOgRUfdnLn179Cj3XqHuVjTJG+HY8/WP TmFf1IFAiY7YuA8m694f7l8XqUukJu8l4O5YpOeWp7gxIJZ/dGbdYCeWdqfdQa7J6uNz It9fmAsqoYHOpb+ms6UUqHSa7loKCmltB2oz0jzfNTSz7DvxSFL1NyQah0KY5xlpF5+Q YcnRTjYGPPNJuIToWxQBzieTH/RLUl24jLWGDrDmONZGMqlWwQDdQN0zU4K6j/XwA3ko wmZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Nm/pVrXY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v11si2560208ede.8.2020.09.29.04.15.46; Tue, 29 Sep 2020 04:16:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Nm/pVrXY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729250AbgI2LLu (ORCPT + 99 others); Tue, 29 Sep 2020 07:11:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:52850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729245AbgI2LLc (ORCPT ); Tue, 29 Sep 2020 07:11:32 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 80650221E7; Tue, 29 Sep 2020 11:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601377891; bh=gIc4dgx4hHmkSQAtiOYdyZYh8KrCO73pq2I0c54yt6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nm/pVrXYHWbMRofEHW/Iccm3Rb8iotfFYEgT35x3aodi/bLYKzRDyWg5Q78+JzZZI F+J+x3c266sLz0exU4QnJKWnpMmfkfYENcFU6Dvkqkvazdhi/4ZcT2g7O4gyjawLDU G0BPW+/9RWvoFpUVTyOomXOQP51w5gCCAOzz6Vac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Linus=20L=C3=BCssing?= , Sven Eckelmann , Sasha Levin Subject: [PATCH 4.9 109/121] batman-adv: bla: fix type misuse for backbone_gw hash indexing Date: Tue, 29 Sep 2020 13:00:53 +0200 Message-Id: <20200929105935.585172423@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105930.172747117@linuxfoundation.org> References: <20200929105930.172747117@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Lüssing [ Upstream commit 097930e85f90f252c44dc0d084598265dd44ca48 ] It seems that due to a copy & paste error the void pointer in batadv_choose_backbone_gw() is cast to the wrong type. Fixing this by using "struct batadv_bla_backbone_gw" instead of "struct batadv_bla_claim" which better matches the caller's side. For now it seems that we were lucky because the two structs both have their orig/vid and addr/vid in the beginning. However I stumbled over this issue when I was trying to add some debug variables in front of "orig" in batadv_backbone_gw, which caused hash lookups to fail. Fixes: 07568d0369f9 ("batman-adv: don't rely on positions in struct for hashing") Signed-off-by: Linus Lüssing Signed-off-by: Sven Eckelmann Signed-off-by: Sasha Levin --- net/batman-adv/bridge_loop_avoidance.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index e545b42ab0b98..f8b117acb9443 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c @@ -95,11 +95,12 @@ static inline u32 batadv_choose_claim(const void *data, u32 size) */ static inline u32 batadv_choose_backbone_gw(const void *data, u32 size) { - const struct batadv_bla_claim *claim = (struct batadv_bla_claim *)data; + const struct batadv_bla_backbone_gw *gw; u32 hash = 0; - hash = jhash(&claim->addr, sizeof(claim->addr), hash); - hash = jhash(&claim->vid, sizeof(claim->vid), hash); + gw = (struct batadv_bla_backbone_gw *)data; + hash = jhash(&gw->orig, sizeof(gw->orig), hash); + hash = jhash(&gw->vid, sizeof(gw->vid), hash); return hash % size; } -- 2.25.1