rtnetlink.c (35b72beac967240c0a942a008284475b09440db9) rtnetlink.c (ba5366b87c0dc3b15463495598737e28015559cd)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * INET An implementation of the TCP/IP protocol suite for the LINUX
4 * operating system. INET is implemented using the BSD Socket
5 * interface as the means of communication with the user level.
6 *
7 * Routing netlink socket interface: protocol independent part.
8 *

--- 6391 unchanged lines hidden (view full) ---

6400 if (!link || !link->dumpit) {
6401 family = PF_UNSPEC;
6402 link = rtnl_get_link(family, type);
6403 if (!link || !link->dumpit)
6404 goto err_unlock;
6405 }
6406 owner = link->owner;
6407 dumpit = link->dumpit;
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * INET An implementation of the TCP/IP protocol suite for the LINUX
4 * operating system. INET is implemented using the BSD Socket
5 * interface as the means of communication with the user level.
6 *
7 * Routing netlink socket interface: protocol independent part.
8 *

--- 6391 unchanged lines hidden (view full) ---

6400 if (!link || !link->dumpit) {
6401 family = PF_UNSPEC;
6402 link = rtnl_get_link(family, type);
6403 if (!link || !link->dumpit)
6404 goto err_unlock;
6405 }
6406 owner = link->owner;
6407 dumpit = link->dumpit;
6408 flags = link->flags;
6408
6409 if (type == RTM_GETLINK - RTM_BASE)
6410 min_dump_alloc = rtnl_calcit(skb, nlh);
6411
6412 err = 0;
6413 /* need to do this before rcu_read_unlock() */
6414 if (!try_module_get(owner))
6415 err = -EPROTONOSUPPORT;
6416
6417 rcu_read_unlock();
6418
6419 rtnl = net->rtnl;
6420 if (err == 0) {
6421 struct netlink_dump_control c = {
6422 .dump = dumpit,
6423 .min_dump_alloc = min_dump_alloc,
6424 .module = owner,
6409
6410 if (type == RTM_GETLINK - RTM_BASE)
6411 min_dump_alloc = rtnl_calcit(skb, nlh);
6412
6413 err = 0;
6414 /* need to do this before rcu_read_unlock() */
6415 if (!try_module_get(owner))
6416 err = -EPROTONOSUPPORT;
6417
6418 rcu_read_unlock();
6419
6420 rtnl = net->rtnl;
6421 if (err == 0) {
6422 struct netlink_dump_control c = {
6423 .dump = dumpit,
6424 .min_dump_alloc = min_dump_alloc,
6425 .module = owner,
6426 .flags = flags,
6425 };
6426 err = netlink_dump_start(rtnl, skb, nlh, &c);
6427 /* netlink_dump_start() will keep a reference on
6428 * module if dump is still in progress.
6429 */
6430 module_put(owner);
6431 }
6432 return err;

--- 168 unchanged lines hidden ---
6427 };
6428 err = netlink_dump_start(rtnl, skb, nlh, &c);
6429 /* netlink_dump_start() will keep a reference on
6430 * module if dump is still in progress.
6431 */
6432 module_put(owner);
6433 }
6434 return err;

--- 168 unchanged lines hidden ---