Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit d1697bc

Browse files
gregkhTreehugger Robot
authored andcommitted
Revert "phonet: no longer hold RTNL in route_dumpit()"
This reverts commit a8e473f which is commit 58a4ff5 upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: Iaccabecb3c82b59e8bf01e47e9f2b6e0be8c039b Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 847f07e commit d1697bc

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

net/phonet/pn_netlink.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static int fill_route(struct sk_buff *skb, struct net_device *dev, u8 dst,
178178
rtm->rtm_type = RTN_UNICAST;
179179
rtm->rtm_flags = 0;
180180
if (nla_put_u8(skb, RTA_DST, dst) ||
181-
nla_put_u32(skb, RTA_OIF, READ_ONCE(dev->ifindex)))
181+
nla_put_u32(skb, RTA_OIF, dev->ifindex))
182182
goto nla_put_failure;
183183
nlmsg_end(skb, nlh);
184184
return 0;
@@ -263,7 +263,6 @@ static int route_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
263263
static int route_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
264264
{
265265
struct net *net = sock_net(skb->sk);
266-
int err = 0;
267266
u8 addr;
268267

269268
rcu_read_lock();
@@ -273,16 +272,16 @@ static int route_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
273272
if (!dev)
274273
continue;
275274

276-
err = fill_route(skb, dev, addr << 2,
277-
NETLINK_CB(cb->skb).portid,
278-
cb->nlh->nlmsg_seq, RTM_NEWROUTE);
279-
if (err < 0)
280-
break;
275+
if (fill_route(skb, dev, addr << 2, NETLINK_CB(cb->skb).portid,
276+
cb->nlh->nlmsg_seq, RTM_NEWROUTE) < 0)
277+
goto out;
281278
}
279+
280+
out:
282281
rcu_read_unlock();
283282
cb->args[0] = addr;
284283

285-
return err;
284+
return skb->len;
286285
}
287286

288287
int __init phonet_netlink_register(void)
@@ -302,6 +301,6 @@ int __init phonet_netlink_register(void)
302301
rtnl_register_module(THIS_MODULE, PF_PHONET, RTM_DELROUTE,
303302
route_doit, NULL, 0);
304303
rtnl_register_module(THIS_MODULE, PF_PHONET, RTM_GETROUTE,
305-
NULL, route_dumpit, RTNL_FLAG_DUMP_UNLOCKED);
304+
NULL, route_dumpit, 0);
306305
return 0;
307306
}

0 commit comments

Comments
 (0)