mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-06 12:44:14 +08:00
ath10k: fix possible memory leak in new FW loading
Some failpaths did `return` instead of a `goto` leaking requested firmware. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
This commit is contained in:
parent
fd9c4864a7
commit
9bab1cc010
@ -404,12 +404,14 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name)
|
|||||||
if (len < magic_len) {
|
if (len < magic_len) {
|
||||||
ath10k_err("firmware image too small to contain magic: %zu\n",
|
ath10k_err("firmware image too small to contain magic: %zu\n",
|
||||||
len);
|
len);
|
||||||
return -EINVAL;
|
ret = -EINVAL;
|
||||||
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memcmp(data, ATH10K_FIRMWARE_MAGIC, magic_len) != 0) {
|
if (memcmp(data, ATH10K_FIRMWARE_MAGIC, magic_len) != 0) {
|
||||||
ath10k_err("Invalid firmware magic\n");
|
ath10k_err("Invalid firmware magic\n");
|
||||||
return -EINVAL;
|
ret = -EINVAL;
|
||||||
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* jump over the padding */
|
/* jump over the padding */
|
||||||
@ -431,7 +433,8 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name)
|
|||||||
if (len < ie_len) {
|
if (len < ie_len) {
|
||||||
ath10k_err("Invalid length for FW IE %d (%zu < %zu)\n",
|
ath10k_err("Invalid length for FW IE %d (%zu < %zu)\n",
|
||||||
ie_id, len, ie_len);
|
ie_id, len, ie_len);
|
||||||
return -EINVAL;
|
ret = -EINVAL;
|
||||||
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (ie_id) {
|
switch (ie_id) {
|
||||||
|
Loading…
Reference in New Issue
Block a user