net: mwifiex: fix a NULL pointer dereference
Subsystems (3)
PATCH v2 1/1 net: mwifiex: fix a NULL pointer dereference
In case dev_alloc_skb fails, the fix returns -ENOMEM to avoid NULL pointer dereference.
--- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/marvell/mwifiex/cmdevt.c +6 -0
@@ -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);
Signature · 1 line
2.17.1
Quoted 4 lines · Kangjie Lu
In case
dev_alloc_skbfails, the fix returns-ENOMEMto avoid NULL pointer dereference.Signed-off-by Kangjie Lu <[email protected]>
No changelog, please always add a changelog:
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#changelog_missing
Signature · 1 line
Kalle Valo
PATCH v2 1/1 net: mwifiex: fix a NULL pointer dereference
In case dev_alloc_skb fails, the fix returns -ENOMEM to avoid NULL pointer dereference.
---
V2: minor change: simply remove whitespace
--- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/marvell/mwifiex/cmdevt.c +6 -0
@@ -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);
Signature · 1 line
2.17.1
Quoted 4 lines · Kangjie Lu
In case
dev_alloc_skbfails, the fix returns-ENOMEMto avoid NULL pointer dereference.Signed-off-by Kangjie Lu <[email protected]>
There is a similar patch submitted:
https://patchwork.kernel.org/patch/10851669/
Patch set to Superseded.
Signature · 3 lines
https://patchwork.kernel.org/patch/10866749/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Quoted 4 lines · Kangjie Lu
In case
dev_alloc_skbfails, the fix returns-ENOMEMto avoid NULL pointer dereference.Signed-off-by Kangjie Lu <[email protected]>
Patch applied to wireless-drivers-next.git, thanks.
e5b9b206f3f6 net: mwifiex: fix a NULL pointer dereference
Signature · 3 lines
https://patchwork.kernel.org/patch/10848599/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches