]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
macvlan: fix leak in macvlan_handle_frame
authorSabrina Dubroca <sd@queasysnail.net>
Mon, 16 Nov 2015 21:54:20 +0000 (22:54 +0100)
committerLuis Henriques <luis.henriques@canonical.com>
Fri, 18 Dec 2015 16:06:16 +0000 (16:06 +0000)
commit e639b8d8a7a728f0b05ef2df6cb6b45dc3d4e556 upstream.

Reset pskb in macvlan_handle_frame in case skb_share_check returned a
clone.

Fixes: 8a4eb5734e8d ("net: introduce rx_handler results and logic around that")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/net/macvlan.c

index d4404e4cad41a7a7714efd7aa81121c279639397..bb33b0410a2285a0259bd4b11ac795ccf0aab686 100644 (file)
@@ -284,6 +284,7 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
                skb = ip_check_defrag(skb, IP_DEFRAG_MACVLAN);
                if (!skb)
                        return RX_HANDLER_CONSUMED;
+               *pskb = skb;
                eth = eth_hdr(skb);
                src = macvlan_hash_lookup(port, eth->h_source);
                if (src && src->mode != MACVLAN_MODE_VEPA &&
@@ -319,6 +320,7 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
        if (!skb)
                goto out;
 
+       *pskb = skb;
        skb->dev = dev;
        skb->pkt_type = PACKET_HOST;