Looks good. Acked-by: Pravin B Shelar <[email protected]>
On Tue, Aug 21, 2012 at 5:54 PM, Jesse Gross <[email protected]> wrote: > If a datapath fails to initialze fully (likely due to out-of-memory) > then it's possible that we can take a reference to a network > namespace but never release it. This fixes the problem by releasing > any resources in the event of an error. > > Found by code inspection, it's likely to be extremely rare in practice. > > Signed-off-by: Jesse Gross <[email protected]> > --- > datapath/datapath.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/datapath/datapath.c b/datapath/datapath.c > index e98c84b..c83ce16 100644 > --- a/datapath/datapath.c > +++ b/datapath/datapath.c > @@ -1407,6 +1407,8 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct > genl_info *info) > dp->ifobj.kset = NULL; > kobject_init(&dp->ifobj, &dp_ktype); > > + ovs_dp_set_net(dp, hold_net(sock_net(skb->sk))); > + > /* Allocate table. */ > err = -ENOMEM; > rcu_assign_pointer(dp->table, ovs_flow_tbl_alloc(TBL_MIN_BUCKETS)); > @@ -1418,7 +1420,6 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct > genl_info *info) > err = -ENOMEM; > goto err_destroy_table; > } > - ovs_dp_set_net(dp, hold_net(sock_net(skb->sk))); > > dp->ports = kmalloc(DP_VPORT_HASH_BUCKETS * sizeof(struct hlist_head), > GFP_KERNEL); > @@ -1473,6 +1474,7 @@ err_destroy_percpu: > err_destroy_table: > ovs_flow_tbl_destroy(genl_dereference(dp->table)); > err_free_dp: > + release_net(ovs_dp_get_net(dp)); > kfree(dp); > err_unlock_rtnl: > rtnl_unlock(); > -- > 1.7.9.5 > > _______________________________________________ > dev mailing list > [email protected] > http://openvswitch.org/mailman/listinfo/dev _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
