netdev
[Top] [All Lists]

gred_dump (2.4.17): bad semantic and memory leak

To: hadi@xxxxxxxxxxxxxxxxxx
Subject: gred_dump (2.4.17): bad semantic and memory leak
From: Martin Devera <devik@xxxxxx>
Date: Fri, 18 Jan 2002 23:19:22 +0100 (CET)
Cc: netdev@xxxxxxxxxxx
In-reply-to: <002001c1a035$cd507ec0$5d28a4cd@xxxxxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
Hello,

I found several bugs in gred_dump (net/sched/sch_gred.c) code. 
First there is code sample:

       opt=kmalloc(sizeof(struct tc_gred_qopt)*MAX_DPs, GFP_KERNEL);
... irelevant code ...
       if (!table->initd) {
                DPRINTK("NO GRED Queues setup!\n");
                return -1;
        }

It means that when table->initd is NULL then dump is aborted and
also ALL others dumps are aborted. For user is seems as all qdiscs
disappeared. Bad luck.

The second problem is IMHO opt leak. It is NEVER deallocated. It
is later used in:
 RTA_PUT(skb, TCA_GRED_PARMS, sizeof(struct tc_gred_qopt)*MAX_DPs, opt);

and it is end of opt's usage. Seems as serious memory leak to me.
I didn't created a fix because I'm in hurry just now.

regards,
devik


<Prev in Thread] Current Thread [Next in Thread>