Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 202cfe10 authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Greg Kroah-Hartman
Browse files

Staging: batman-adv: Update pointer to ethhdr after skb_copy



We must ensure that all pointer to a socket buffer are updated when we
copy a socket buffer and free our reference to the old one.
Another part of the kernel could also free its reference which maybe
removes the buffer completely. In that situation we would would feed
wrong information to the routing algorithm after the memory area is
written again by someone else.

Signed-off-by: default avatarSven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: default avatarMarek Lindner <lindner_marek@yahoo.de>
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 7d02d777
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -614,6 +614,7 @@ int recv_bat_packet(struct sk_buff *skb,
		skb = skb_copy(skb, GFP_ATOMIC);
		if (!skb)
			return NET_RX_DROP;
		ethhdr = (struct ethhdr *)skb_mac_header(skb);
		kfree_skb(skb_old);
	}

@@ -671,7 +672,9 @@ static int recv_my_icmp_packet(struct sk_buff *skb)
			skb = skb_copy(skb, GFP_ATOMIC);
			if (!skb)
				return NET_RX_DROP;

			icmp_packet = (struct icmp_packet *)skb->data;
			ethhdr = (struct ethhdr *)skb_mac_header(skb);
			kfree_skb(skb_old);
		}

@@ -732,6 +735,7 @@ static int recv_icmp_ttl_exceeded(struct sk_buff *skb)
			if (!skb)
				return NET_RX_DROP;
			icmp_packet = (struct icmp_packet *) skb->data;
			ethhdr = (struct ethhdr *)skb_mac_header(skb);
			kfree_skb(skb_old);
		}

@@ -813,6 +817,7 @@ int recv_icmp_packet(struct sk_buff *skb)
			if (!skb)
				return NET_RX_DROP;
			icmp_packet = (struct icmp_packet *)skb->data;
			ethhdr = (struct ethhdr *)skb_mac_header(skb);
			kfree_skb(skb_old);
		}

@@ -896,6 +901,7 @@ int recv_unicast_packet(struct sk_buff *skb)
			if (!skb)
				return NET_RX_DROP;
			unicast_packet = (struct unicast_packet *)skb->data;
			ethhdr = (struct ethhdr *)skb_mac_header(skb);
			kfree_skb(skb_old);
		}
		/* decrement ttl */