Patch "batman-adv: bla: fix type misuse for backbone_gw hash indexing" has been added to the 4.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    batman-adv: bla: fix type misuse for backbone_gw hash indexing

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     batman-adv-bla-fix-type-misuse-for-backbone_gw-hash-.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b47e26b17baed6d930e1f791b468785fc79f8eb2
Author: Linus Lüssing <ll@xxxxxxxxxxxxxxxxxx>
Date:   Thu Aug 27 17:34:48 2020 +0200

    batman-adv: bla: fix type misuse for backbone_gw hash indexing
    
    [ 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 <ll@xxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sven Eckelmann <sven@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

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;
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux