summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/marvell
diff options
context:
space:
mode:
authorKangjie Lu <kjlu@umn.edu>2019-03-12 06:31:07 +0100
committerKalle Valo <kvalo@codeaurora.org>2019-04-04 12:17:55 +0200
commite5b9b206f3f6376b9a1406b67eafe4e7bb9f123c (patch)
tree57bb0359ae8b27213cae54986e03078125aa37d8 /drivers/net/wireless/marvell
parentiwlegacy: remove redundant assignment to *res (diff)
downloadlinux-e5b9b206f3f6376b9a1406b67eafe4e7bb9f123c.tar.xz
linux-e5b9b206f3f6376b9a1406b67eafe4e7bb9f123c.zip
net: mwifiex: fix a NULL pointer dereference
In case dev_alloc_skb fails, the fix returns -ENOMEM to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu <kjlu@umn.edu> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/marvell')
-rw-r--r--drivers/net/wireless/marvell/mwifiex/cmdevt.c6
1 files changed, 6 insertions, 0 deletions
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);