[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20180712.123247.66068646310525490.davem@davemloft.net>
Date: Thu, 12 Jul 2018 12:32:47 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: jacob.e.keller@...el.com
Cc: netdev@...r.kernel.org, xiyou.wangcong@...il.com,
edumazet@...gle.com
Subject: Re: [net v2] sch_fq_codel: zero q->flows_cnt when fq_codel_init
fails
From: Jacob Keller <jacob.e.keller@...el.com>
Date: Tue, 10 Jul 2018 14:22:27 -0700
> When fq_codel_init fails, qdisc_create_dflt will cleanup by using
> qdisc_destroy. This function calls the ->reset() op prior to calling the
> ->destroy() op.
>
> Unfortunately, during the failure flow for sch_fq_codel, the ->flows
> parameter is not initialized, so the fq_codel_reset function will null
> pointer dereference.
...
> This is caused because flows_cnt is non-zero, but flows hasn't been
> initialized. fq_codel_init has left the private data in a partially
> initialized state.
>
> To fix this, reset flows_cnt to 0 when we fail to initialize.
> Additionally, to make the state more consistent, also cleanup the flows
> pointer when the allocation of backlogs fails.
>
> This fixes the NULL pointer dereference, since both the for-loop and
> memset in fq_codel_reset will be no-ops when flow_cnt is zero.
>
> Signed-off-by: Jacob Keller <jacob.e.keller@...el.com>
Applied and queued up for -stable, thanks!
Powered by blists - more mailing lists