mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
net: sched: remove duplicate check of user rights in qdisc
In rtnetlink_rcv_msg function, the permission for all user operations is checked except the GET operation, which is the same as the checking in qdisc. Therefore, remove the user rights check in qdisc. Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com> Message-Id: <20220819041854.83372-1-shaozhengchao@huawei.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
97d29b9231
commit
ab48508191
@ -1977,9 +1977,6 @@ static int tc_new_tfilter(struct sk_buff *skb, struct nlmsghdr *n,
|
|||||||
bool rtnl_held = false;
|
bool rtnl_held = false;
|
||||||
u32 flags;
|
u32 flags;
|
||||||
|
|
||||||
if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
|
|
||||||
replay:
|
replay:
|
||||||
tp_created = 0;
|
tp_created = 0;
|
||||||
|
|
||||||
@ -2208,9 +2205,6 @@ static int tc_del_tfilter(struct sk_buff *skb, struct nlmsghdr *n,
|
|||||||
int err;
|
int err;
|
||||||
bool rtnl_held = false;
|
bool rtnl_held = false;
|
||||||
|
|
||||||
if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
|
|
||||||
err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX,
|
err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX,
|
||||||
rtm_tca_policy, extack);
|
rtm_tca_policy, extack);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
@ -2826,10 +2820,6 @@ static int tc_ctl_chain(struct sk_buff *skb, struct nlmsghdr *n,
|
|||||||
unsigned long cl;
|
unsigned long cl;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (n->nlmsg_type != RTM_GETCHAIN &&
|
|
||||||
!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
|
|
||||||
replay:
|
replay:
|
||||||
q = NULL;
|
q = NULL;
|
||||||
err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX,
|
err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX,
|
||||||
|
@ -1425,10 +1425,6 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
|
|||||||
struct Qdisc *p = NULL;
|
struct Qdisc *p = NULL;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if ((n->nlmsg_type != RTM_GETQDISC) &&
|
|
||||||
!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
|
|
||||||
err = nlmsg_parse_deprecated(n, sizeof(*tcm), tca, TCA_MAX,
|
err = nlmsg_parse_deprecated(n, sizeof(*tcm), tca, TCA_MAX,
|
||||||
rtm_tca_policy, extack);
|
rtm_tca_policy, extack);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
@ -1509,9 +1505,6 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
|
|||||||
struct Qdisc *q, *p;
|
struct Qdisc *q, *p;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
|
|
||||||
replay:
|
replay:
|
||||||
/* Reinit, just in case something touches this. */
|
/* Reinit, just in case something touches this. */
|
||||||
err = nlmsg_parse_deprecated(n, sizeof(*tcm), tca, TCA_MAX,
|
err = nlmsg_parse_deprecated(n, sizeof(*tcm), tca, TCA_MAX,
|
||||||
@ -1993,10 +1986,6 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n,
|
|||||||
u32 qid;
|
u32 qid;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if ((n->nlmsg_type != RTM_GETTCLASS) &&
|
|
||||||
!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
|
|
||||||
err = nlmsg_parse_deprecated(n, sizeof(*tcm), tca, TCA_MAX,
|
err = nlmsg_parse_deprecated(n, sizeof(*tcm), tca, TCA_MAX,
|
||||||
rtm_tca_policy, extack);
|
rtm_tca_policy, extack);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user