Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3700236pxk; Tue, 29 Sep 2020 04:10:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyClTc5qswyumqfZ34EYylTRphgJZ0gRtlasZBoq5uqiwIXFLcynpz4fLbvpuwOkMRAGV6G X-Received: by 2002:a17:906:3056:: with SMTP id d22mr3190684ejd.495.1601377838410; Tue, 29 Sep 2020 04:10:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601377838; cv=none; d=google.com; s=arc-20160816; b=aCpUEQGm6dRB37nPfozpo9jebKnQFi8QB31s6fxQzjhUtQgFsJ4vc0tilmdT0M+6st Z4Xv6rrzYW9gkW4X0v6bzDtZ/ut+8MLnF7UD5KDsE4i0vAs8LdfLY2XIhed8cX4nR/7Z m0J3d8pB+jVmCDvh7b8T6DnAQzOSfqG3+ovL4eJEGblHnQcBINSo6LFqvYnwYViy73nJ g4BeLXTvUKGAV0A9doWhwFB0I7o/vjwUf5hGZcq1p87ZUhL4uLxfgAV0sYLsJGdyvNNQ ZuhON5ole3KsPTOUtZKz/iTiib0IyG4AHlS990wtTKapssfoZpe8kz6c4cYjuayMbkl4 o3IQ== 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=6ecwNdxImRy1OO9f9yvLNHUKNX6trcD78yHw/6D9K2I=; b=SXEgTwpOwF08+oH0QOUYI7h1mie6t5CU2C2mYTfwpYCmq6S3AQ8zXZvBztl+/KXQFE cy3i7t/heKOT/fwsf7Vx5A20q8PPm6knI+2EK8q/qNSlLMqsTK/+5606v5c1UcpfuvV3 /Dgt1326pLtY9htEiXg/q8dCj38MgUZtK+257t2813+OiaDdShyQn2YmIFtq1uO5CTVD ssLNRQHwL746/b3lUfZ1OfOYa5mFKUNIgrRTroOCFXY9Lk/v5BixG4JIHHA/8I8toltg wngqzikz7pvMSiliVhJgLYG2nf9T6pitNUPScQVuHRCCidHO9aw/4l04YHxDDI6UQo1v t8Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=revYlZVF; 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 h19si2429095ejl.253.2020.09.29.04.10.14; Tue, 29 Sep 2020 04:10:38 -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=revYlZVF; 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 S1728358AbgI2LGS (ORCPT + 99 others); Tue, 29 Sep 2020 07:06:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:42398 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728785AbgI2LFy (ORCPT ); Tue, 29 Sep 2020 07:05:54 -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 59FFC206DB; Tue, 29 Sep 2020 11:05:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601377553; bh=oWexgkyQ5QqmqqfNAI66bcmREr4+IJ9zW+Zyy8Y73GU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=revYlZVFIPj404bbtxzIOoWYq7P/hs35ruZRtTBU4ZkozyALmKXfj0CqF+QUfMDL9 0kQQS6eSfVvojWLwtzdrOXED2K39XOi8DZpgN7sa94Jz/pGPHgR7iugQMz/7GJ1HTc LawDlo32VO2+aLiCUUyT3HXdHpgF7YshLHgC5KH0= 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.4 75/85] batman-adv: bla: fix type misuse for backbone_gw hash indexing Date: Tue, 29 Sep 2020 13:00:42 +0200 Message-Id: <20200929105931.948044761@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105928.198942536@linuxfoundation.org> References: <20200929105928.198942536@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 9aa5daa551273..1267cbb1a329a 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c @@ -73,11 +73,12 @@ static inline u32 batadv_choose_claim(const void *data, u32 size) /* return the index of the backbone gateway */ 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