diff mbox series

[maint,2/3] batman-adv: fix header size check in batadv_dbg_arp()

Message ID 3cc8fb9bb6b983a5b7972af2fd803041095d8c90.1521196151.git.mschiffer@universe-factory.net
State Accepted, archived
Commit 7dfe729b169b1217f47744edbd1616f473340fda
Delegated to: Simon Wunderlich
Headers show
Series [maint,1/3] batman-adv: update data pointers after skb_cow() | expand

Commit Message

Matthias Schiffer March 16, 2018, 10:29 a.m. UTC
Checking for 0 is insufficient: when an SKB without a batadv header, but
with a VLAN header is received, hdr_size will be 4, making the following
code interpret the Ethernet header as a batadv header.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
---
 net/batman-adv/distributed-arp-table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sven Eckelmann March 16, 2018, 11:31 a.m. UTC | #1
On Freitag, 16. März 2018 11:29:10 CET Matthias Schiffer wrote:
> Checking for 0 is insufficient: when an SKB without a batadv header, but
> with a VLAN header is received, hdr_size will be 4, making the following
> code interpret the Ethernet header as a batadv header.
> 
> Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
> ---

Fixes: 0591c25abca9 ("batman-adv: Distributed ARP Table - add ARP parsing functions")

Kind regards,
	Sven
Matthias Schiffer March 16, 2018, 3:05 p.m. UTC | #2
On 03/16/2018 12:31 PM, Sven Eckelmann wrote:
> On Freitag, 16. März 2018 11:29:10 CET Matthias Schiffer wrote:
>> Checking for 0 is insufficient: when an SKB without a batadv header, but
>> with a VLAN header is received, hdr_size will be 4, making the following
>> code interpret the Ethernet header as a batadv header.
>>
>> Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
>> ---
> 
> Fixes: 0591c25abca9 ("batman-adv: Distributed ARP Table - add ARP parsing functions")

I think this one would be more appropriate:

Fixes: 3e26722bc9f2 ("batman-adv: make the Distributed ARP Table vlan aware")

> 
> Kind regards,
> 	Sven
>
diff mbox series

Patch

diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
index 19b15de455ab..b7ca4a311b91 100644
--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -393,7 +393,7 @@  static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb,
 		   batadv_arp_hw_src(skb, hdr_size), &ip_src,
 		   batadv_arp_hw_dst(skb, hdr_size), &ip_dst);
 
-	if (hdr_size == 0)
+	if (hdr_size < sizeof(struct batadv_unicast_packet))
 		return;
 
 	unicast_4addr_packet = (struct batadv_unicast_4addr_packet *)skb->data;