From: Jacob Keller <jacob.e.kel...@intel.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.kel...@intel.com> Applied and queued up for -stable, thanks!