Fix memory leak when OFPP_TABLE is used for a packet that matches no flow.
[sliver-openvswitch.git] / datapath / datapath.c
index d55ac2e..28da3bb 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/netfilter_bridge.h>
 #include <linux/inetdevice.h>
 #include <linux/list.h>
+#include <linux/rculist.h>
 
 #include "openflow-netlink.h"
 #include "datapath.h"
@@ -73,6 +74,7 @@ static struct genl_multicast_group mc_group;
  */
 static struct datapath *dps[DP_MAX];
 DEFINE_MUTEX(dp_mutex);
+EXPORT_SYMBOL(dp_mutex);
 
 static int dp_maint_func(void *data);
 static int send_port_status(struct net_bridge_port *p, uint8_t status);
@@ -552,6 +554,7 @@ int dp_output_port(struct datapath *dp, struct sk_buff *skb, int out_port)
                        execute_actions(dp, skb, &key, flow->actions, flow->n_actions);
                        return 0;
                }
+               kfree_skb(skb);
                return -ESRCH;
        } else if (out_port == OFPP_LOCAL) {
                struct net_device *dev = dp->netdev;
@@ -1219,7 +1222,7 @@ static int table_stats_dump(struct datapath *dp, void *state,
                memset(ots->pad, 0, sizeof ots->pad);
                ots->max_entries = htonl(stats.max_flows);
                ots->active_count = htonl(stats.n_flows);
-               ots->matched_count = cpu_to_be64(0); /* FIXME */
+               ots->matched_count = cpu_to_be64(stats.n_matched);
        }
        return 0;
 }