[bug report] wifi: ath12k: counter leaks

Dan Carpenter error27 at gmail.com
Thu Feb 16 06:00:02 PST 2023


Hello Kalle Valo,

The patch d889913205cf: "wifi: ath12k: driver for Qualcomm Wi-Fi 7
devices" from Nov 28, 2022, leads to the following Smatch static
checker warning:

drivers/net/wireless/ath/ath12k/mac.c:1031 ath12k_mac_monitor_start() warn: plus plus leak 'ar->num_started_vdevs'
drivers/net/wireless/ath/ath12k/mac.c:3173 ath12k_station_assoc() warn: plus plus leak 'arvif->num_legacy_stations'
drivers/net/wireless/ath/ath12k/mac.c:5087 ath12k_mac_op_add_interface() warn: plus plus leak 'ar->num_created_vdevs'

drivers/net/wireless/ath/ath12k/mac.c
    1003 static int ath12k_mac_monitor_start(struct ath12k *ar)
    1004 {
    1005         struct cfg80211_chan_def *chandef = NULL;
    1006         int ret;
    1007 
    1008         lockdep_assert_held(&ar->conf_mutex);
    1009 
    1010         if (ar->monitor_started)
    1011                 return 0;
    1012 
    1013         ieee80211_iter_chan_contexts_atomic(ar->hw,
    1014                                             ath12k_mac_get_any_chandef_iter,
    1015                                             &chandef);
    1016         if (!chandef)
    1017                 return 0;
    1018 
    1019         ret = ath12k_mac_monitor_vdev_start(ar, ar->monitor_vdev_id, chandef);
    1020         if (ret) {
    1021                 ath12k_warn(ar->ab, "failed to start monitor vdev: %d\n", ret);
    1022                 ath12k_mac_monitor_vdev_delete(ar);
    1023                 return ret;
    1024         }
    1025 
    1026         ar->monitor_started = true;
    1027         ar->num_started_vdevs++;
    1028         ret = ath12k_dp_tx_htt_monitor_mode_ring_config(ar, false);

If ath12k_dp_tx_htt_monitor_mode_ring_config() fails then this should
decrement ar->num_started_vdevs and set ->started = false

    1029         ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac monitor started ret %d\n", ret);
    1030 
--> 1031         return ret;
    1032 }

regards,
dan carpenter



More information about the ath12k mailing list