mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-19 21:00:29 +07:00
libertas: fix a potential NULL pointer dereference
alloc_workqueue is not checked for errors and as a result, a potential NULL dereference could occur. Signed-off-by: Allen Pais <allen.pais@oracle.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
a0d46f7a0f
commit
7da413a185
@ -1179,6 +1179,10 @@ static int if_sdio_probe(struct sdio_func *func,
|
|||||||
|
|
||||||
spin_lock_init(&card->lock);
|
spin_lock_init(&card->lock);
|
||||||
card->workqueue = alloc_workqueue("libertas_sdio", WQ_MEM_RECLAIM, 0);
|
card->workqueue = alloc_workqueue("libertas_sdio", WQ_MEM_RECLAIM, 0);
|
||||||
|
if (unlikely(!card->workqueue)) {
|
||||||
|
ret = -ENOMEM;
|
||||||
|
goto err_queue;
|
||||||
|
}
|
||||||
INIT_WORK(&card->packet_worker, if_sdio_host_to_card_worker);
|
INIT_WORK(&card->packet_worker, if_sdio_host_to_card_worker);
|
||||||
init_waitqueue_head(&card->pwron_waitq);
|
init_waitqueue_head(&card->pwron_waitq);
|
||||||
|
|
||||||
@ -1230,6 +1234,7 @@ static int if_sdio_probe(struct sdio_func *func,
|
|||||||
lbs_remove_card(priv);
|
lbs_remove_card(priv);
|
||||||
free:
|
free:
|
||||||
destroy_workqueue(card->workqueue);
|
destroy_workqueue(card->workqueue);
|
||||||
|
err_queue:
|
||||||
while (card->packets) {
|
while (card->packets) {
|
||||||
packet = card->packets;
|
packet = card->packets;
|
||||||
card->packets = card->packets->next;
|
card->packets = card->packets->next;
|
||||||
|
Loading…
Reference in New Issue
Block a user