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

Commit 8710e261 authored by Antonio Quartulli's avatar Antonio Quartulli
Browse files

batman-adv: avoid skb_linearise() if not needed



Whenever we want to access headers only, we do not need to linearise the whole
packet. Instead we can use pskb_may_pull()

Signed-off-by: default avatarAntonio Quartulli <ordex@autistici.org>
parent f96a8a0b
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -916,8 +916,9 @@ static int check_unicast_ttvn(struct bat_priv *bat_priv,


	/* Check whether I have to reroute the packet */
	/* Check whether I have to reroute the packet */
	if (seq_before(unicast_packet->ttvn, curr_ttvn) || tt_poss_change) {
	if (seq_before(unicast_packet->ttvn, curr_ttvn) || tt_poss_change) {
		/* Linearize the skb before accessing it */
		/* check if there is enough data before accessing it */
		if (skb_linearize(skb) < 0)
		if (pskb_may_pull(skb, sizeof(struct unicast_packet) +
				  ETH_HLEN) < 0)
			return 0;
			return 0;


		ethhdr = (struct ethhdr *)(skb->data +
		ethhdr = (struct ethhdr *)(skb->data +