Unverified Commit b68be3a4 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!1568 net/sched: cls_u32: Fix reference counter leak leading to overflow

parents 8a366b3d a4ef07ca
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -778,11 +778,22 @@ static int u32_set_parms(struct net *net, struct tcf_proto *tp,
			 struct netlink_ext_ack *extack)
{
	int err;
#ifdef CONFIG_NET_CLS_IND
	int ifindex = -1;
#endif

	err = tcf_exts_validate(net, tp, tb, est, &n->exts, ovr, extack);
	if (err < 0)
		return err;

#ifdef CONFIG_NET_CLS_IND
	if (tb[TCA_U32_INDEV]) {
		ifindex = tcf_change_indev(net, tb[TCA_U32_INDEV], extack);
		if (ifindex < 0)
			return -EINVAL;
	}
#endif

	if (tb[TCA_U32_LINK]) {
		u32 handle = nla_get_u32(tb[TCA_U32_LINK]);
		struct tc_u_hnode *ht_down = NULL, *ht_old;
@@ -814,13 +825,8 @@ static int u32_set_parms(struct net *net, struct tcf_proto *tp,
	}

#ifdef CONFIG_NET_CLS_IND
	if (tb[TCA_U32_INDEV]) {
		int ret;
		ret = tcf_change_indev(net, tb[TCA_U32_INDEV], extack);
		if (ret < 0)
			return -EINVAL;
		n->ifindex = ret;
	}
	if (ifindex >= 0)
		n->ifindex = ifindex;
#endif
	return 0;
}