Search Linux Wireless

RE: [bug report] wifi: iwlwifi: add iwlmld sub-driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Sent: Wednesday, 12 March 2025 10:31
> To: Korenblit, Miriam Rachel <miriam.rachel.korenblit@xxxxxxxxx>
> Cc: linux-wireless@xxxxxxxxxxxxxxx
> Subject: [bug report] wifi: iwlwifi: add iwlmld sub-driver
> 
> Hello Miri Korenblit,
> 
> Commit d1e879ec600f ("wifi: iwlwifi: add iwlmld sub-driver") from Feb 16, 2025
> (linux-next), leads to the following Smatch static checker
> warning:
> 
> 	drivers/net/wireless/intel/iwlwifi/mld/d3.c:1978
> iwl_mld_wowlan_resume()
> 	error: uninitialized symbol 'keep_connection'.
> 
> drivers/net/wireless/intel/iwlwifi/mld/d3.c
>     1884 int iwl_mld_wowlan_resume(struct iwl_mld *mld)
>     1885 {
>     1886         struct ieee80211_vif *bss_vif;
>     1887         struct ieee80211_bss_conf *link_conf;
>     1888         struct iwl_mld_netdetect_res netdetect_res;
>     1889         struct iwl_mld_resume_data resume_data = {
>     1890                 .notifs_expected =
>     1891                         IWL_D3_NOTIF_WOWLAN_INFO |
>     1892                         IWL_D3_NOTIF_D3_END_NOTIF,
>     1893                 .netdetect_res = &netdetect_res,
>     1894         };
>     1895         int link_id;
>     1896         int ret;
>     1897         bool fw_err = false;
>     1898         bool keep_connection;
>     1899
>     1900         lockdep_assert_wiphy(mld->wiphy);
>     1901
>     1902         IWL_DEBUG_WOWLAN(mld, "Starting the wowlan resume flow\n");
>     1903
>     1904         mld->trans->system_pm_mode = IWL_PLAT_PM_MODE_DISABLED;
>     1905         if (!mld->fw_status.in_d3) {
>     1906                 IWL_DEBUG_WOWLAN(mld,
>     1907                                  "Device_powered_off() was called during wowlan\n");
>     1908                 goto err;
>     1909         }
>     1910
>     1911         mld->fw_status.in_d3 = false;
>     1912         mld->scan.last_start_time_jiffies = jiffies;
>     1913
>     1914         bss_vif = iwl_mld_get_bss_vif(mld);
>     1915         if (WARN_ON(!bss_vif))
>     1916                 goto err;
>     1917
>     1918         /* We can't have several links upon wowlan entry,
>     1919          * this is enforced in the suspend flow.
>     1920          */
>     1921         WARN_ON(hweight16(bss_vif->active_links) > 1);
>     1922         link_id = bss_vif->active_links ? __ffs(bss_vif->active_links) : 0;
>     1923         link_conf = link_conf_dereference_protected(bss_vif, link_id);
>     1924
>     1925         if (WARN_ON(!link_conf))
>     1926                 goto err;
>     1927
>     1928         iwl_fw_dbg_read_d3_debug_data(&mld->fwrt);
>     1929
>     1930         if (iwl_mld_fw_needs_restart(mld, bss_vif)) {
>     1931                 fw_err = true;
>     1932                 goto err;
>     1933         }
>     1934
>     1935         resume_data.wowlan_status =
> kzalloc(sizeof(*resume_data.wowlan_status),
>     1936                                             GFP_KERNEL);
>     1937         if (!resume_data.wowlan_status)
>     1938                 return -1;
>     1939
>     1940         if (mld->netdetect)
>     1941                 resume_data.notifs_expected |= IWL_D3_ND_MATCH_INFO;
>     1942
>     1943         ret = iwl_mld_wait_d3_notif(mld, &resume_data, true);
>     1944         if (ret) {
>     1945                 IWL_ERR(mld, "Couldn't get the d3 notifs %d\n", ret);
>     1946                 fw_err = true;
>     1947                 goto err;
>     1948         }
>     1949
>     1950         if (resume_data.d3_end_flags & IWL_D0I3_RESET_REQUIRE) {
>     1951                 mld->fw_status.in_hw_restart = true;
>     1952                 goto process_wakeup_results;
>     1953         }
>     1954
>     1955         iwl_mld_update_changed_regdomain(mld);
>     1956         iwl_mld_update_mac_power(mld, bss_vif, false);
>     1957         iwl_mld_enable_beacon_filter(mld, link_conf, false);
>     1958         iwl_mld_update_device_power(mld, false);
>     1959
>     1960         if (mld->netdetect)
>     1961                 ret = iwl_mld_scan_stop(mld, IWL_MLD_SCAN_NETDETECT,
> false);
>     1962
>     1963  process_wakeup_results:
>     1964         if (mld->netdetect) {
>     1965                 iwl_mld_process_netdetect_res(mld, bss_vif, &resume_data);
>     1966                 mld->netdetect = false;
> 
> mld->netdetect is false but keep_connection is uninitialized.
> 
>     1967         } else {
>     1968                 keep_connection =
>     1969                         iwl_mld_process_wowlan_status(mld, bss_vif,
>     1970                                                       resume_data.wowlan_status);
>     1971
>     1972                 /* EMLSR state will be cleared if the connection is not kept */
>     1973                 if (keep_connection)
>     1974                         iwl_mld_unblock_emlsr(mld, bss_vif,
>     1975                                               IWL_MLD_EMLSR_BLOCKED_WOWLAN);
>     1976         }
>     1977
> --> 1978         if (!mld->netdetect && !keep_connection)
>                                          ^^^^^^^^^^^^^^^ Uninitialized
> 
>     1979                 ieee80211_resume_disconnect(bss_vif);
>     1980
>     1981         goto out;
>     1982
>     1983  err:
>     1984         if (fw_err) {
>     1985                 mld->trans->state = IWL_TRANS_NO_FW;
>     1986                 set_bit(STATUS_FW_ERROR, &mld->trans->status);
>     1987         }
>     1988
>     1989         mld->fw_status.in_hw_restart = true;
>     1990         ret = 1;
>     1991  out:
>     1992         if (resume_data.wowlan_status) {
>     1993                 kfree(resume_data.wowlan_status->wake_packet);
>     1994                 kfree(resume_data.wowlan_status);
>     1995         }
>     1996
>     1997         return ret;
>     1998 }
> 
> regards,
> dan carpenter

Thanks for the report, Dan!
Will send a fix soon

Miri




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux