linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] net: mwifiex: fix a NULL pointer dereference
@ 2019-03-12  5:31 Kangjie Lu
  2019-03-12  5:41 ` Kalle Valo
  2019-04-04 10:18 ` Kalle Valo
  0 siblings, 2 replies; 5+ messages in thread
From: Kangjie Lu @ 2019-03-12  5:31 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Amitkumar Karwar, Nishant Sarmukadam, Ganapathi Bhat,
	Xinming Hu, Kalle Valo, David S. Miller, linux-wireless, netdev,
	linux-kernel

In case dev_alloc_skb fails, the fix returns -ENOMEM to avoid
NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/net/wireless/marvell/mwifiex/cmdevt.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
index 60db2b969e20..8c35441fd9b7 100644
--- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
@@ -341,6 +341,12 @@ 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) {
+			mwifiex_dbg(adapter, ERROR,
+				    "SLEEP_CFM: dev_alloc_skb failed\n");
+			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] 5+ messages in thread

* Re: [PATCH v2] net: mwifiex: fix a NULL pointer dereference
  2019-03-12  5:31 [PATCH v2] net: mwifiex: fix a NULL pointer dereference Kangjie Lu
@ 2019-03-12  5:41 ` Kalle Valo
  2019-03-23  3:57   ` Kangjie Lu
  2019-04-04 10:18 ` Kalle Valo
  1 sibling, 1 reply; 5+ messages in thread
From: Kalle Valo @ 2019-03-12  5:41 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: pakki001, Amitkumar Karwar, Nishant Sarmukadam, Ganapathi Bhat,
	Xinming Hu, David S. Miller, linux-wireless, netdev,
	linux-kernel

Kangjie Lu <kjlu@umn.edu> writes:

> In case dev_alloc_skb fails, the fix returns -ENOMEM to avoid
> NULL pointer dereference.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>

No changelog, please always add a changelog:

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

-- 
Kalle Valo

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

* [PATCH v2] net: mwifiex: fix a NULL pointer dereference
  2019-03-12  5:41 ` Kalle Valo
@ 2019-03-23  3:57   ` Kangjie Lu
  2019-04-04  9:28     ` Kalle Valo
  0 siblings, 1 reply; 5+ messages in thread
From: Kangjie Lu @ 2019-03-23  3:57 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Amitkumar Karwar, Nishant Sarmukadam, Ganapathi Bhat,
	Xinming Hu, Kalle Valo, David S. Miller, linux-wireless, netdev,
	linux-kernel

In case dev_alloc_skb fails, the fix returns -ENOMEM to avoid
NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
V2: minor change: simply remove whitespace
---
 drivers/net/wireless/marvell/mwifiex/cmdevt.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
index 60db2b969e20..8c35441fd9b7 100644
--- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
@@ -341,6 +341,12 @@ 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) {
+			mwifiex_dbg(adapter, ERROR,
+				    "SLEEP_CFM: dev_alloc_skb failed\n");
+			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] 5+ messages in thread

* Re: [PATCH v2] net: mwifiex: fix a NULL pointer dereference
  2019-03-23  3:57   ` Kangjie Lu
@ 2019-04-04  9:28     ` Kalle Valo
  0 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2019-04-04  9:28 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: kjlu, pakki001, Amitkumar Karwar, Nishant Sarmukadam,
	Ganapathi Bhat, Xinming Hu, David S. Miller, linux-wireless,
	netdev, linux-kernel

Kangjie Lu <kjlu@umn.edu> wrote:

> In case dev_alloc_skb fails, the fix returns -ENOMEM to avoid
> NULL pointer dereference.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>

There is a similar patch submitted:

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

Patch set to Superseded.

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

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


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

* Re: [PATCH v2] net: mwifiex: fix a NULL pointer dereference
  2019-03-12  5:31 [PATCH v2] net: mwifiex: fix a NULL pointer dereference Kangjie Lu
  2019-03-12  5:41 ` Kalle Valo
@ 2019-04-04 10:18 ` Kalle Valo
  1 sibling, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2019-04-04 10:18 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: kjlu, pakki001, Amitkumar Karwar, Nishant Sarmukadam,
	Ganapathi Bhat, Xinming Hu, David S. Miller, linux-wireless,
	netdev, linux-kernel

Kangjie Lu <kjlu@umn.edu> wrote:

> In case dev_alloc_skb fails, the fix returns -ENOMEM to avoid
> NULL pointer dereference.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>

Patch applied to wireless-drivers-next.git, thanks.

e5b9b206f3f6 net: mwifiex: fix a NULL pointer dereference

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

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


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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-12  5:31 [PATCH v2] net: mwifiex: fix a NULL pointer dereference Kangjie Lu
2019-03-12  5:41 ` Kalle Valo
2019-03-23  3:57   ` Kangjie Lu
2019-04-04  9:28     ` Kalle Valo
2019-04-04 10:18 ` 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).