Subject: Re: [net-next PATCH 3/3] net: sched: cls_cgroup fix possible memory leak of 'new'

From: John Fastabend <[email-masked]>
Date: Mon, 15 Sep 2014 20:29:05 -0700

On 09/15/2014 08:04 PM, Cong Wang wrote:
> On Mon, Sep 15, 2014 at 7:48 PM, John Fastabend
> <[email-masked]> wrote:
>> diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
>> index 3b75487..52b7900 100644
>> --- a/net/sched/cls_cgroup.c
>> +++ b/net/sched/cls_cgroup.c
>> @@ -127,16 +127,16 @@ static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb,
>>         err = nla_parse_nested(tb, TCA_CGROUP_MAX, tca[TCA_OPTIONS],
>>                                cgroup_policy);
>>         if (err < 0)
>> -               return err;
>> +               goto errout;
>>
>>         tcf_exts_init(&e, TCA_CGROUP_ACT, TCA_CGROUP_POLICE);
>>         err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &e, ovr);
>>         if (err < 0)
>> -               return err;
>> +               goto errout;
>>
>>         err = tcf_em_tree_validate(tp, tb[TCA_CGROUP_EMATCHES], &t);
>>         if (err < 0)
>> -               return err;
>> +               goto errout;
>>
> 
> I think you need to call tcf_exts_destroy() too after tcf_exts_validate(),
> while you are on it. :)

Yep, and did a quick audit looks like its handled correctly in the other
classifiers.

Also there is a needed fix for cls_fw I'll include with the update for this patch.

.John

> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to [email-masked]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>