diff mbox series

wifi: mt76: mt7921: fix memory leak in mt7921_check_offload_capability

Message ID 39ebf05085dd3069412c001ca9a31aa259de5a74.1672742135.git.lorenzo@kernel.org
State New
Headers show
Series wifi: mt76: mt7921: fix memory leak in mt7921_check_offload_capability | expand

Commit Message

Lorenzo Bianconi Jan. 3, 2023, 10:36 a.m. UTC
Fix possible memory leak in mt7921_check_offload_capability routine
relasing fw data.

Fixes: 034ae28b56f1 ("wifi: mt76: mt7921: introduce remain_on_channel support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt7921/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Lorenzo Bianconi Jan. 16, 2023, 12:33 p.m. UTC | #1
> Fix possible memory leak in mt7921_check_offload_capability routine
> relasing fw data.
> 
> Fixes: 034ae28b56f1 ("wifi: mt76: mt7921: introduce remain_on_channel support")
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7921/init.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Felix,

This issue has already a fix in your tree, we can drop the patch as well.

Regards,
Lorenzo

> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> index 542dfd425129..5ec0caa23c23 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> @@ -175,7 +175,7 @@ u8 mt7921_check_offload_capability(struct device *dev, const char *fw_wm)
>  
>  	if (!fw || !fw->data || fw->size < sizeof(*hdr)) {
>  		dev_err(dev, "Invalid firmware\n");
> -		return -EINVAL;
> +		goto out;
>  	}
>  
>  	data = fw->data;
> @@ -205,7 +205,7 @@ u8 mt7921_check_offload_capability(struct device *dev, const char *fw_wm)
>  
>  		data += le16_to_cpu(rel_info->len) + rel_info->pad_len;
>  	}
> -
> +out:
>  	release_firmware(fw);
>  
>  	return features ? features->data : 0;
> -- 
> 2.39.0
>
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
index 542dfd425129..5ec0caa23c23 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
@@ -175,7 +175,7 @@  u8 mt7921_check_offload_capability(struct device *dev, const char *fw_wm)
 
 	if (!fw || !fw->data || fw->size < sizeof(*hdr)) {
 		dev_err(dev, "Invalid firmware\n");
-		return -EINVAL;
+		goto out;
 	}
 
 	data = fw->data;
@@ -205,7 +205,7 @@  u8 mt7921_check_offload_capability(struct device *dev, const char *fw_wm)
 
 		data += le16_to_cpu(rel_info->len) + rel_info->pad_len;
 	}
-
+out:
 	release_firmware(fw);
 
 	return features ? features->data : 0;