[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190829.170748.656667843147010952.davem@davemloft.net>
Date: Thu, 29 Aug 2019 17:07:48 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: olteanv@...il.com
Cc: jhs@...atatu.com, xiyou.wangcong@...il.com, jiri@...nulli.us,
vinicius.gomes@...el.com, vedang.patel@...el.com,
leandro.maciel.dorileo@...el.com, netdev@...r.kernel.org
Subject: Re: [PATCH net 1/3] taprio: Fix kernel panic in taprio_destroy
From: Vladimir Oltean <olteanv@...il.com>
Date: Wed, 28 Aug 2019 17:48:27 +0300
> taprio_init may fail earlier than this line:
>
> list_add(&q->taprio_list, &taprio_list);
>
> i.e. due to the net device not being multi queue.
>
> Attempting to remove q from the global taprio_list when it is not part
> of it will result in a kernel panic.
>
> Fix it by iterating through the list and removing it only if found.
>
> Signed-off-by: Vladimir Oltean <olteanv@...il.com>
I don't like this solution for two reaons, I think it's actually
error prone, and now every taprio_destroy() eats the cost of traversing
the entire list.
The whole reason to use a list head is O(1) removal.
Just init the list head early in the creation then the list_del() just
works.
Powered by blists - more mailing lists