Home
last modified time | relevance | path

Searched hist:ba86af3733aece88dbcee0dfebf7e2dcfefb2be4 (Results 1 – 1 of 1) sorted by relevance

/openbmc/linux/drivers/net/ethernet/microchip/lan966x/
H A Dlan966x_ethtool.cdiff ba86af3733aece88dbcee0dfebf7e2dcfefb2be4 Mon Nov 14 07:38:52 CST 2022 Shang XiaoJing <shangxiaojing@huawei.com> net: lan966x: Fix potential null-ptr-deref in lan966x_stats_init()

lan966x_stats_init() calls create_singlethread_workqueue() and not
checked the ret value, which may return NULL. And a null-ptr-deref may
happen:

lan966x_stats_init()
create_singlethread_workqueue() # failed, lan966x->stats_queue is NULL
queue_delayed_work()
queue_delayed_work_on()
__queue_delayed_work() # warning here, but continue
__queue_work() # access wq->flags, null-ptr-deref

Check the ret value and return -ENOMEM if it is NULL.

Fixes: 12c2d0a5b8e2 ("net: lan966x: add ethtool configuration and statistics")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>