Commit ef751ca5 authored by Christian Lamparter's avatar Christian Lamparter Committed by Greg Kroah-Hartman

ath10k: fix potential memory leak in ath10k_wmi_tlv_op_pull_fw_stats()


[ Upstream commit 097e46d2 ]

ath10k_wmi_tlv_op_pull_fw_stats() uses tb = ath10k_wmi_tlv_parse_alloc(...)
function, which allocates memory. If any of the three error-paths are
taken, this tb needs to be freed.
Signed-off-by: default avatarChristian Lamparter <chunkeey@googlemail.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b2476930
...@@ -1105,8 +1105,10 @@ static int ath10k_wmi_tlv_op_pull_fw_stats(struct ath10k *ar, ...@@ -1105,8 +1105,10 @@ static int ath10k_wmi_tlv_op_pull_fw_stats(struct ath10k *ar,
struct ath10k_fw_stats_pdev *dst; struct ath10k_fw_stats_pdev *dst;
src = data; src = data;
if (data_len < sizeof(*src)) if (data_len < sizeof(*src)) {
kfree(tb);
return -EPROTO; return -EPROTO;
}
data += sizeof(*src); data += sizeof(*src);
data_len -= sizeof(*src); data_len -= sizeof(*src);
...@@ -1126,8 +1128,10 @@ static int ath10k_wmi_tlv_op_pull_fw_stats(struct ath10k *ar, ...@@ -1126,8 +1128,10 @@ static int ath10k_wmi_tlv_op_pull_fw_stats(struct ath10k *ar,
struct ath10k_fw_stats_vdev *dst; struct ath10k_fw_stats_vdev *dst;
src = data; src = data;
if (data_len < sizeof(*src)) if (data_len < sizeof(*src)) {
kfree(tb);
return -EPROTO; return -EPROTO;
}
data += sizeof(*src); data += sizeof(*src);
data_len -= sizeof(*src); data_len -= sizeof(*src);
...@@ -1145,8 +1149,10 @@ static int ath10k_wmi_tlv_op_pull_fw_stats(struct ath10k *ar, ...@@ -1145,8 +1149,10 @@ static int ath10k_wmi_tlv_op_pull_fw_stats(struct ath10k *ar,
struct ath10k_fw_stats_peer *dst; struct ath10k_fw_stats_peer *dst;
src = data; src = data;
if (data_len < sizeof(*src)) if (data_len < sizeof(*src)) {
kfree(tb);
return -EPROTO; return -EPROTO;
}
data += sizeof(*src); data += sizeof(*src);
data_len -= sizeof(*src); data_len -= sizeof(*src);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment