* [B.A.T.M.A.N.] [PATCH] batman-adv: fix skb deref after free
@ 2016-05-10 21:17 Florian Westphal
2016-05-10 21:58 ` Sven Eckelmann
0 siblings, 1 reply; 3+ messages in thread
From: Florian Westphal @ 2016-05-10 21:17 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Florian Westphal
batadv_send_skb_to_orig() calls dev_queue_xmit() so we can't use skb->len.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
Noticed during review, compile tested only.
net/batman-adv/routing.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index b781bf7..0c0c30e 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -601,6 +601,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
struct batadv_unicast_packet *unicast_packet;
struct ethhdr *ethhdr = eth_hdr(skb);
int res, hdr_len, ret = NET_RX_DROP;
+ unsigned int len;
unicast_packet = (struct batadv_unicast_packet *)skb->data;
@@ -641,6 +642,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
if (hdr_len > 0)
batadv_skb_set_priority(skb, hdr_len);
+ len = skb->len;
res = batadv_send_skb_to_orig(skb, orig_node, recv_if);
/* translate transmit result into receive result */
@@ -648,7 +650,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
/* skb was transmitted and consumed */
batadv_inc_counter(bat_priv, BATADV_CNT_FORWARD);
batadv_add_counter(bat_priv, BATADV_CNT_FORWARD_BYTES,
- skb->len + ETH_HLEN);
+ len + ETH_HLEN);
ret = NET_RX_SUCCESS;
} else if (res == NET_XMIT_POLICED) {
--
2.7.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-11 7:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-10 21:17 [B.A.T.M.A.N.] [PATCH] batman-adv: fix skb deref after free Florian Westphal
2016-05-10 21:58 ` Sven Eckelmann
2016-05-11 7:58 ` Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox