stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH stable v4.4] libertas: fix a potential NULL pointer dereference
@ 2021-03-12 16:51 Krzysztof Kozlowski
  2021-03-13 13:36 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Kozlowski @ 2021-03-12 16:51 UTC (permalink / raw)
  To: stable; +Cc: Allen Pais, Kalle Valo, Krzysztof Kozlowski

From: Allen Pais <allen.pais@oracle.com>

commit 7da413a18583baaf35dd4a8eb414fa410367d7f2 upstream.

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>
[krzk: backport applied to different path - without marvell subdir]
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/net/wireless/libertas/if_sdio.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index 33ceda296c9c..45d68ee682f6 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH stable v4.4] libertas: fix a potential NULL pointer dereference
  2021-03-12 16:51 [PATCH stable v4.4] libertas: fix a potential NULL pointer dereference Krzysztof Kozlowski
@ 2021-03-13 13:36 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2021-03-13 13:36 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: stable, Allen Pais, Kalle Valo

On Fri, Mar 12, 2021 at 05:51:17PM +0100, Krzysztof Kozlowski wrote:
> From: Allen Pais <allen.pais@oracle.com>
> 
> commit 7da413a18583baaf35dd4a8eb414fa410367d7f2 upstream.
> 
> 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>
> [krzk: backport applied to different path - without marvell subdir]
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
>  drivers/net/wireless/libertas/if_sdio.c | 5 +++++
>  1 file changed, 5 insertions(+)

Now queued up.

greg k-

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-13 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-12 16:51 [PATCH stable v4.4] libertas: fix a potential NULL pointer dereference Krzysztof Kozlowski
2021-03-13 13:36 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).