[bug report] wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices

Dan Carpenter error27 at gmail.com
Thu Feb 16 04:28:49 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:5872 ath12k_mac_op_unassign_vif_chanctx()
	error: double unlocked '&ar->conf_mutex' (orig line 5854)

drivers/net/wireless/ath/ath12k/mac.c
    5822 static void
    5823 ath12k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw,
    5824                                    struct ieee80211_vif *vif,
    5825                                    struct ieee80211_bss_conf *link_conf,
    5826                                    struct ieee80211_chanctx_conf *ctx)
    5827 {
    5828         struct ath12k *ar = hw->priv;
    5829         struct ath12k_base *ab = ar->ab;
    5830         struct ath12k_vif *arvif = (void *)vif->drv_priv;
    5831         int ret;
    5832 
    5833         mutex_lock(&ar->conf_mutex);
    5834 
    5835         ath12k_dbg(ab, ATH12K_DBG_MAC,
    5836                    "mac chanctx unassign ptr %pK vdev_id %i\n",
    5837                    ctx, arvif->vdev_id);
    5838 
    5839         WARN_ON(!arvif->is_started);
    5840 
    5841         if (ab->hw_params->vdev_start_delay &&
    5842             arvif->vdev_type == WMI_VDEV_TYPE_MONITOR &&
    5843             ath12k_peer_find_by_addr(ab, ar->mac_addr))
    5844                 ath12k_peer_delete(ar, arvif->vdev_id, ar->mac_addr);
    5845 
    5846         if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) {
    5847                 ret = ath12k_mac_monitor_stop(ar);
    5848                 if (ret) {
    5849                         mutex_unlock(&ar->conf_mutex);
    5850                         return;
    5851                 }
    5852 
    5853                 arvif->is_started = false;
    5854                 mutex_unlock(&ar->conf_mutex);

Should this return after unlocking?

    5855         }
    5856 
    5857         ret = ath12k_mac_vdev_stop(arvif);
    5858         if (ret)
    5859                 ath12k_warn(ab, "failed to stop vdev %i: %d\n",
    5860                             arvif->vdev_id, ret);
    5861 
    5862         arvif->is_started = false;
    5863 
    5864         if (ab->hw_params->vdev_start_delay &&
    5865             arvif->vdev_type == WMI_VDEV_TYPE_MONITOR)
    5866                 ath12k_wmi_vdev_down(ar, arvif->vdev_id);
    5867 
    5868         if (arvif->vdev_type != WMI_VDEV_TYPE_MONITOR &&
    5869             ar->num_started_vdevs == 1 && ar->monitor_vdev_created)
    5870                 ath12k_mac_monitor_stop(ar);
    5871 
--> 5872         mutex_unlock(&ar->conf_mutex);
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    5873 }

regards,
dan carpenter



More information about the ath12k mailing list