[bug report] wifi: mac80211: add gfp_t parameter to ieeee80211_obss_color_collision_notify

Dan Carpenter dan.carpenter at linaro.org
Thu Feb 8 02:16:09 PST 2024


Hello Lorenzo Bianconi,

The patch 03895c8414d7: "wifi: mac80211: add gfp_t parameter to
ieeee80211_obss_color_collision_notify" from Jun 17, 2022
(linux-next), leads to the following Smatch static checker warning:

	drivers/net/wireless/ath/ath11k/wmi.c:4023 ath11k_wmi_obss_color_collision_event()
	warn: sleeping in atomic context

drivers/net/wireless/ath/ath11k/wmi.c
    3989 static void
    3990 ath11k_wmi_obss_color_collision_event(struct ath11k_base *ab, struct sk_buff *skb)
    3991 {
    3992         const void **tb;
    3993         const struct wmi_obss_color_collision_event *ev;
    3994         struct ath11k_vif *arvif;
    3995         int ret;
    3996 
    3997         tb = ath11k_wmi_tlv_parse_alloc(ab, skb, GFP_ATOMIC);
    3998         if (IS_ERR(tb)) {
    3999                 ret = PTR_ERR(tb);
    4000                 ath11k_warn(ab, "failed to parse tlv: %d\n", ret);
    4001                 return;
    4002         }
    4003 
    4004         ath11k_dbg(ab, ATH11K_DBG_WMI, "event obss color collision");
    4005 
    4006         rcu_read_lock();
                 ^^^^^^^^^^^^^^^
Preempt disabled.

    4007 
    4008         ev = tb[WMI_TAG_OBSS_COLOR_COLLISION_EVT];
    4009         if (!ev) {
    4010                 ath11k_warn(ab, "failed to fetch obss color collision ev");
    4011                 goto exit;
    4012         }
    4013 
    4014         arvif = ath11k_mac_get_arvif_by_vdev_id(ab, ev->vdev_id);
    4015         if (!arvif) {
    4016                 ath11k_warn(ab, "failed to find arvif with vedv id %d in obss_color_collision_event\n",
    4017                             ev->vdev_id);
    4018                 goto exit;
    4019         }
    4020 
    4021         switch (ev->evt_type) {
    4022         case WMI_BSS_COLOR_COLLISION_DETECTION:
--> 4023                 ieee80211_obss_color_collision_notify(arvif->vif, ev->obss_color_bitmap,
    4024                                                       GFP_KERNEL);
                                                               ^^^^^^^^^^
Smatch basically counts every GFP_KERNEL as a sleep, but actually, here
the GFP_KERNEL is not used.

    4025                 ath11k_dbg(ab, ATH11K_DBG_WMI,
    4026                            "OBSS color collision detected vdev:%d, event:%d, bitmap:%08llx\n",
    4027                            ev->vdev_id, ev->evt_type, ev->obss_color_bitmap);
    4028                 break;
    4029         case WMI_BSS_COLOR_COLLISION_DISABLE:
    4030         case WMI_BSS_COLOR_FREE_SLOT_TIMER_EXPIRY:
    4031         case WMI_BSS_COLOR_FREE_SLOT_AVAILABLE:
    4032                 break;
    4033         default:
    4034                 ath11k_warn(ab, "received unknown obss color collision detection event\n");
    4035         }
    4036 
    4037 exit:
    4038         kfree(tb);
    4039         rcu_read_unlock();
    4040 }

regards,
dan carpenter



More information about the ath11k mailing list