mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-06 11:54:14 -04:00
net: rtnetlink: add bulk delete support flag
[ Upstream commit a6cec0bcd34264be8887791594be793b3f12719f ]
Add a new rtnl flag (RTNL_FLAG_BULK_DEL_SUPPORTED) which is used to
verify that the delete operation allows bulk object deletion. Also emit
a warning if anyone tries to set it for non-delete kind.
Suggested-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Stable-dep-of: bf29555f5bdc ("rtnetlink: Allow deleting FDB entries in user namespace")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
6dea96a841
commit
2b0d1dc340
2 changed files with 10 additions and 1 deletions
|
|
@ -10,7 +10,8 @@ typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *,
|
|||
typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
|
||||
|
||||
enum rtnl_link_flags {
|
||||
RTNL_FLAG_DOIT_UNLOCKED = BIT(0),
|
||||
RTNL_FLAG_DOIT_UNLOCKED = BIT(0),
|
||||
RTNL_FLAG_BULK_DEL_SUPPORTED = BIT(1),
|
||||
};
|
||||
|
||||
enum rtnl_kinds {
|
||||
|
|
|
|||
|
|
@ -214,6 +214,8 @@ static int rtnl_register_internal(struct module *owner,
|
|||
if (dumpit)
|
||||
link->dumpit = dumpit;
|
||||
|
||||
WARN_ON(rtnl_msgtype_kind(msgtype) != RTNL_KIND_DEL &&
|
||||
(flags & RTNL_FLAG_BULK_DEL_SUPPORTED));
|
||||
link->flags |= flags;
|
||||
|
||||
/* publish protocol:msgtype */
|
||||
|
|
@ -5274,6 +5276,12 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|||
}
|
||||
|
||||
flags = link->flags;
|
||||
if (kind == RTNL_KIND_DEL && (nlh->nlmsg_flags & NLM_F_BULK) &&
|
||||
!(flags & RTNL_FLAG_BULK_DEL_SUPPORTED)) {
|
||||
NL_SET_ERR_MSG(extack, "Bulk delete is not supported");
|
||||
goto err_unlock;
|
||||
}
|
||||
|
||||
if (flags & RTNL_FLAG_DOIT_UNLOCKED) {
|
||||
doit = link->doit;
|
||||
rcu_read_unlock();
|
||||
|
|
|
|||
Loading…
Reference in a new issue