[PATCH] wifi: ath11k: fix memory leaks in beacon template setup

Zilin Guan zilin at seu.edu.cn
Mon Jan 19 21:55:38 PST 2026


On Tue, Jan 20, 2026 at 10:52:54AM +0800, Baochen Qiang wrote:
> below would be better?
> 
> @@ -1622,19 +1622,21 @@ static int ath11k_mac_setup_bcn_tmpl_mbssid(struct ath11k_vif *arvif,
>         }
> 
>         if (tx_arvif == arvif) {
> -               if (ath11k_mac_set_vif_params(tx_arvif, bcn))
> -                       return -EINVAL;
> +               if (ath11k_mac_set_vif_params(tx_arvif, bcn)) {
> +                       ret = -EINVAL;
> +                       goto free;
> +               }
>         } else if (!ath11k_mac_set_nontx_vif_params(tx_arvif, arvif, bcn)) {
> -               return -EINVAL;
> +               ret = -EINVAL;
> +               goto free;
>         }
> 
>         ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn, 0);
> -       kfree_skb(bcn);
> -
>         if (ret)
>                 ath11k_warn(ab, "failed to submit beacon template command: %d\n",
>                             ret);
> -
> +free:
> +       kfree_skb(bcn);
>         return ret;
>  }
> 
> >  static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif)

Thanks for your suggestion. I will send a v2 to change it.

Regards,
Zilin Guan



More information about the ath11k mailing list