ipvlan: fix use after free of skb
authorSabrina Dubroca <sd@queasysnail.net>
Mon, 16 Nov 2015 21:44:53 +0000 (22:44 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 17 Nov 2015 19:39:29 +0000 (14:39 -0500)
ipvlan_handle_frame is a rx_handler, and when it returns a value other
than RX_HANDLER_CONSUMED (here, NET_RX_DROP aka RX_HANDLER_ANOTHER),
__netif_receive_skb_core expects that the skb still exists and will
process it further, but we just freed it.

Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ipvlan/ipvlan_core.c

index a9148e46dad0c94ef751c65279c44c60bca82cb4..8c48bb2a94ea063aa9dd7c4dc662aa772f34930c 100644 (file)
@@ -653,5 +653,5 @@ rx_handler_result_t ipvlan_handle_frame(struct sk_buff **pskb)
        WARN_ONCE(true, "ipvlan_handle_frame() called for mode = [%hx]\n",
                          port->mode);
        kfree_skb(skb);
-       return NET_RX_DROP;
+       return RX_HANDLER_CONSUMED;
 }