diff options
author | remi.denis-courmont@nokia <remi.denis-courmont@nokia> | 2009-01-22 22:00:30 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-27 00:03:35 -0500 |
commit | 9a3b7a42bb2919a6282a96a5f4abe0f9be36c4b3 (patch) | |
tree | db61d026f3cbd58b767b01e3b5499f5a2e75464a /net/phonet/pn_netlink.c | |
parent | 6530e0fee1834fab51720769ac422186de2b3120 (diff) |
Phonet: use per-namespace devices list
Signed-off-by: RĂ©mi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/phonet/pn_netlink.c')
-rw-r--r-- | net/phonet/pn_netlink.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/net/phonet/pn_netlink.c b/net/phonet/pn_netlink.c index 918a4f07f24a..1ceea1f92413 100644 --- a/net/phonet/pn_netlink.c +++ b/net/phonet/pn_netlink.c | |||
@@ -123,17 +123,16 @@ nla_put_failure: | |||
123 | 123 | ||
124 | static int getaddr_dumpit(struct sk_buff *skb, struct netlink_callback *cb) | 124 | static int getaddr_dumpit(struct sk_buff *skb, struct netlink_callback *cb) |
125 | { | 125 | { |
126 | struct net *net = sock_net(skb->sk); | 126 | struct phonet_device_list *pndevs; |
127 | struct phonet_device *pnd; | 127 | struct phonet_device *pnd; |
128 | int dev_idx = 0, dev_start_idx = cb->args[0]; | 128 | int dev_idx = 0, dev_start_idx = cb->args[0]; |
129 | int addr_idx = 0, addr_start_idx = cb->args[1]; | 129 | int addr_idx = 0, addr_start_idx = cb->args[1]; |
130 | 130 | ||
131 | spin_lock_bh(&pndevs.lock); | 131 | pndevs = phonet_device_list(sock_net(skb->sk)); |
132 | list_for_each_entry(pnd, &pndevs.list, list) { | 132 | spin_lock_bh(&pndevs->lock); |
133 | list_for_each_entry(pnd, &pndevs->list, list) { | ||
133 | u8 addr; | 134 | u8 addr; |
134 | 135 | ||
135 | if (!net_eq(dev_net(pnd->netdev), net)) | ||
136 | continue; | ||
137 | if (dev_idx > dev_start_idx) | 136 | if (dev_idx > dev_start_idx) |
138 | addr_start_idx = 0; | 137 | addr_start_idx = 0; |
139 | if (dev_idx++ < dev_start_idx) | 138 | if (dev_idx++ < dev_start_idx) |
@@ -153,7 +152,7 @@ static int getaddr_dumpit(struct sk_buff *skb, struct netlink_callback *cb) | |||
153 | } | 152 | } |
154 | 153 | ||
155 | out: | 154 | out: |
156 | spin_unlock_bh(&pndevs.lock); | 155 | spin_unlock_bh(&pndevs->lock); |
157 | cb->args[0] = dev_idx; | 156 | cb->args[0] = dev_idx; |
158 | cb->args[1] = addr_idx; | 157 | cb->args[1] = addr_idx; |
159 | 158 | ||