X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=datapath%2Fdp_sysfs_if.c;h=f564e9808f26650beeb068392e49137f7454a7f1;hb=a39edbd4a409ad14b79c2205e340c07185785b92;hp=5b695cfc003a582a3a86359beebbecb45ca3a481;hpb=850b6b3b9f8c38b42e315c2c07d232a33b82da3e;p=openvswitch diff --git a/datapath/dp_sysfs_if.c b/datapath/dp_sysfs_if.c index 5b695cfc..f564e980 100644 --- a/datapath/dp_sysfs_if.c +++ b/datapath/dp_sysfs_if.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011 Nicira Networks. + * Copyright (c) 2007-2012 Nicira Networks. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -217,6 +217,14 @@ int ovs_dp_sysfs_add_if(struct vport *p) if (!p->ops->get_kobj) return -ENOENT; +#ifdef CONFIG_NET_NS + /* Due to bug in 2.6.32 kernel, sysfs_create_group() could panic + * in other namespace than init_net. Following check is to avoid it. */ + + if (!p->kobj.sd) + return -ENOENT; +#endif + err = kobject_add(&p->kobj, p->ops->get_kobj(p), SYSFS_BRIDGE_PORT_ATTR); if (err)