]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
libertas: fix a potential NULL pointer dereference
authorAllen Pais <allen.pais@oracle.com>
Wed, 18 Sep 2019 16:35:00 +0000 (22:05 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 1 Oct 2019 09:21:37 +0000 (12:21 +0300)
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>
drivers/net/wireless/marvell/libertas/if_sdio.c

index 242d8845da3fa0347c007a4c0b3ff357eb42e8ec..30f1025ecb9bcbaec0e73ae4b49360d588010b72 100644 (file)
@@ -1179,6 +1179,10 @@ static int if_sdio_probe(struct sdio_func *func,
 
        spin_lock_init(&card->lock);
        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_waitqueue_head(&card->pwron_waitq);
 
@@ -1230,6 +1234,7 @@ err_activate_card:
        lbs_remove_card(priv);
 free:
        destroy_workqueue(card->workqueue);
+err_queue:
        while (card->packets) {
                packet = card->packets;
                card->packets = card->packets->next;