diff options
| author | Weilong Chen <chenweilong@huawei.com> | 2014-01-16 04:24:31 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2014-01-19 23:02:02 -0500 |
| commit | 82ef3d5d5f3ffd757c960693c4fe7a0051211849 (patch) | |
| tree | 2494c00a2fc1d9153734672cfbe7e96e215aa14a /lib | |
| parent | 671314a5abb7abb8346cd3f16f75c1e55ed7667b (diff) | |
net: fix "queues" uevent between network namespaces
When I create a new namespace with 'ip netns add net0', or add/remove
new links in a namespace with 'ip link add/delete type veth', rx/tx
queues events can be got in all namespaces. That is because rx/tx queue
ktypes do not have namespace support, and their kobj parents are setted to
NULL. This patch is to fix it.
Reported-by: Libo Chen <chenlibo@huawei.com>
Signed-off-by: Libo Chen <chenlibo@huawei.com>
Signed-off-by: Weilong Chen <chenweilong@huawei.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/kobject_uevent.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index 52e5abbc41db..5f72767ddd9b 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c | |||
| @@ -88,11 +88,17 @@ out: | |||
| 88 | #ifdef CONFIG_NET | 88 | #ifdef CONFIG_NET |
| 89 | static int kobj_bcast_filter(struct sock *dsk, struct sk_buff *skb, void *data) | 89 | static int kobj_bcast_filter(struct sock *dsk, struct sk_buff *skb, void *data) |
| 90 | { | 90 | { |
| 91 | struct kobject *kobj = data; | 91 | struct kobject *kobj = data, *ksobj; |
| 92 | const struct kobj_ns_type_operations *ops; | 92 | const struct kobj_ns_type_operations *ops; |
| 93 | 93 | ||
| 94 | ops = kobj_ns_ops(kobj); | 94 | ops = kobj_ns_ops(kobj); |
| 95 | if (ops) { | 95 | if (!ops && kobj->kset) { |
| 96 | ksobj = &kobj->kset->kobj; | ||
| 97 | if (ksobj->parent != NULL) | ||
| 98 | ops = kobj_ns_ops(ksobj->parent); | ||
| 99 | } | ||
| 100 | |||
| 101 | if (ops && ops->netlink_ns && kobj->ktype->namespace) { | ||
| 96 | const void *sock_ns, *ns; | 102 | const void *sock_ns, *ns; |
| 97 | ns = kobj->ktype->namespace(kobj); | 103 | ns = kobj->ktype->namespace(kobj); |
| 98 | sock_ns = ops->netlink_ns(dsk); | 104 | sock_ns = ops->netlink_ns(dsk); |
