Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55dbc640 authored by David S. Miller's avatar David S. Miller
Browse files

pkt_sched: Remove qdisc_lock_tree usage in cls_api.c



It just wants the qdisc tree for the filter to be synchronized.
So just BH lock qdisc_root_lock(q) instead.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 17715e62
Loading
Loading
Loading
Loading
+7 −4
Original line number Original line Diff line number Diff line
@@ -120,6 +120,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
{
{
	struct net *net = sock_net(skb->sk);
	struct net *net = sock_net(skb->sk);
	struct nlattr *tca[TCA_MAX + 1];
	struct nlattr *tca[TCA_MAX + 1];
	spinlock_t *root_lock;
	struct tcmsg *t;
	struct tcmsg *t;
	u32 protocol;
	u32 protocol;
	u32 prio;
	u32 prio;
@@ -204,6 +205,8 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
		}
		}
	}
	}


	root_lock = qdisc_root_lock(q);

	if (tp == NULL) {
	if (tp == NULL) {
		/* Proto-tcf does not exist, create new one */
		/* Proto-tcf does not exist, create new one */


@@ -263,10 +266,10 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
			goto errout;
			goto errout;
		}
		}


		qdisc_lock_tree(dev);
		spin_lock_bh(root_lock);
		tp->next = *back;
		tp->next = *back;
		*back = tp;
		*back = tp;
		qdisc_unlock_tree(dev);
		spin_unlock_bh(root_lock);


	} else if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], tp->ops->kind))
	} else if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], tp->ops->kind))
		goto errout;
		goto errout;
@@ -275,9 +278,9 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)


	if (fh == 0) {
	if (fh == 0) {
		if (n->nlmsg_type == RTM_DELTFILTER && t->tcm_handle == 0) {
		if (n->nlmsg_type == RTM_DELTFILTER && t->tcm_handle == 0) {
			qdisc_lock_tree(dev);
			spin_lock_bh(root_lock);
			*back = tp->next;
			*back = tp->next;
			qdisc_unlock_tree(dev);
			spin_lock_bh(root_lock);


			tfilter_notify(skb, n, tp, fh, RTM_DELTFILTER);
			tfilter_notify(skb, n, tp, fh, RTM_DELTFILTER);
			tcf_destroy(tp);
			tcf_destroy(tp);