mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-06 17:35:20 +02:00
rtnetlink: add RTNL_FLAG_DUMP_UNLOCKED flag
[ Upstream commit386520e0ec
] Similarly to RTNL_FLAG_DOIT_UNLOCKED, this new flag allows dump operations registered via rtnl_register() or rtnl_register_module() to opt-out from RTNL protection. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Stable-dep-of:5be2062e30
("mpls: Handle error of rtnl_register_module().") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
c8c76f1550
commit
ba5366b87c
|
@ -289,6 +289,7 @@ struct netlink_callback {
|
|||
u16 answer_flags;
|
||||
u32 min_dump_alloc;
|
||||
unsigned int prev_seq, seq;
|
||||
int flags;
|
||||
bool strict_check;
|
||||
union {
|
||||
u8 ctx[48];
|
||||
|
@ -321,6 +322,7 @@ struct netlink_dump_control {
|
|||
void *data;
|
||||
struct module *module;
|
||||
u32 min_dump_alloc;
|
||||
int flags;
|
||||
};
|
||||
|
||||
int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
|
||||
|
|
|
@ -12,6 +12,7 @@ typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
|
|||
enum rtnl_link_flags {
|
||||
RTNL_FLAG_DOIT_UNLOCKED = BIT(0),
|
||||
RTNL_FLAG_BULK_DEL_SUPPORTED = BIT(1),
|
||||
RTNL_FLAG_DUMP_UNLOCKED = BIT(2),
|
||||
};
|
||||
|
||||
enum rtnl_kinds {
|
||||
|
|
|
@ -6405,6 +6405,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|||
}
|
||||
owner = link->owner;
|
||||
dumpit = link->dumpit;
|
||||
flags = link->flags;
|
||||
|
||||
if (type == RTM_GETLINK - RTM_BASE)
|
||||
min_dump_alloc = rtnl_calcit(skb, nlh);
|
||||
|
@ -6422,6 +6423,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|||
.dump = dumpit,
|
||||
.min_dump_alloc = min_dump_alloc,
|
||||
.module = owner,
|
||||
.flags = flags,
|
||||
};
|
||||
err = netlink_dump_start(rtnl, skb, nlh, &c);
|
||||
/* netlink_dump_start() will keep a reference on
|
||||
|
|
|
@ -2263,6 +2263,8 @@ static int netlink_dump(struct sock *sk, bool lock_taken)
|
|||
|
||||
cb->extack = &extack;
|
||||
|
||||
if (cb->flags & RTNL_FLAG_DUMP_UNLOCKED)
|
||||
extra_mutex = NULL;
|
||||
if (extra_mutex)
|
||||
mutex_lock(extra_mutex);
|
||||
nlk->dump_done_errno = cb->dump(skb, cb);
|
||||
|
@ -2357,6 +2359,7 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
|
|||
cb->data = control->data;
|
||||
cb->module = control->module;
|
||||
cb->min_dump_alloc = control->min_dump_alloc;
|
||||
cb->flags = control->flags;
|
||||
cb->skb = skb;
|
||||
|
||||
cb->strict_check = nlk_test_bit(STRICT_CHK, NETLINK_CB(skb).sk);
|
||||
|
|
Loading…
Reference in New Issue
Block a user