Skip to content

Commit

Permalink
ath11k: add missing null check on allocated skb
Browse files Browse the repository at this point in the history
Currently the null check on a newly allocated skb is missing and
this can lead to a null pointer dereference is the allocation fails.
Fix this by adding a null check and returning -ENOMEM.

Addresses-Coverity: ("Dereference null return")
Fixes: 43ed15e ("ath11k: put hw to DBS using WMI_PDEV_SET_HW_MODE_CMDID")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201214232417.84556-1-colin.king@canonical.com
  • Loading branch information
Colin Ian King authored and Kalle Valo committed Dec 17, 2020
1 parent 13458ff commit 292bff9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/wireless/ath/ath11k/wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -3460,6 +3460,9 @@ int ath11k_wmi_set_hw_mode(struct ath11k_base *ab,
len = sizeof(*cmd);

skb = ath11k_wmi_alloc_skb(wmi_ab, len);
if (!skb)
return -ENOMEM;

cmd = (struct wmi_pdev_set_hw_mode_cmd_param *)skb->data;

cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_PDEV_SET_HW_MODE_CMD) |
Expand Down

0 comments on commit 292bff9

Please sign in to comment.