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

Commit e5b9b206 authored by Kangjie Lu's avatar Kangjie Lu Committed by Kalle Valo
Browse files

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: default avatarKangjie Lu <kjlu@umn.edu>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 6603c584
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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);