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.6-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.6 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 4a7e92551618f3737b305f62451353ee05662f57 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 @@ -299,7 +299,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[] __counted_by(n_rssi_thresholds); }; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -12824,6 +12824,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 @@ -12898,6 +12902,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; @@ -12905,20 +12921,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), @@ -12933,26 +12935,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); @@ -19142,11 +19131,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.6/mm-memory_hotplug-add-missing-mem_hotplug_lock.patch queue-6.6/arm64-dts-mt7986-fix-emmc-hs400-mode-without-uboot-initialization.patch queue-6.6/rethook-use-__rcu-pointer-for-rethook-handler.patch queue-6.6/x86-entry-convert-int-0x80-emulation-to-idtentry.patch queue-6.6/r8169-fix-rtl8125b-pause-frames-blasting-when-suspended.patch queue-6.6/drm-i915-mst-reject-modes-that-require-the-bigjoiner.patch queue-6.6/tracing-fix-a-possible-race-when-disabling-buffered-events.patch queue-6.6/regmap-fix-bogus-error-on-regcache_sync-success.patch queue-6.6/alsa-hda-realtek-add-framework-laptop-16-to-quirks.patch queue-6.6/alsa-pcm-fix-out-of-bounds-in-snd_pcm_state_names.patch queue-6.6/cgroup_freezer-cgroup_freezing-check-if-not-frozen.patch queue-6.6/leds-trigger-netdev-fix-rtnl-handling-to-prevent-potential-deadlock.patch queue-6.6/hugetlb-fix-null-ptr-deref-in-hugetlb_vma_lock_write.patch queue-6.6/ring-buffer-force-absolute-timestamp-on-discard-of-event.patch queue-6.6/alsa-usb-audio-add-pioneer-djm-450-mixer-controls.patch queue-6.6/lib-group_cpus.c-avoid-acquiring-cpu-hotplug-lock-in-group_cpus_evenly.patch queue-6.6/arm64-dts-mediatek-mt7622-fix-memory-node-warning-check.patch queue-6.6/x86-coco-disable-32-bit-emulation-by-default-on-tdx-and-sev.patch queue-6.6/alsa-hda-realtek-apply-quirk-for-asus-um3504da.patch queue-6.6/tracing-fix-incomplete-locking-when-disabling-buffered-events.patch queue-6.6/tracing-stop-current-tracer-when-resizing-buffer.patch queue-6.6/x86-introduce-ia32_enabled.patch queue-6.6/nfp-flower-fix-for-take-a-mutex-lock-in-soft-irq-context-and-rcu-lock.patch queue-6.6/ring-buffer-test-last-update-in-32bit-version-of-__rb_time_read.patch queue-6.6/platform-surface-aggregator-fix-recv_buf-return-value.patch queue-6.6/workqueue-make-sure-that-wq_unbound_cpumask-is-never-empty.patch queue-6.6/x86-entry-do-not-allow-external-0x80-interrupts.patch queue-6.6/highmem-fix-a-memory-copy-problem-in-memcpy_from_folio.patch queue-6.6/arm64-dts-mediatek-mt8183-fix-unit-address-for-scp-reserved-memory.patch queue-6.6/alsa-hda-realtek-fix-speakers-on-xps-9530-2023.patch queue-6.6/arm64-dts-mediatek-cherry-fix-interrupt-cells-for-mt6360-on-i2c7.patch queue-6.6/alsa-hda-realtek-enable-headset-on-lenovo-m90-gen5.patch queue-6.6/x86-tdx-allow-32-bit-emulation-by-default.patch queue-6.6/arm64-dts-mt7986-change-cooling-trips.patch queue-6.6/nvme-pci-add-sleep-quirk-for-kingston-drives.patch queue-6.6/asoc-amd-yc-fix-non-functional-mic-on-asus-e1504fa.patch queue-6.6/io_uring-af_unix-disable-sending-io_uring-over-sockets.patch queue-6.6/tracing-disable-snapshot-buffer-when-stopping-instance-tracers.patch queue-6.6/tracing-always-update-snapshot-buffer-size.patch queue-6.6/arm64-dts-mediatek-mt8186-change-gpu-speedbin-nvmem-cell-name.patch queue-6.6/alsa-hda-realtek-add-quirk-for-lenovo-yoga-pro-7.patch queue-6.6/misc-mei-client.c-return-negative-error-code-in-mei_.patch queue-6.6/md-raid6-use-valid-sector-values-to-determine-if-an-i-o-should-wait-on-the-reshape.patch queue-6.6/arm64-dts-mediatek-mt8183-kukui-jacuzzi-fix-dsi-unnecessary-cells-properties.patch queue-6.6/alsa-hda-realtek-add-new-framework-laptop-to-quirks.patch queue-6.6/nilfs2-prevent-warning-in-nilfs_sufile_set_segment_usage.patch queue-6.6/mm-fix-oops-when-filemap_map_pmd-without-prealloc_pte.patch queue-6.6/drivers-base-cpu-crash-data-showing-should-depends-on-kexec_core.patch queue-6.6/arm64-dts-mediatek-mt8186-fix-clock-names-for-power-domains.patch queue-6.6/misc-mei-client.c-fix-problem-of-return-eoverflow-in.patch queue-6.6/drm-i915-mst-fix-.mode_valid_ctx-return-values.patch queue-6.6/arm64-dts-mediatek-mt8183-move-thermal-zones-to-the-root-node.patch queue-6.6/powercap-dtpm-fix-missing-cpufreq_cpu_put-calls.patch queue-6.6/arm64-dts-mt7986-define-3w-max-power-to-both-sfp-on-bpi-r3.patch queue-6.6/arm64-dts-mediatek-mt8173-evb-fix-regulator-fixed-node-names.patch queue-6.6/scripts-gdb-fix-lx-device-list-bus-and-lx-device-lis.patch queue-6.6/mm-memory_hotplug-fix-error-handling-in-add_memory_resource.patch queue-6.6/revert-wifi-cfg80211-fix-cqm-for-non-range-use.patch queue-6.6/packet-move-reference-count-in-packet_sock-to-atomic_long_t.patch queue-6.6/drm-i915-skip-some-timing-checks-on-bxt-glk-dsi-transcoders.patch queue-6.6/drm-atomic-helpers-invoke-end_fb_access-while-owning-plane-state.patch queue-6.6/checkstack-fix-printed-address.patch queue-6.6/nilfs2-fix-missing-error-check-for-sb_set_blocksize-call.patch queue-6.6/arm64-dts-mediatek-mt8195-fix-pm-suspend-resume-with-venc-clocks.patch queue-6.6/arm64-dts-mediatek-mt8183-evb-fix-unit_address_vs_reg-warning-on-ntc.patch queue-6.6/io_uring-fix-mutex_unlock-with-unreferenced-ctx.patch