|
@@ -671,6 +671,7 @@ static struct tc_cookie *nla_memdup_cookie(struct nlattr **tb)
|
|
struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
|
|
struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
|
|
struct nlattr *nla, struct nlattr *est,
|
|
struct nlattr *nla, struct nlattr *est,
|
|
char *name, int ovr, int bind,
|
|
char *name, int ovr, int bind,
|
|
|
|
+ bool rtnl_held,
|
|
struct netlink_ext_ack *extack)
|
|
struct netlink_ext_ack *extack)
|
|
{
|
|
{
|
|
struct tc_action *a;
|
|
struct tc_action *a;
|
|
@@ -721,9 +722,11 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
|
|
a_o = tc_lookup_action_n(act_name);
|
|
a_o = tc_lookup_action_n(act_name);
|
|
if (a_o == NULL) {
|
|
if (a_o == NULL) {
|
|
#ifdef CONFIG_MODULES
|
|
#ifdef CONFIG_MODULES
|
|
- rtnl_unlock();
|
|
|
|
|
|
+ if (rtnl_held)
|
|
|
|
+ rtnl_unlock();
|
|
request_module("act_%s", act_name);
|
|
request_module("act_%s", act_name);
|
|
- rtnl_lock();
|
|
|
|
|
|
+ if (rtnl_held)
|
|
|
|
+ rtnl_lock();
|
|
|
|
|
|
a_o = tc_lookup_action_n(act_name);
|
|
a_o = tc_lookup_action_n(act_name);
|
|
|
|
|
|
@@ -746,9 +749,10 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
|
|
/* backward compatibility for policer */
|
|
/* backward compatibility for policer */
|
|
if (name == NULL)
|
|
if (name == NULL)
|
|
err = a_o->init(net, tb[TCA_ACT_OPTIONS], est, &a, ovr, bind,
|
|
err = a_o->init(net, tb[TCA_ACT_OPTIONS], est, &a, ovr, bind,
|
|
- extack);
|
|
|
|
|
|
+ rtnl_held, extack);
|
|
else
|
|
else
|
|
- err = a_o->init(net, nla, est, &a, ovr, bind, extack);
|
|
|
|
|
|
+ err = a_o->init(net, nla, est, &a, ovr, bind, rtnl_held,
|
|
|
|
+ extack);
|
|
if (err < 0)
|
|
if (err < 0)
|
|
goto err_mod;
|
|
goto err_mod;
|
|
|
|
|
|
@@ -800,7 +804,7 @@ static void cleanup_a(struct list_head *actions, int ovr)
|
|
int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla,
|
|
int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla,
|
|
struct nlattr *est, char *name, int ovr, int bind,
|
|
struct nlattr *est, char *name, int ovr, int bind,
|
|
struct list_head *actions, size_t *attr_size,
|
|
struct list_head *actions, size_t *attr_size,
|
|
- struct netlink_ext_ack *extack)
|
|
|
|
|
|
+ bool rtnl_held, struct netlink_ext_ack *extack)
|
|
{
|
|
{
|
|
struct nlattr *tb[TCA_ACT_MAX_PRIO + 1];
|
|
struct nlattr *tb[TCA_ACT_MAX_PRIO + 1];
|
|
struct tc_action *act;
|
|
struct tc_action *act;
|
|
@@ -814,7 +818,7 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla,
|
|
|
|
|
|
for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) {
|
|
for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) {
|
|
act = tcf_action_init_1(net, tp, tb[i], est, name, ovr, bind,
|
|
act = tcf_action_init_1(net, tp, tb[i], est, name, ovr, bind,
|
|
- extack);
|
|
|
|
|
|
+ rtnl_held, extack);
|
|
if (IS_ERR(act)) {
|
|
if (IS_ERR(act)) {
|
|
err = PTR_ERR(act);
|
|
err = PTR_ERR(act);
|
|
goto err;
|
|
goto err;
|
|
@@ -1173,7 +1177,7 @@ static int tcf_action_add(struct net *net, struct nlattr *nla,
|
|
LIST_HEAD(actions);
|
|
LIST_HEAD(actions);
|
|
|
|
|
|
ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0, &actions,
|
|
ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0, &actions,
|
|
- &attr_size, extack);
|
|
|
|
|
|
+ &attr_size, true, extack);
|
|
if (ret)
|
|
if (ret)
|
|
return ret;
|
|
return ret;
|
|
|
|
|