This is a note to let you know that I've just added the patch titled Revert "wifi: cfg80211: fix CQM for non-range use" to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: revert-wifi-cfg80211-fix-cqm-for-non-range-use.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 3389e1b4563f26f58f783d2f7d2f3ee3cf4eee4b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Date: Mon, 11 Dec 2023 10:16:15 +0100 Subject: Revert "wifi: cfg80211: fix CQM for non-range use" From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> This reverts commit 307a6525c82a5a1bc5364711ece92c2d2487e1ad which is commit 7e7efdda6adb385fbdfd6f819d76bc68c923c394 upstream. It needed to have commit 076fc8775daf ("wifi: cfg80211: remove wdev mutex") applied to properly work, otherwise regressions happen. Link: https://lore.kernel.org/r/e374bb16-5b13-44cc-b11a-2f4eefb1ecf5@xxxxxxxxxxx Link: https://lore.kernel.org/r/87sf4belmm.fsf@xxxxxxxxxxxxx Link: https://lore.kernel.org/r/20231210213930.61378-1-leo@xxxxxxxxx Reported-by: Léo Lam <leo@xxxxxxxxx> Reported-by: Sven Joachim <svenjoac@xxxxxx> Reported-by: Philip Müller <philm@xxxxxxxxxxx> Cc: Johannes Berg <johannes.berg@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- net/wireless/core.h | 1 net/wireless/nl80211.c | 50 ++++++++++++++++++------------------------------- 2 files changed, 19 insertions(+), 32 deletions(-) --- a/net/wireless/core.h +++ b/net/wireless/core.h @@ -297,7 +297,6 @@ struct cfg80211_cqm_config { u32 rssi_hyst; s32 last_rssi_event_value; enum nl80211_cqm_rssi_threshold_event last_rssi_event_type; - bool use_range_api; int n_rssi_thresholds; s32 rssi_thresholds[]; }; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -12574,6 +12574,10 @@ static int cfg80211_cqm_rssi_update(stru int i, n, low_index; int err; + /* RSSI reporting disabled? */ + if (!cqm_config) + return rdev_set_cqm_rssi_range_config(rdev, dev, 0, 0); + /* * Obtain current RSSI value if possible, if not and no RSSI threshold * event has been received yet, we should receive an event after a @@ -12648,6 +12652,18 @@ static int nl80211_set_cqm_rssi(struct g wdev->iftype != NL80211_IFTYPE_P2P_CLIENT) return -EOPNOTSUPP; + if (n_thresholds <= 1 && rdev->ops->set_cqm_rssi_config) { + if (n_thresholds == 0 || thresholds[0] == 0) /* Disabling */ + return rdev_set_cqm_rssi_config(rdev, dev, 0, 0); + + return rdev_set_cqm_rssi_config(rdev, dev, + thresholds[0], hysteresis); + } + + if (!wiphy_ext_feature_isset(&rdev->wiphy, + NL80211_EXT_FEATURE_CQM_RSSI_LIST)) + return -EOPNOTSUPP; + if (n_thresholds == 1 && thresholds[0] == 0) /* Disabling */ n_thresholds = 0; @@ -12655,20 +12671,6 @@ static int nl80211_set_cqm_rssi(struct g old = rcu_dereference_protected(wdev->cqm_config, lockdep_is_held(&wdev->mtx)); - /* if already disabled just succeed */ - if (!n_thresholds && !old) - return 0; - - if (n_thresholds > 1) { - if (!wiphy_ext_feature_isset(&rdev->wiphy, - NL80211_EXT_FEATURE_CQM_RSSI_LIST) || - !rdev->ops->set_cqm_rssi_range_config) - return -EOPNOTSUPP; - } else { - if (!rdev->ops->set_cqm_rssi_config) - return -EOPNOTSUPP; - } - if (n_thresholds) { cqm_config = kzalloc(struct_size(cqm_config, rssi_thresholds, n_thresholds), @@ -12683,26 +12685,13 @@ static int nl80211_set_cqm_rssi(struct g memcpy(cqm_config->rssi_thresholds, thresholds, flex_array_size(cqm_config, rssi_thresholds, n_thresholds)); - cqm_config->use_range_api = n_thresholds > 1 || - !rdev->ops->set_cqm_rssi_config; rcu_assign_pointer(wdev->cqm_config, cqm_config); - - if (cqm_config->use_range_api) - err = cfg80211_cqm_rssi_update(rdev, dev, cqm_config); - else - err = rdev_set_cqm_rssi_config(rdev, dev, - thresholds[0], - hysteresis); } else { RCU_INIT_POINTER(wdev->cqm_config, NULL); - /* if enabled as range also disable via range */ - if (old->use_range_api) - err = rdev_set_cqm_rssi_range_config(rdev, dev, 0, 0); - else - err = rdev_set_cqm_rssi_config(rdev, dev, 0, 0); } + err = cfg80211_cqm_rssi_update(rdev, dev, cqm_config); if (err) { rcu_assign_pointer(wdev->cqm_config, old); kfree_rcu(cqm_config, rcu_head); @@ -18769,11 +18758,10 @@ void cfg80211_cqm_rssi_notify_work(struc wdev_lock(wdev); cqm_config = rcu_dereference_protected(wdev->cqm_config, lockdep_is_held(&wdev->mtx)); - if (!cqm_config) + if (!wdev->cqm_config) goto unlock; - if (cqm_config->use_range_api) - cfg80211_cqm_rssi_update(rdev, wdev->netdev, cqm_config); + cfg80211_cqm_rssi_update(rdev, wdev->netdev, cqm_config); rssi_level = cqm_config->last_rssi_event_value; rssi_event = cqm_config->last_rssi_event_type; Patches currently in stable-queue which might be from gregkh@xxxxxxxxxxxxxxxxxxx are queue-6.1/rethook-use-__rcu-pointer-for-rethook-handler.patch queue-6.1/x86-entry-convert-int-0x80-emulation-to-idtentry.patch queue-6.1/r8169-fix-rtl8125b-pause-frames-blasting-when-suspended.patch queue-6.1/tracing-fix-a-possible-race-when-disabling-buffered-events.patch queue-6.1/regmap-fix-bogus-error-on-regcache_sync-success.patch queue-6.1/alsa-hda-realtek-add-framework-laptop-16-to-quirks.patch queue-6.1/alsa-pcm-fix-out-of-bounds-in-snd_pcm_state_names.patch queue-6.1/cgroup_freezer-cgroup_freezing-check-if-not-frozen.patch queue-6.1/hugetlb-fix-null-ptr-deref-in-hugetlb_vma_lock_write.patch queue-6.1/alsa-usb-audio-add-pioneer-djm-450-mixer-controls.patch queue-6.1/arm64-dts-mediatek-mt7622-fix-memory-node-warning-check.patch queue-6.1/x86-coco-disable-32-bit-emulation-by-default-on-tdx-and-sev.patch queue-6.1/tracing-fix-incomplete-locking-when-disabling-buffered-events.patch queue-6.1/x86-introduce-ia32_enabled.patch queue-6.1/ring-buffer-test-last-update-in-32bit-version-of-__rb_time_read.patch queue-6.1/platform-surface-aggregator-fix-recv_buf-return-value.patch queue-6.1/x86-entry-do-not-allow-external-0x80-interrupts.patch queue-6.1/arm64-dts-mediatek-mt8183-fix-unit-address-for-scp-reserved-memory.patch queue-6.1/arm64-dts-mediatek-cherry-fix-interrupt-cells-for-mt6360-on-i2c7.patch queue-6.1/alsa-hda-realtek-enable-headset-on-lenovo-m90-gen5.patch queue-6.1/x86-tdx-allow-32-bit-emulation-by-default.patch queue-6.1/nvme-pci-add-sleep-quirk-for-kingston-drives.patch queue-6.1/asoc-amd-yc-fix-non-functional-mic-on-asus-e1504fa.patch queue-6.1/io_uring-af_unix-disable-sending-io_uring-over-sockets.patch queue-6.1/binder-fix-memory-leaks-of-spam-and-pending-work.patch queue-6.1/tracing-disable-snapshot-buffer-when-stopping-instance-tracers.patch queue-6.1/tracing-always-update-snapshot-buffer-size.patch queue-6.1/iommu-avoid-more-races-around-device-probe.patch queue-6.1/misc-mei-client.c-return-negative-error-code-in-mei_.patch queue-6.1/md-raid6-use-valid-sector-values-to-determine-if-an-i-o-should-wait-on-the-reshape.patch queue-6.1/arm64-dts-mediatek-mt8183-kukui-jacuzzi-fix-dsi-unnecessary-cells-properties.patch queue-6.1/alsa-hda-realtek-add-new-framework-laptop-to-quirks.patch queue-6.1/nilfs2-prevent-warning-in-nilfs_sufile_set_segment_usage.patch queue-6.1/mm-fix-oops-when-filemap_map_pmd-without-prealloc_pte.patch queue-6.1/kprobes-consistent-rcu-api-usage-for-kretprobe-holder.patch queue-6.1/misc-mei-client.c-fix-problem-of-return-eoverflow-in.patch queue-6.1/arm64-dts-mediatek-mt8183-move-thermal-zones-to-the-root-node.patch queue-6.1/powercap-dtpm-fix-missing-cpufreq_cpu_put-calls.patch queue-6.1/arm64-dts-mediatek-mt8173-evb-fix-regulator-fixed-node-names.patch queue-6.1/revert-wifi-cfg80211-fix-cqm-for-non-range-use.patch queue-6.1/arm64-dts-imx8mq-drop-usb3-resume-missing-cas-from-u.patch queue-6.1/packet-move-reference-count-in-packet_sock-to-atomic_long_t.patch queue-6.1/checkstack-fix-printed-address.patch queue-6.1/nilfs2-fix-missing-error-check-for-sb_set_blocksize-call.patch queue-6.1/arm64-dts-mediatek-mt8195-fix-pm-suspend-resume-with-venc-clocks.patch queue-6.1/arm64-dts-mediatek-mt8183-evb-fix-unit_address_vs_reg-warning-on-ntc.patch queue-6.1/io_uring-fix-mutex_unlock-with-unreferenced-ctx.patch