diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 0b809dfb0e430cc3b999ce39cceb661c33e5a738..51f2ea115f300d25d8db8691edf888380a2c7e61 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -1604,6 +1604,10 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, q = qdisc_lookup(dev, tcm->tcm_handle); if (!q) goto create_n_graft; + if (q->parent != tcm->tcm_parent) { + NL_SET_ERR_MSG(extack, "Cannot move an existing qdisc to a different parent"); + return -EINVAL; + } if (n->nlmsg_flags & NLM_F_EXCL) { NL_SET_ERR_MSG(extack, "Exclusivity flag on, cannot override"); return -EEXIST;