Skip to content

Commit bd7df21

Browse files
remi.denis-courmont@nokiadavem330
authored andcommitted
Phonet: do not dump addresses from other namespaces
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d25830e commit bd7df21

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎net/phonet/pn_netlink.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ static int fill_addr(struct sk_buff *skb, struct net_device *dev, u8 addr,
123123

124124
static int getaddr_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
125125
{
126+
struct net *net = sock_net(skb->sk);
126127
struct phonet_device *pnd;
127128
int dev_idx = 0, dev_start_idx = cb->args[0];
128129
int addr_idx = 0, addr_start_idx = cb->args[1];
@@ -131,6 +132,8 @@ static int getaddr_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
131132
list_for_each_entry(pnd, &pndevs.list, list) {
132133
u8 addr;
133134

135+
if (!net_eq(dev_net(pnd->netdev), net))
136+
continue;
134137
if (dev_idx > dev_start_idx)
135138
addr_start_idx = 0;
136139
if (dev_idx++ < dev_start_idx)

0 commit comments

Comments
 (0)