Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b431b60 authored by Allen Pais's avatar Allen Pais Committed by Greg Kroah-Hartman
Browse files

libertas: fix a potential NULL pointer dereference



commit 7da413a18583baaf35dd4a8eb414fa410367d7f2 upstream.

alloc_workqueue is not checked for errors and as a result,
a potential NULL dereference could occur.

Signed-off-by: default avatarAllen Pais <allen.pais@oracle.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
[krzk: backport applied to different path - without marvell subdir]
Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1ebf0857
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1229,6 +1229,10 @@ static int if_sdio_probe(struct sdio_func *func,

	spin_lock_init(&card->lock);
	card->workqueue = create_workqueue("libertas_sdio");
	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);

@@ -1282,6 +1286,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;