From: Sven Eckelmann <[email protected]>

The pskb_may_pull() called by batadv_bla_is_backbone_gw() could reallocate
the buffer behind the skb. Variables which were pointing to the old buffer
need to be reassigned to avoid an use-after-free.

Cc: [email protected]
Fixes: 9e794b6bf4a2 ("batman-adv: drop unicast packets from other backbone gw")
Signed-off-by: Sven Eckelmann <[email protected]>
Signed-off-by: Simon Wunderlich <[email protected]>
---
 net/batman-adv/routing.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 2cc2307a41702..bbd40fe3a8e59 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -1029,6 +1029,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
                                                          hdr_size);
                        batadv_orig_node_put(orig_node_gw);
                        if (is_gw) {
+                               orig_addr_gw = eth_hdr(skb)->h_source;
                                batadv_dbg(BATADV_DBG_BLA, bat_priv,
                                           "%s(): Dropped unicast pkt received 
from another backbone gw %pM.\n",
                                           __func__, orig_addr_gw);
-- 
2.47.3

Reply via email to