linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mwifiex: Fix potential NULL pointer dereference
@ 2019-03-13 18:42 Aditya Pakki
  2019-04-04 10:20 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2019-03-13 18:42 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, Amitkumar Karwar, Nishant Sarmukadam, Ganapathi Bhat,
	Xinming Hu, Kalle Valo, David S. Miller, linux-wireless, netdev,
	linux-kernel

dev_alloc_skb can fail and return a NULL pointer. The patch avoids
a potential NULL pointer dereference and returns -ENOMEM.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 drivers/net/wireless/marvell/mwifiex/cmdevt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
index 60db2b969e20..4e2fa972a78a 100644
--- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
@@ -341,6 +341,9 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
 		sleep_cfm_tmp =
 			dev_alloc_skb(sizeof(struct mwifiex_opt_sleep_confirm)
 				      + MWIFIEX_TYPE_LEN);
+		if (!sleep_cfm_tmp)
+			return -ENOMEM;
+
 		skb_put(sleep_cfm_tmp, sizeof(struct mwifiex_opt_sleep_confirm)
 			+ MWIFIEX_TYPE_LEN);
 		put_unaligned_le32(MWIFIEX_USB_TYPE_CMD, sleep_cfm_tmp->data);
-- 
2.17.1


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

* Re: [PATCH] mwifiex: Fix potential NULL pointer dereference
  2019-03-13 18:42 [PATCH] mwifiex: Fix potential NULL pointer dereference Aditya Pakki
@ 2019-04-04 10:20 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2019-04-04 10:20 UTC (permalink / raw)
  To: Aditya Pakki
  Cc: pakki001, kjlu, Amitkumar Karwar, Nishant Sarmukadam,
	Ganapathi Bhat, Xinming Hu, David S. Miller, linux-wireless,
	netdev, linux-kernel

Aditya Pakki <pakki001@umn.edu> wrote:

> dev_alloc_skb can fail and return a NULL pointer. The patch avoids
> a potential NULL pointer dereference and returns -ENOMEM.
> 
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>

A similar patch was already submitted:

https://patchwork.kernel.org/patch/10848599/

Patch set to Superseded.

-- 
https://patchwork.kernel.org/patch/10851669/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, other threads:[~2019-04-04 10:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-13 18:42 [PATCH] mwifiex: Fix potential NULL pointer dereference Aditya Pakki
2019-04-04 10:20 ` Kalle Valo

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).