Skip to content

Commit ef751ca

Browse files
chunkeeygregkh
authored andcommitted
ath10k: fix potential memory leak in ath10k_wmi_tlv_op_pull_fw_stats()
[ Upstream commit 097e46d2ae90265d1afe141ba6208ba598b79e01 ] 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: Christian Lamparter <chunkeey@googlemail.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b247693 commit ef751ca

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

drivers/net/wireless/ath/ath10k/wmi-tlv.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,8 +1105,10 @@ static int ath10k_wmi_tlv_op_pull_fw_stats(struct ath10k *ar,
11051105
struct ath10k_fw_stats_pdev *dst;
11061106

11071107
src = data;
1108-
if (data_len < sizeof(*src))
1108+
if (data_len < sizeof(*src)) {
1109+
kfree(tb);
11091110
return -EPROTO;
1111+
}
11101112

11111113
data += sizeof(*src);
11121114
data_len -= sizeof(*src);
@@ -1126,8 +1128,10 @@ static int ath10k_wmi_tlv_op_pull_fw_stats(struct ath10k *ar,
11261128
struct ath10k_fw_stats_vdev *dst;
11271129

11281130
src = data;
1129-
if (data_len < sizeof(*src))
1131+
if (data_len < sizeof(*src)) {
1132+
kfree(tb);
11301133
return -EPROTO;
1134+
}
11311135

11321136
data += sizeof(*src);
11331137
data_len -= sizeof(*src);
@@ -1145,8 +1149,10 @@ static int ath10k_wmi_tlv_op_pull_fw_stats(struct ath10k *ar,
11451149
struct ath10k_fw_stats_peer *dst;
11461150

11471151
src = data;
1148-
if (data_len < sizeof(*src))
1152+
if (data_len < sizeof(*src)) {
1153+
kfree(tb);
11491154
return -EPROTO;
1155+
}
11501156

11511157
data += sizeof(*src);
11521158
data_len -= sizeof(*src);

0 commit comments

Comments
 (0)