wifi: rt2x00: restart beacon queue when hardware reset
Subsystems (10)
Sasha Levin
maintainerPATCH 1/31 wifi: rt2x00: restart beacon queue when hardware reset
From: Shiji Yang <[email protected]>
[ Upstream commit a11d965a218f0cd95b13fe44d0bcd8a20ce134a8 ]
When a hardware reset is triggered, all registers are reset, so all queues are forced to stop in hardware interface. However, mac80211 will not automatically stop the queue. If we don't manually stop the beacon queue, the queue will be deadlocked and unable to start again. This patch fixes the issue where Apple devices cannot connect to the AP after calling ieee80211_restart_hw().
--- drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 3 +++ drivers/net/wireless/ralink/rt2x00/rt2x00mac.c | 11 +++++++++++ 2 files changed, 14 insertions(+)
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +3 -0
@@ -101,6 +101,7 @@ void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev)rt2x00link_stop_tuner (rt2x00dev);rt2x00queue_stop_queues (rt2x00dev);rt2x00queue_flush_queues (rt2x00dev, true); +rt2x00queue_stop_queue (rt2x00dev->bcn);/* * Disable radio.
@@ -1283,6 +1284,7 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev) rt2x00dev->intf_ap_count =0 ; rt2x00dev->intf_sta_count =0 ; rt2x00dev->intf_associated =0 ; + rt2x00dev->intf_beaconing =0 ;/* Enable the radio */ retval =rt2x00lib_enable_radio (rt2x00dev);
@@ -1310,6 +1312,7 @@ void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev) rt2x00dev->intf_ap_count =0 ; rt2x00dev->intf_sta_count =0 ; rt2x00dev->intf_associated =0 ; + rt2x00dev->intf_beaconing =0 ; }static inline void rt2x00lib_set_if_combinations (struct rt2x00_dev *rt2x00dev)
drivers/net/wireless/ralink/rt2x00/rt2x00mac.c +11 -0
@@ -578,6 +578,17 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,*/ if (changes &BSS_CHANGED_BEACON_ENABLED ) {mutex_lock (&intf->beacon_skb_mutex); + +/* +* Clear the 'enable_beacon' flag and clear beacon because +* the beacon queue has been stopped after hardware reset. +*/ +if (test_bit (DEVICE_STATE_RESET , &rt2x00dev->flags) && + intf->enable_beacon) { + intf->enable_beacon = false; +rt2x00queue_clear_beacon (rt2x00dev, vif); + } +if (!bss_conf->enable_beacon && intf->enable_beacon) { rt2x00dev->intf_beaconing--; intf->enable_beacon = false;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 2/31 selftests/bpf: satisfy compiler by having explicit return in btf test
From: Andrii Nakryiko <[email protected]>
[ Upstream commit f4c7e887324f5776eef6e6e47a90e0ac8058a7a8 ]
Some compilers complain about get_pprint_mapv_size() not returning value in some code paths. Fix with explicit return.
--- tools/testing/selftests/bpf/test_btf.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/test_btf.c +1 -0
@@ -4663,6 +4663,7 @@ static size_t get_pprint_mapv_size(enum pprint_mapv_kind_t mapv_kind)#endif assert (0 ); +return 0 ; } static void set_pprint_mapv(enum pprint_mapv_kind_t mapv_kind,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 3/31 selftests/bpf: Fix pyperf180 compilation failure with clang18
In reply to Sasha LevinFrom: Yonghong Song <[email protected]>
[ Upstream commit 100888fb6d8a185866b1520031ee7e3182b173de ]
With latest clang18 (main branch of llvm-project repo), when building bpf selftests,
[~/work/bpf-next (master)]$ make -C tools/testing/selftests/bpf LLVM=1 -j
The following compilation error happens:
fatal error: error in backend: Branch target out of insn range
...
Stack dump:
0. Program arguments: clang -g -Wall -Werror -D__TARGET_ARCH_x86 -mlittle-endian
-I/home/yhs/work/bpf-next/tools/testing/selftests/bpf/tools/include -I/home/yhs/work/bpf-next/tools/testing/selftests/bpf -I/home/yhs/work/bpf-next/tools/include/uapi -I/home/yhs/work/bpf-next/tools/testing/selftests/usr/include -idirafter /home/yhs/work/llvm-project/llvm/build.18/install/lib/clang/18/include -idirafter /usr/local/include -idirafter /usr/include -Wno-compare-distinct-pointer-types -DENABLE_ATOMICS_TESTS -O2 --target=bpf -c progs/pyperf180.c -mcpu=v3 -o /home/yhs/work/bpf-next/tools/testing/selftests/bpf/pyperf180.bpf.o
1. <eof> parser at end of file
2. Code generation
...
The compilation failure only happens to cpu=v2 and cpu=v3. cpu=v4 is okay since cpu=v4 supports 32-bit branch target offset.
The above failure is due to upstream llvm patch [1] where some inlining behavior are changed in clang18.
To workaround the issue, previously all 180 loop iterations are fully unrolled. The bpf macro __BPF_CPU_VERSION__ (implemented in clang18 recently) is used to avoid unrolling changes if cpu=v4. If __BPF_CPU_VERSION__ is not available and the compiler is clang18, the unrollng amount is unconditionally reduced.
[1] https://github.com/llvm/llvm-project/commit/1a2e77cf9e11dbf56b5720c607313a566eebb16e
--- tools/testing/selftests/bpf/progs/pyperf180.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)
tools/testing/selftests/bpf/progs/pyperf180.c +22 -0
@@ -1,4 +1,26 @@// SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #define STACK_MAX_LEN 180 + +/* llvm upstream commit at clang18 +* https://github.com/llvm/llvm-project/commit/1a2e77cf9e11dbf56b5720c607313a566eebb16e +* changed inlining behavior and caused compilation failure as some branch +* target distance exceeded 16bit representation which is the maximum for +* cpu v1/v2/v3. Macro __BPF_CPU_VERSION__ is later implemented in clang18 +* to specify which cpu version is used for compilation. So a smaller +* unroll_count can be set if __BPF_CPU_VERSION__ is less than 4, which +* reduced some branch target distances and resolved the compilation failure. +* +* To capture the case where a developer/ci uses clang18 but the corresponding +* repo checkpoint does not have __BPF_CPU_VERSION__, a smaller unroll_count +* will be set as well to prevent potential compilation failures. +*/ +#ifdef __BPF_CPU_VERSION__ +#if __BPF_CPU_VERSION__ <4 +#define UNROLL_COUNT 90 +#endif +#elif __clang_major__ ==18 +#define UNROLL_COUNT 90 +#endif +#include "pyperf.h"
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 4/31 scsi: lpfc: Fix possible file string name overflow when updating firmware
In reply to Sasha LevinFrom: Justin Tee <[email protected]>
[ Upstream commit f5779b529240b715f0e358489ad0ed933bf77c97 ]
Because file_name and phba->ModelName are both declared a size 80 bytes, the extra ".grp" file extension could cause an overflow into file_name.
Define a ELX_FW_NAME_SIZE macro with value 84. 84 incorporates the 4 extra characters from ".grp". file_name is changed to be declared as a char and initialized to zeros i.e. null chars.
--- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_init.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc.h +1 -0
@@ -32,6 +32,7 @@struct lpfc_sli2_slim ;#define ELX_MODEL_NAME_SIZE 80 +#define ELX_FW_NAME_SIZE 84#define LPFC_PCI_DEV_LP 0x1#define LPFC_PCI_DEV_OC 0x2
drivers/scsi/lpfc/lpfc_init.c +2 -2
@@ -12527,7 +12527,7 @@ lpfc_write_firmware(const struct firmware *fw, void *context)int lpfc_sli4_request_firmware_update (struct lpfc_hba *phba,uint8_t fw_upgrade) { -uint8_t file_name[ELX_MODEL_NAME_SIZE ]; +char file_name[ELX_FW_NAME_SIZE ] = {0 };int ret;const struct firmware *fw;
@@ -12536,7 +12536,7 @@ lpfc_sli4_request_firmware_update(struct lpfc_hba *phba, uint8_t fw_upgrade) LPFC_SLI_INTF_IF_TYPE_2)return -EPERM ; -snprintf (file_name,ELX_MODEL_NAME_SIZE ,"%s.grp" , phba->ModelName); +scnprintf (file_name,sizeof (file_name),"%s.grp" , phba->ModelName);if (fw_upgrade ==INT_FW_UPGRADE ) { ret = request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 5/31 PCI: Add no PM reset quirk for NVIDIA Spectrum devices
In reply to Sasha LevinFrom: Ido Schimmel <[email protected]>
[ Upstream commit 3ed48c80b28d8dcd584d6ddaf00c75b7673e1a05 ]
Spectrum-{1,2,3,4} devices report that a D3hot->D0 transition causes a reset (i.e., they advertise NoSoftRst-). However, this transition does not have any effect on the device: It continues to be operational and network ports remain up. Advertising this support makes it seem as if a PM reset is viable for these devices. Mark it as unavailable to skip it when testing reset methods.
Before:
# cat /sys/bus/pci/devices/0000\:03\:00.0/reset_method pm bus
After:
# cat /sys/bus/pci/devices/0000\:03\:00.0/reset_method bus
--- drivers/pci/quirks.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/pci/quirks.c +13 -0
@@ -3626,6 +3626,19 @@ static void quirk_no_pm_reset(struct pci_dev *dev)DECLARE_PCI_FIXUP_CLASS_HEADER (PCI_VENDOR_ID_ATI ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA ,8 , quirk_no_pm_reset); +/* +* Spectrum-{1,2,3,4} devices report that a D3hot->D0 transition causes a reset +* (i.e., they advertise NoSoftRst-). However, this transition does not have +* any effect on the device: It continues to be operational and network ports +* remain up. Advertising this support makes it seem as if a PM reset is viable +* for these devices. Mark it as unavailable to skip it when testing reset +* methods. +*/ +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MELLANOX ,0xcb84 , quirk_no_pm_reset); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MELLANOX ,0xcf6c , quirk_no_pm_reset); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MELLANOX ,0xcf70 , quirk_no_pm_reset); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MELLANOX ,0xcf80 , quirk_no_pm_reset); +/* * Thunderbolt controllers with broken MSI hotplug signaling: * Entire 1st generation (Light Ridge, Eagle Ridge, Light Peak) and part
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 6/31 bonding: return -ENOMEM instead of BUG in alb_upper_dev_walk
In reply to Sasha LevinFrom: Zhengchao Shao <[email protected]>
[ Upstream commit d6b83f1e3707c4d60acfa58afd3515e17e5d5384 ]
If failed to allocate "tags" or could not find the final upper device from start_dev's upper list in bond_verify_device_path(), only the loopback detection of the current upper device should be affected, and the system is no need to be panic.
So return -ENOMEM in alb_upper_dev_walk to stop walking, print some warn information when failed to allocate memory for vlan tags in bond_verify_device_path.
I also think that the following function calls netdev_walk_all_upper_dev_rcu
---->>>alb_upper_dev_walk
---------->>>bond_verify_device_path
From this way, "end device" can eventually be obtained from "start device" in bond_verify_device_path, IS_ERR(tags) could be instead of IS_ERR_OR_NULL(tags) in alb_upper_dev_walk.
--- drivers/net/bonding/bond_alb.c | 3 ++- drivers/net/bonding/bond_main.c | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/bonding/bond_alb.c +2 -1
@@ -970,7 +970,8 @@ static int alb_upper_dev_walk(struct net_device *upper, void *_data)if (netif_is_macvlan (upper) && !strict_match) { tags =bond_verify_device_path (bond->dev, upper,0 );if (IS_ERR_OR_NULL (tags)) -BUG (); +return -ENOMEM ; +alb_send_lp_vid (slave, upper->dev_addr, tags[0 ].vlan_proto, tags[0 ].vlan_id);kfree (tags);
drivers/net/bonding/bond_main.c +4 -1
@@ -2482,8 +2482,11 @@ struct bond_vlan_tag *bond_verify_device_path(struct net_device *start_dev,if (start_dev == end_dev) { tags =kcalloc (level +1 ,sizeof (*tags),GFP_ATOMIC ); -if (!tags) +if (!tags) { +net_err_ratelimited ("%s: %s: Failed to allocate tags\n" , + __func__, start_dev->name);return ERR_PTR (-ENOMEM ); + } tags[level].vlan_proto =VLAN_N_VID ;return tags; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 7/31 ARM: dts: imx7d: Fix coresight funnel ports
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit 0d4ac04fa7c3f6dc263dba6f575a2ec7a2d4eca8 ]
imx7d uses two ports for 'in-ports', so the syntax port@<num> has to be used. imx7d has both port and port@1 nodes present, raising these error:
funnel@30041000: in-ports: More than one condition true in oneOf schema funnel@30041000: Unevaluated properties are not allowed ('in-ports' was unexpected)
Fix this by also using port@0 for imx7s as well.
--- arch/arm/boot/dts/imx7d.dtsi | 3 --- arch/arm/boot/dts/imx7s.dtsi | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-)
arch/arm/boot/dts/imx7d.dtsi +0 -3
@@ -204,9 +204,6 @@ pcie: pcie@33800000 { }; &ca_funnel_in_ports { - #address-cells = <1>; - #size-cells = <0>; - port@1 { reg = <1>; ca_funnel_in_port1: endpoint {
arch/arm/boot/dts/imx7s.dtsi +5 -1
@@ -183,7 +183,11 @@ funnel@30041000 { clock-names = "apb_pclk"; ca_funnel_in_ports: in-ports { - port { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; ca_funnel_in_port0: endpoint { remote-endpoint = <&etm0_out_port>; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 8/31 ARM: dts: imx7s: Fix lcdif compatible
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit 5f55da4cc37051cda600ea870ce8cf29f1297715 ]
imx7d-lcdif is compatible to imx6sx-lcdif. MXSFB_V6 supports overlay by using LCDC_AS_CTRL register. This registers used by overlay plane:
* LCDC_AS_CTRL
* LCDC_AS_BUF
* LCDC_AS_NEXT_BUF
are listed in i.MX7D RM as well.
--- arch/arm/boot/dts/imx7s.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx7s.dtsi +1 -1
@@ -769,7 +769,7 @@ csi_from_csi_mux: endpoint { }; lcdif: lcdif@30730000 { - compatible = "fsl,imx7d-lcdif", "fsl,imx28-lcdif"; + compatible = "fsl,imx7d-lcdif", "fsl,imx6sx-lcdif"; reg = <0x30730000 0x10000>; interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX7D_LCDIF_PIXEL_ROOT_CLK>,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 9/31 ARM: dts: imx7s: Fix nand-controller #size-cells
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit 4aadb841ed49bada1415c48c44d21f5b69e01299 ]
nand-controller.yaml bindings says #size-cells shall be set to 0. Fixes the dtbs_check warning:arch/arm/boot/dts/nxp/imx/imx7s-mba7.dtb: nand-controller@33002000:
#size-cells:0:0: 0 was expected
from schema $id: http://devicetree.org/schemas/mtd/gpmi-nand.yaml#
--- arch/arm/boot/dts/imx7s.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx7s.dtsi +1 -1
@@ -1217,7 +1217,7 @@ dma_apbh: dma-controller@33000000 { gpmi: gpmi-nand@33002000{ compatible = "fsl,imx7d-gpmi-nand"; #address-cells = <1>; - #size-cells = <1>; + #size-cells = <0>; reg = <0x33002000 0x2000>, <0x33004000 0x4000>; reg-names = "gpmi-nand", "bch"; interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 10/31 wifi: ath9k: Fix potential array-index-out-of-bounds read in ath9k_htc_txstatus()
In reply to Sasha LevinFrom: Minsuk Kang <[email protected]>
[ Upstream commit 2adc886244dff60f948497b59affb6c6ebb3c348 ]
Fix an array-index-out-of-bounds read in ath9k_htc_txstatus(). The bug occurs when txs->cnt, data from a URB provided by a USB device, is bigger than the size of the array txs->txstatus, which is HTC_MAX_TX_STATUS. WARN_ON() already checks it, but there is no bug handling code after the check. Make the function return if that is the case.
Found by a modified version of syzkaller.
UBSAN: array-index-out-of-bounds in htc_drv_txrx.c index 13 is out of range for type '__wmi_event_txstatus [12]' Call Trace: ath9k_htc_txstatus ath9k_wmi_event_tasklet tasklet_action_common __do_softirq irq_exit_rxu sysvec_apic_timer_interrupt
--- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +3 -2
@@ -647,9 +647,10 @@ void ath9k_htc_txstatus(struct ath9k_htc_priv *priv, void *wmi_event)struct ath9k_htc_tx_event *tx_pend;int i; -for (i =0 ; i < txs->cnt; i++) { -WARN_ON (txs->cnt >HTC_MAX_TX_STATUS ); +if (WARN_ON_ONCE (txs->cnt >HTC_MAX_TX_STATUS )) +return ; +for (i =0 ; i < txs->cnt; i++) { __txs = &txs->txstatus[i]; skb =ath9k_htc_tx_get_packet (priv, __txs);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 11/31 bpf: Add map and need_defer parameters to .map_fd_put_ptr()
In reply to Sasha LevinFrom: Hou Tao <[email protected]>
[ Upstream commit 20c20bd11a0702ce4dc9300c3da58acf551d9725 ]
map is the pointer of outer map, and need_defer needs some explanation. need_defer tells the implementation to defer the reference release of the passed element and ensure that the element is still alive before the bpf program, which may manipulate it, exits.
The following three cases will invoke map_fd_put_ptr() and different need_defer values will be passed to these callers:
1) release the reference of the old element in the map during map update or map deletion. The release must be deferred, otherwise the bpf program may incur use-after-free problem, so need_defer needs to be true.
2) release the reference of the to-be-added element in the error path of map update. The to-be-added element is not visible to any bpf program, so it is OK to pass false for need_defer parameter.
3) release the references of all elements in the map during map release. Any bpf program which has access to the map must have been exited and released, so need_defer=false will be OK.
These two parameters will be used by the following patches to fix the potential use-after-free problem for map-in-map.
--- include/linux/bpf.h | 6 +++++- kernel/bpf/arraymap.c | 12 +++++++----- kernel/bpf/hashtab.c | 6 +++--- kernel/bpf/map_in_map.c | 2 +- kernel/bpf/map_in_map.h | 2 +- 5 files changed, 17 insertions(+), 11 deletions(-)
include/linux/bpf.h +5 -1
@@ -49,7 +49,11 @@ struct bpf_map_ops {/* funcs called by prog_array and perf_event_array map */ void *(*map_fd_get_ptr)(struct bpf_map *map,struct file *map_file,int fd); -void (*map_fd_put_ptr)(void *ptr); +/* If need_defer is true, the implementation should guarantee that +* the to-be-put element is still alive before the bpf program, which +* may manipulate it, exists. +*/ +void (*map_fd_put_ptr)(struct bpf_map *map,void *ptr,bool need_defer);u32 (*map_gen_lookup)(struct bpf_map *map,struct bpf_insn *insn_buf);u32 (*map_fd_sys_lookup_elem)(void *ptr); void (*map_seq_show_elem)(struct bpf_map *map, void *key,
kernel/bpf/arraymap.c +7 -5
@@ -542,7 +542,7 @@ int bpf_fd_array_map_update_elem(struct bpf_map *map, struct file *map_file, old_ptr =xchg (array->ptrs + index, new_ptr);if (old_ptr) - map->ops->map_fd_put_ptr (old_ptr); + map->ops->map_fd_put_ptr (map, old_ptr, true);return 0 ; }
@@ -558,7 +558,7 @@ static int fd_array_map_delete_elem(struct bpf_map *map, void *key) old_ptr =xchg (array->ptrs + index,NULL );if (old_ptr) { - map->ops->map_fd_put_ptr (old_ptr); + map->ops->map_fd_put_ptr (map, old_ptr, true);return 0 ; }else {return -ENOENT ;
@@ -582,8 +582,9 @@ static void *prog_fd_array_get_ptr(struct bpf_map *map,return prog; } -static void prog_fd_array_put_ptr (void *ptr) +static void prog_fd_array_put_ptr (struct bpf_map *map,void *ptr,bool need_defer) { +/* bpf_prog is freed after one RCU or tasks trace grace period */ bpf_prog_put (ptr); }
@@ -694,8 +695,9 @@ static void *perf_event_fd_array_get_ptr(struct bpf_map *map,return ee; } -static void perf_event_fd_array_put_ptr (void *ptr) +static void perf_event_fd_array_put_ptr (struct bpf_map *map,void *ptr,bool need_defer) { +/* bpf_perf_event is freed after one RCU grace period */ bpf_event_entry_free_rcu (ptr); }
@@ -736,7 +738,7 @@ static void *cgroup_fd_array_get_ptr(struct bpf_map *map,return cgroup_get_from_fd (fd); } -static void cgroup_fd_array_put_ptr (void *ptr) +static void cgroup_fd_array_put_ptr (struct bpf_map *map,void *ptr,bool need_defer) {/* cgroup_put free cgrp after a rcu grace period */ cgroup_put (ptr);
kernel/bpf/hashtab.c +3 -3
@@ -674,7 +674,7 @@ static void htab_put_fd_value(struct bpf_htab *htab, struct htab_elem *l)if (map->ops->map_fd_put_ptr) { ptr =fd_htab_map_get_ptr (map, l); - map->ops->map_fd_put_ptr (ptr); + map->ops->map_fd_put_ptr (map, ptr, true); } }
@@ -1426,7 +1426,7 @@ static void fd_htab_map_free(struct bpf_map *map)hlist_nulls_for_each_entry_safe (l, n, head, hash_node) {void *ptr =fd_htab_map_get_ptr (map, l); - map->ops->map_fd_put_ptr (ptr); + map->ops->map_fd_put_ptr (map, ptr, false); } }
@@ -1467,7 +1467,7 @@ int bpf_fd_htab_map_update_elem(struct bpf_map *map, struct file *map_file, ret =htab_map_update_elem (map, key, &ptr, map_flags);if (ret) - map->ops->map_fd_put_ptr (ptr); + map->ops->map_fd_put_ptr (map, ptr, false);return ret; }
kernel/bpf/map_in_map.c +1 -1
@@ -106,7 +106,7 @@ void *bpf_map_fd_get_ptr(struct bpf_map *map,return inner_map; } -void bpf_map_fd_put_ptr (void *ptr) +void bpf_map_fd_put_ptr (struct bpf_map *map,void *ptr,bool need_defer) {/* ptr->ops->map_free() has to go through one * rcu grace period by itself.
kernel/bpf/map_in_map.h +1 -1
@@ -15,7 +15,7 @@ bool bpf_map_meta_equal(const struct bpf_map *meta0, const struct bpf_map *meta1);void *bpf_map_fd_get_ptr (struct bpf_map *map,struct file *map_file,int ufd); -void bpf_map_fd_put_ptr (void *ptr); +void bpf_map_fd_put_ptr (struct bpf_map *map,void *ptr,bool need_defer);u32 bpf_map_fd_sys_lookup_elem (void *ptr);#endif
Signature · 1 line
2.43.0
Re: [PATCH AUTOSEL 5.4 11/31] bpf: Add map and need_defer parameters to .map_fd_put_ptr()
Hi Sasha,
Quoted 23 lines · Sasha Levin
From: Hou Tao <[email protected]>
[ Upstream commit
20c20bd11a0702ce4dc9300c3da58acf551d9725]map is the pointer of outer map, and
need_deferneeds some explanation.need_defertells the implementation to defer the reference release of the passed element and ensure that the element is still alive before the bpf program, which may manipulate it, exits.The following three cases will invoke
map_fd_put_ptr()and differentneed_defervalues will be passed to these callers:1) release the reference of the old element in the map during map update or map deletion. The release must be deferred, otherwise the bpf program may incur use-after-free problem, so
need_deferneeds to be true.
2) release the reference of the to-be-added element in the error path of map update. The to-be-added element is not visible to any bpf program, so it is OK to pass false forneed_deferparameter.
3) release the references of all elements in the map during map release. Any bpf program which has access to the map must have been exited and released, so need_defer=false will be OK.
Quoted 7 lines
These two parameters will be used by the following patches to fix the potential use-after-free problem for map-in-map.
Signed-off-by Hou Tao <[email protected]>Signed-off-by Alexei Starovoitov <[email protected]>Signed-off-by Sasha Levin <[email protected]>
The patch is just a preparatory patch for fix, please drop it.
Sasha Levin
maintainerPATCH 12/31 scsi: libfc: Don't schedule abort twice
In reply to Sasha LevinFrom: Hannes Reinecke <[email protected]>
[ Upstream commit b57c4db5d23b9df0118a25e2441c9288edd73710 ]
The current FC error recovery is sending up to three REC (recovery) frames in 10 second intervals, and as a final step sending an ABTS after 30 seconds for the command itself. Unfortunately sending an ABTS is also the action for the SCSI abort handler, and the default timeout for SCSI commands is also 30 seconds. This causes two ABTS to be scheduled, with the libfc one slightly earlier. The ABTS scheduled by SCSI EH then sees the command to be already aborted, and will always return with a 'GOOD' status irrespective on the actual result from the first ABTS. This causes the SCSI EH abort handler to always succeed, and SCSI EH never to be engaged. Fix this by not issuing an ABTS when a SCSI command is present for the exchange, but rather wait for the abort scheduled from SCSI EH. And warn if an abort is already scheduled to avoid similar errors in the future.
--- drivers/scsi/libfc/fc_fcp.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/scsi/libfc/fc_fcp.c +11 -5
@@ -270,6 +270,11 @@ static int fc_fcp_send_abort(struct fc_fcp_pkt *fsp)if (!fsp->seq_ptr)return -EINVAL ; +if (fsp->state &FC_SRB_ABORT_PENDING ) { +FC_FCP_DBG (fsp,"abort already pending\n" ); +return -EBUSY ; + } +per_cpu_ptr (fsp->lp->stats,get_cpu ())->FcpPktAborts++;put_cpu ();
@@ -1698,11 +1703,12 @@ static void fc_fcp_recovery(struct fc_fcp_pkt *fsp, u8 code) fsp->status_code = code; fsp->cdb_status =0 ; fsp->io_status =0 ; -/* -* if this fails then we let the scsi command timer fire and -* scsi-ml escalate. -*/ -fc_fcp_send_abort (fsp); +if (!fsp->cmd) +/* +* Only abort non-scsi commands; otherwise let the +* scsi command timer fire and scsi-ml escalate. +*/ +fc_fcp_send_abort (fsp); }/**
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 13/31 scsi: libfc: Fix up timeout error in fc_fcp_rec_error()
In reply to Sasha LevinFrom: Hannes Reinecke <[email protected]>
[ Upstream commit 53122a49f49796beb2c4a1bb702303b66347e29f ]
We should set the status to FC_TIMED_OUT when a timeout error is passed to fc_fcp_rec_error().
--- drivers/scsi/libfc/fc_fcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/libfc/fc_fcp.c +1 -1
@@ -1685,7 +1685,7 @@ static void fc_fcp_rec_error(struct fc_fcp_pkt *fsp, struct fc_frame *fp)if (fsp->recov_retry++ <FC_MAX_RECOV_RETRY )fc_fcp_rec (fsp);else -fc_fcp_recovery (fsp,FC_ERROR ); +fc_fcp_recovery (fsp,FC_TIMED_OUT );break ; }fc_fcp_unlock_pkt (fsp);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 14/31 ARM: dts: rockchip: fix rk3036 hdmi ports node
In reply to Sasha LevinFrom: Johan Jonker <[email protected]>
[ Upstream commit 27ded76ef0fcfcf939914532aae575cf23c221b4 ]
Fix hdmi ports node so that it matches the
rockchip,inno-hdmi.yaml binding.
--- arch/arm/boot/dts/rk3036.dtsi | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
arch/arm/boot/dts/rk3036.dtsi +11 -3
@@ -337,12 +337,20 @@ hdmi: hdmi@20034000 { pinctrl-0 = <&hdmi_ctl>; status = "disabled"; - hdmi_in: port { + ports { #address-cells = <1>; #size-cells = <0>; - hdmi_in_vop: endpoint@0 { + + hdmi_in: port@0 { reg = <0>; - remote-endpoint = <&vop_out_hdmi>; + + hdmi_in_vop: endpoint { + remote-endpoint = <&vop_out_hdmi>; + }; + }; + + hdmi_out: port@1 { + reg = <1>; }; }; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 15/31 ARM: dts: imx25/27-eukrea: Fix RTC node name
In reply to Sasha LevinFrom: Fabio Estevam <[email protected]>
[ Upstream commit 68c711b882c262e36895547cddea2c2d56ce611d ]
Node names should be generic. Use 'rtc' as node name to fix the following dt-schema warning:
imx25-eukrea-mbimxsd25-baseboard.dtb: pcf8563@51: $nodename:0: 'pcf8563@51' does not match '^rtc(@.*|-([0-9]|[1-9][0-9]+))?$'
from schema $id: http://devicetree.org/schemas/rtc/nxp,pcf8563.yaml#
--- arch/arm/boot/dts/imx25-eukrea-cpuimx25.dtsi | 2 +- arch/arm/boot/dts/imx27-eukrea-cpuimx27.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/imx25-eukrea-cpuimx25.dtsi +1 -1
@@ -27,7 +27,7 @@ &i2c1 { pinctrl-0 = <&pinctrl_i2c1>; status = "okay"; - pcf8563@51 { + rtc@51 { compatible = "nxp,pcf8563"; reg = <0x51>; };
arch/arm/boot/dts/imx27-eukrea-cpuimx27.dtsi +1 -1
@@ -33,7 +33,7 @@ &i2c1 { pinctrl-0 = <&pinctrl_i2c1>; status = "okay"; - pcf8563@51 { + rtc@51 { compatible = "nxp,pcf8563"; reg = <0x51>; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 16/31 ARM: dts: imx: Use flash@0,0 pattern
In reply to Sasha LevinFrom: Fabio Estevam <[email protected]>
[ Upstream commit 1e1d7cc478fb16816de09740e3c323c0c188d58f ]
Per mtd-physmap.yaml, 'nor@0,0' is not a valid node pattern.
Change it to 'flash@0,0' to fix the following dt-schema warning:
imx1-ads.dtb: nor@0,0: $nodename:0: 'nor@0,0' does not match '^(flash|.*sram|nand)(@.*)?$'
from schema $id: http://devicetree.org/schemas/mtd/mtd-physmap.yaml#
--- arch/arm/boot/dts/imx1-ads.dts | 2 +- arch/arm/boot/dts/imx1-apf9328.dts | 2 +- arch/arm/boot/dts/imx27-eukrea-cpuimx27.dtsi | 2 +- arch/arm/boot/dts/imx27-phytec-phycore-som.dtsi | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/imx1-ads.dts +1 -1
@@ -65,7 +65,7 @@ &weim { pinctrl-0 = <&pinctrl_weim>; status = "okay"; - nor: nor@0,0 { + nor: flash@0,0 { compatible = "cfi-flash"; reg = <0 0x00000000 0x02000000>; bank-width = <4>;
arch/arm/boot/dts/imx1-apf9328.dts +1 -1
@@ -45,7 +45,7 @@ &weim { pinctrl-0 = <&pinctrl_weim>; status = "okay"; - nor: nor@0,0 { + nor: flash@0,0 { compatible = "cfi-flash"; reg = <0 0x00000000 0x02000000>; bank-width = <2>;
arch/arm/boot/dts/imx27-eukrea-cpuimx27.dtsi +1 -1
@@ -90,7 +90,7 @@ &usbotg { &weim { status = "okay"; - nor: nor@0,0 { + nor: flash@0,0 { #address-cells = <1>; #size-cells = <1>; compatible = "cfi-flash";
arch/arm/boot/dts/imx27-phytec-phycore-som.dtsi +1 -1
@@ -322,7 +322,7 @@ &usbotg { &weim { status = "okay"; - nor: nor@0,0 { + nor: flash@0,0 { compatible = "cfi-flash"; reg = <0 0x00000000 0x02000000>; bank-width = <2>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 17/31 ARM: dts: imx27: Fix sram node
In reply to Sasha LevinFrom: Fabio Estevam <[email protected]>
[ Upstream commit 2fb7b2a2f06bb3f8321cf26c33e4e820c5b238b6 ]
Per sram.yaml, address-cells, size-cells and ranges are mandatory.
Pass them to fix the following dt-schema warnings:
--- arch/arm/boot/dts/imx27.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx27.dtsi +3 -0
@@ -588,6 +588,9 @@ weim: weim@d8002000 { iram: iram@ffff4c00 { compatible = "mmio-sram"; reg = <0xffff4c00 0xb400>; + ranges = <0 0xffff4c00 0xb400>; + #address-cells = <1>; + #size-cells = <1>; }; }; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 18/31 ARM: dts: imx1: Fix sram node
In reply to Sasha LevinFrom: Fabio Estevam <[email protected]>
[ Upstream commit c248e535973088ba7071ff6f26ab7951143450af ]
Per sram.yaml, address-cells, size-cells and ranges are mandatory.
The node name should be sram.
Change the node name and pass the required properties to fix the following dt-schema warnings:
imx1-apf9328.dtb: esram@300000: $nodename:0: 'esram@300000' does not match '^sram(@.*)?'
from schema $id: http://devicetree.org/schemas/sram/sram.yaml#
imx1-apf9328.dtb: esram@300000: '#address-cells' is a required property
from schema $id: http://devicetree.org/schemas/sram/sram.yaml#
imx1-apf9328.dtb: esram@300000: '#size-cells' is a required property
from schema $id: http://devicetree.org/schemas/sram/sram.yaml#
imx1-apf9328.dtb: esram@300000: 'ranges' is a required property
from schema $id: http://devicetree.org/schemas/sram/sram.yaml#
--- arch/arm/boot/dts/imx1.dtsi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/boot/dts/imx1.dtsi +4 -1
@@ -268,9 +268,12 @@ weim: weim@220000 { status = "disabled"; }; - esram: esram@300000 { + esram: sram@300000 { compatible = "mmio-sram"; reg = <0x00300000 0x20000>; + ranges = <0 0x00300000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; }; }; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 19/31 ARM: dts: imx25/27: Pass timing0
In reply to Sasha LevinFrom: Fabio Estevam <[email protected]>
[ Upstream commit 11ab7ad6f795ae23c398a4a5c56505d3dab27c4c ]
Per display-timings.yaml, the 'timing' pattern should be used to describe the display timings.
Change it accordingly to fix the following dt-schema warning:
imx27-apf27dev.dtb: display-timings: '800x480' does not match any of the regexes: '^timing', 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/display/panel/display-timings.yaml#
--- arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts | 2 +- arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-dvi-svga.dts | 2 +- arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dts | 2 +- arch/arm/boot/dts/imx25-pdk.dts | 2 +- arch/arm/boot/dts/imx27-apf27dev.dts | 2 +- arch/arm/boot/dts/imx27-eukrea-mbimxsd27-baseboard.dts | 2 +- arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts | 2 +- arch/arm/boot/dts/imx27-phytec-phycore-rdk.dts | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-)
arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts +1 -1
@@ -16,7 +16,7 @@ cmo_qvga: display { bus-width = <18>; display-timings { native-mode = <&qvga_timings>; - qvga_timings: 320x240 { + qvga_timings: timing0 { clock-frequency = <6500000>; hactive = <320>; vactive = <240>;
arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-dvi-svga.dts +1 -1
@@ -16,7 +16,7 @@ dvi_svga: display { bus-width = <18>; display-timings { native-mode = <&dvi_svga_timings>; - dvi_svga_timings: 800x600 { + dvi_svga_timings: timing0 { clock-frequency = <40000000>; hactive = <800>; vactive = <600>;
arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dts +1 -1
@@ -16,7 +16,7 @@ dvi_vga: display { bus-width = <18>; display-timings { native-mode = <&dvi_vga_timings>; - dvi_vga_timings: 640x480 { + dvi_vga_timings: timing0 { clock-frequency = <31250000>; hactive = <640>; vactive = <480>;
arch/arm/boot/dts/imx25-pdk.dts +1 -1
@@ -78,7 +78,7 @@ wvga: display { bus-width = <18>; display-timings { native-mode = <&wvga_timings>; - wvga_timings: 640x480 { + wvga_timings: timing0 { hactive = <640>; vactive = <480>; hback-porch = <45>;
arch/arm/boot/dts/imx27-apf27dev.dts +1 -1
@@ -16,7 +16,7 @@ display: display { fsl,pcr = <0xfae80083>; /* non-standard but required */ display-timings { native-mode = <&timing0>; - timing0: 800x480 { + timing0: timing0 { clock-frequency = <33000033>; hactive = <800>; vactive = <480>;
arch/arm/boot/dts/imx27-eukrea-mbimxsd27-baseboard.dts +1 -1
@@ -16,7 +16,7 @@ display0: CMO-QVGA { display-timings { native-mode = <&timing0>; - timing0: 320x240 { + timing0: timing0 { clock-frequency = <6500000>; hactive = <320>; vactive = <240>;
arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts +1 -1
@@ -19,7 +19,7 @@ display: display { fsl,pcr = <0xf0c88080>; /* non-standard but required */ display-timings { native-mode = <&timing0>; - timing0: 640x480 { + timing0: timing0 { hactive = <640>; vactive = <480>; hback-porch = <112>;
arch/arm/boot/dts/imx27-phytec-phycore-rdk.dts +1 -1
@@ -19,7 +19,7 @@ display0: LQ035Q7 { display-timings { native-mode = <&timing0>; - timing0: 240x320 { + timing0: timing0 { clock-frequency = <5500000>; hactive = <240>; vactive = <320>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 20/31 ARM: dts: imx27-apf27dev: Fix LED name
In reply to Sasha LevinFrom: Fabio Estevam <[email protected]>
[ Upstream commit dc35e253d032b959d92e12f081db5b00db26ae64 ]
Per leds-gpio.yaml, the led names should start with 'led'.
Change it to fix the following dt-schema warning:
imx27-apf27dev.dtb: leds: 'user' does not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/leds/leds-gpio.yaml#
--- arch/arm/boot/dts/imx27-apf27dev.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx27-apf27dev.dts +1 -1
@@ -47,7 +47,7 @@ leds { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_gpio_leds>; - user { + led-user { label = "Heartbeat"; gpios = <&gpio6 14 GPIO_ACTIVE_HIGH>; linux,default-trigger = "heartbeat";
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 21/31 ARM: dts: imx23-sansa: Use preferred i2c-gpios properties
In reply to Sasha LevinFrom: Fabio Estevam <[email protected]>
[ Upstream commit e3aa1a82fb20ee97597022f6528823a8ab82bde6 ]
The 'gpios' property to describe the SDA and SCL GPIOs is considered deprecated according to i2c-gpio.yaml.
Switch to the preferred 'sda-gpios' and 'scl-gpios' properties.
This fixes the following schema warnings:
imx23-sansa.dtb: i2c-0: 'sda-gpios' is a required property
from schema $id: http://devicetree.org/schemas/i2c/i2c-gpio.yaml#
imx23-sansa.dtb: i2c-0: 'scl-gpios' is a required property
from schema $id: http://devicetree.org/schemas/i2c/i2c-gpio.yaml#
--- arch/arm/boot/dts/imx23-sansa.dts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
arch/arm/boot/dts/imx23-sansa.dts +4 -8
@@ -175,10 +175,8 @@ i2c-0 { #address-cells = <1>; #size-cells = <0>; compatible = "i2c-gpio"; - gpios = < - &gpio1 24 0 /* SDA */ - &gpio1 22 0 /* SCL */ - >; + sda-gpios = <&gpio1 24 0>; + scl-gpios = <&gpio1 22 0>; i2c-gpio,delay-us = <2>; /* ~100 kHz */ };
@@ -186,10 +184,8 @@ i2c-1 { #address-cells = <1>; #size-cells = <0>; compatible = "i2c-gpio"; - gpios = < - &gpio0 31 0 /* SDA */ - &gpio0 30 0 /* SCL */ - >; + sda-gpios = <&gpio0 31 0>; + scl-gpios = <&gpio0 30 0>; i2c-gpio,delay-us = <2>; /* ~100 kHz */ touch: touch@20 {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 22/31 ARM: dts: imx23/28: Fix the DMA controller node name
In reply to Sasha LevinFrom: Fabio Estevam <[email protected]>
[ Upstream commit 858d83ca4b50bbc8693d95cc94310e6d791fb2e6 ]
Per fsl,mxs-dma.yaml, the node name should be 'dma-controller'.
Change it to fix the following dt-schema warning.
imx28-apf28.dtb: dma-apbx@80024000: $nodename:0: 'dma-apbx@80024000' does not match '^dma-controller(@.*)?$'
from schema $id: http://devicetree.org/schemas/dma/fsl,mxs-dma.yaml#
--- arch/arm/boot/dts/imx23.dtsi | 2 +- arch/arm/boot/dts/imx28.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/imx23.dtsi +1 -1
@@ -406,7 +406,7 @@ emi@80020000 { status = "disabled"; }; - dma_apbx: dma-apbx@80024000 { + dma_apbx: dma-controller@80024000 { compatible = "fsl,imx23-dma-apbx"; reg = <0x80024000 0x2000>; interrupts = <7 5 9 26
arch/arm/boot/dts/imx28.dtsi +1 -1
@@ -982,7 +982,7 @@ etm: etm@80022000 { status = "disabled"; }; - dma_apbx: dma-apbx@80024000 { + dma_apbx: dma-controller@80024000 { compatible = "fsl,imx28-dma-apbx"; reg = <0x80024000 0x2000>; interrupts = <78 79 66 0
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 23/31 block: prevent an integer overflow in bvec_try_merge_hw_page
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 3f034c374ad55773c12dd8f3c1607328e17c0072 ]
Reordered a check to avoid a possible overflow when adding len to bv_len.
--- block/bio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/bio.c +1 -1
@@ -710,7 +710,7 @@ static bool bio_try_merge_pc_page(struct request_queue *q, struct bio *bio,if ((addr1 | mask) != (addr2 | mask))return false; -if (bv->bv_len + len >queue_max_segment_size (q)) +if (len >queue_max_segment_size (q) - bv->bv_len)return false;return __bio_try_merge_page (bio, page, len, offset, same_page); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 24/31 md: Whenassemble the array, consult the superblock of the freshest device
In reply to Sasha LevinFrom: Alex Lyakas <[email protected]>
[ Upstream commit dc1cc22ed58f11d58d8553c5ec5f11cbfc3e3039 ]
Upon assembling the array, both kernel and mdadm allow the devices to have event counter difference of 1, and still consider them as up-to-date. However, a device whose event count is behind by 1, may in fact not be up-to-date, and array resync with such a device may cause data corruption.
To avoid this, consult the superblock of the freshest device about the status of a device, whose event counter is behind by 1.
--- drivers/md/md.c | 54 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 10 deletions(-)
drivers/md/md.c +44 -10
@@ -1098,6 +1098,7 @@ struct super_type {struct md_rdev *refdev, int minor_version);int (*validate_super)(struct mddev *mddev, +struct md_rdev *freshest,struct md_rdev *rdev);void (*sync_super)(struct mddev *mddev,struct md_rdev *rdev);
@@ -1236,8 +1237,9 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor/* * validate_super for 0.90.0 +* note: we are not using "freshest" for 0.9 superblock */ -static int super_90_validate (struct mddev *mddev,struct md_rdev *rdev) +static int super_90_validate (struct mddev *mddev,struct md_rdev *freshest,struct md_rdev *rdev) {mdp_disk_t *desc;mdp_super_t *sb =page_address (rdev->sb_page);
@@ -1752,7 +1754,7 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_return ret; } -static int super_1_validate (struct mddev *mddev,struct md_rdev *rdev) +static int super_1_validate (struct mddev *mddev,struct md_rdev *freshest,struct md_rdev *rdev) {struct mdp_superblock_1 *sb =page_address (rdev->sb_page);__u64 ev1 =le64_to_cpu (sb->events);
@@ -1848,13 +1850,15 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev) } }else if (mddev->pers ==NULL ) {/* Insist of good event counter while assembling, except for -* spares (which don't need an event count) */ - ++ev1; +* spares (which don't need an event count). +* Similar to mdadm, we allow event counter difference of 1 +* from the freshest device. +*/ if (rdev->desc_nr >=0 && rdev->desc_nr <le32_to_cpu (sb->max_dev) && (le16_to_cpu (sb->dev_roles[rdev->desc_nr]) <MD_DISK_ROLE_MAX ||le16_to_cpu (sb->dev_roles[rdev->desc_nr]) ==MD_DISK_ROLE_JOURNAL )) -if (ev1 < mddev->events) +if (ev1 +1 < mddev->events)return -EINVAL ; }else if (mddev->bitmap) {/* If adding to array with a bitmap, then we can accept an
@@ -1875,8 +1879,38 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev) rdev->desc_nr >= le32_to_cpu(sb->max_dev)) { role =MD_DISK_ROLE_SPARE ; rdev->desc_nr =-1 ; - } else + } else if (mddev->pers == NULL && freshest && ev1 < mddev->events) { +/* +* If we are assembling, and our event counter is smaller than the +* highest event counter, we cannot trust our superblock about the role. +* It could happen that our rdev was marked as Faulty, and all other +* superblocks were updated with +1 event counter. +* Then, before the next superblock update, which typically happens when +* remove_and_add_spares() removes the device from the array, there was +* a crash or reboot. +* If we allow current rdev without consulting the freshest superblock, +* we could cause data corruption. +* Note that in this case our event counter is smaller by 1 than the +* highest, otherwise, this rdev would not be allowed into array; +* both kernel and mdadm allow event counter difference of 1. +*/ +struct mdp_superblock_1 *freshest_sb =page_address (freshest->sb_page); +u32 freshest_max_dev =le32_to_cpu (freshest_sb->max_dev); + +if (rdev->desc_nr >= freshest_max_dev) { +/* this is unexpected, better not proceed */ +pr_warn ("md: %s: rdev[%pg]: desc_nr(%d) >= freshest(%pg)->sb->max_dev(%u)\n" , +mdname (mddev), rdev->bdev, rdev->desc_nr, + freshest->bdev, freshest_max_dev); +return -EUCLEAN ; + } + + role =le16_to_cpu (freshest_sb->dev_roles[rdev->desc_nr]); +pr_debug ("md: %s: rdev[%pg]: role=%d(0x%x) according to freshest %pg\n" , +mdname (mddev), rdev->bdev, role, role, freshest->bdev); + } else { role =le16_to_cpu (sb->dev_roles[rdev->desc_nr]); + }switch (role) {case MD_DISK_ROLE_SPARE :/* spare */ break ;
@@ -2780,7 +2814,7 @@ static int add_bound_rdev(struct md_rdev *rdev)* and should be added immediately. */ super_types[mddev->major_version]. -validate_super (mddev, rdev); +validate_super (mddev,NULL /*freshest*/ , rdev);if (add_journal)mddev_suspend (mddev); err = mddev->pers->hot_add_disk (mddev, rdev);
@@ -3690,7 +3724,7 @@ static int analyze_sbs(struct mddev *mddev) } super_types[mddev->major_version]. -validate_super (mddev, freshest); +validate_super (mddev,NULL /*freshest*/ , freshest); i =0 ;rdev_for_each_safe (rdev, tmp, mddev) {
@@ -3705,7 +3739,7 @@ static int analyze_sbs(struct mddev *mddev) }if (rdev != freshest) {if (super_types[mddev->major_version]. -validate_super (mddev, rdev)) { +validate_super (mddev, freshest, rdev)) {pr_warn ("md: kicking non-fresh %s from array!\n" ,bdevname (rdev->bdev,b));md_kick_rdev_from_array (rdev);
@@ -6610,7 +6644,7 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info) rdev->saved_raid_disk = rdev->raid_disk; }else super_types[mddev->major_version]. -validate_super (mddev, rdev); +validate_super (mddev,NULL /*freshest*/ , rdev);if ((info->state & (1 <<MD_DISK_SYNC )) && rdev->raid_disk != info->raid_disk) {/* This was a hot-add request, but events doesn't
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 25/31 arm64: dts: qcom: msm8996: Fix 'in-ports' is a required property
In reply to Sasha LevinFrom: Mao Jinlong <[email protected]>
[ Upstream commit 9a6fc510a6a3ec150cb7450aec1e5f257e6fc77b ]
Add the inport of funnel@3023000 to fix 'in-ports' is a required property warning.
--- arch/arm64/boot/dts/qcom/msm8996.dtsi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
arch/arm64/boot/dts/qcom/msm8996.dtsi +21 -0
@@ -433,6 +433,19 @@ sleep_clk: sleep_clk { }; }; + etm { + compatible = "qcom,coresight-remote-etm"; + + out-ports { + port { + modem_etm_out_funnel_in2: endpoint { + remote-endpoint = + <&funnel_in2_in_modem_etm>; + }; + }; + }; + }; + psci { compatible = "arm,psci-1.0"; method = "smc";
@@ -736,6 +749,14 @@ funnel@3023000 { clocks = <&rpmcc RPM_QDSS_CLK>, <&rpmcc RPM_QDSS_A_CLK>; clock-names = "apb_pclk", "atclk"; + in-ports { + port { + funnel_in2_in_modem_etm: endpoint { + remote-endpoint = + <&modem_etm_out_funnel_in2>; + }; + }; + }; out-ports { port {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 26/31 arm64: dts: qcom: msm8998: Fix 'out-ports' is a required property
In reply to Sasha LevinFrom: Mao Jinlong <[email protected]>
[ Upstream commit ae5ee3562a2519214b12228545e88a203dd68bbd ]
out-ports is a required property for coresight ETM. Add out-ports for ETM nodes to fix the warning.
--- arch/arm64/boot/dts/qcom/msm8998.dtsi | 32 +++++++++++++++++---------- 1 file changed, 20 insertions(+), 12 deletions(-)
arch/arm64/boot/dts/qcom/msm8998.dtsi +20 -12
@@ -1396,9 +1396,11 @@ etm5: etm@7c40000 { cpu = <&CPU4>; - port{ - etm4_out: endpoint { - remote-endpoint = <&apss_funnel_in4>; + out-ports { + port{ + etm4_out: endpoint { + remote-endpoint = <&apss_funnel_in4>; + }; }; }; };
@@ -1413,9 +1415,11 @@ etm6: etm@7d40000 { cpu = <&CPU5>; - port{ - etm5_out: endpoint { - remote-endpoint = <&apss_funnel_in5>; + out-ports { + port{ + etm5_out: endpoint { + remote-endpoint = <&apss_funnel_in5>; + }; }; }; };
@@ -1430,9 +1434,11 @@ etm7: etm@7e40000 { cpu = <&CPU6>; - port{ - etm6_out: endpoint { - remote-endpoint = <&apss_funnel_in6>; + out-ports { + port{ + etm6_out: endpoint { + remote-endpoint = <&apss_funnel_in6>; + }; }; }; };
@@ -1447,9 +1453,11 @@ etm8: etm@7f40000 { cpu = <&CPU7>; - port{ - etm7_out: endpoint { - remote-endpoint = <&apss_funnel_in7>; + out-ports { + port{ + etm7_out: endpoint { + remote-endpoint = <&apss_funnel_in7>; + }; }; }; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 27/31 wifi: rtl8xxxu: Add additional USB IDs for RTL8192EU devices
In reply to Sasha LevinFrom: Zenm Chen <[email protected]>
[ Upstream commit 4e87ca403e2008b9e182239e1abbf6876a55eb33 ]
Add additional USB IDs found in the vendor driver from
https://github.com/Mange/rtl8192eu-linux-driver to support more RTL8192EU devices.
--- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +12 -0
@@ -6362,6 +6362,18 @@ static const struct usb_device_id dev_table[] = { .driver_info = (unsigned long)&rtl8192eu_fops}, {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x818c, 0xff, 0xff, 0xff), .driver_info = (unsigned long)&rtl8192eu_fops}, +/* D-Link DWA-131 rev C1 */ +{USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x3312, 0xff, 0xff, 0xff), + .driver_info = (unsigned long)&rtl8192eu_fops}, +/* TP-Link TL-WN8200ND V2 */ +{USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x0126, 0xff, 0xff, 0xff), + .driver_info = (unsigned long)&rtl8192eu_fops}, +/* Mercusys MW300UM */ +{USB_DEVICE_AND_INTERFACE_INFO(0x2c4e, 0x0100, 0xff, 0xff, 0xff), + .driver_info = (unsigned long)&rtl8192eu_fops}, +/* Mercusys MW300UH */ +{USB_DEVICE_AND_INTERFACE_INFO(0x2c4e, 0x0104, 0xff, 0xff, 0xff), + .driver_info = (unsigned long)&rtl8192eu_fops}, #endif { } };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 28/31 libbpf: Fix NULL pointer dereference in bpf_object__collect_prog_relos
In reply to Sasha LevinFrom: Mingyi Zhang <[email protected]>
[ Upstream commit fc3a5534e2a8855427403113cbeb54af5837bbe0 ]
An issue occurred while reading an ELF file in libbpf.c during fuzzing:
Program received signal SIGSEGV, Segmentation fault.
0x0000000000958e97 in bpf_object.collect_prog_relos () at libbpf.c:4206
4206 in libbpf.c
(gdb) bt
#0 0x0000000000958e97 in bpf_object.collect_prog_relos () at libbpf.c:4206
#1 0x000000000094f9d6 in bpf_object.collect_relos () at libbpf.c:6706
#2 0x000000000092bef3 in bpf_object_open () at libbpf.c:7437
#3 0x000000000092c046 in bpf_object.open_mem () at libbpf.c:7497
#4 0x0000000000924afa in LLVMFuzzerTestOneInput () at fuzz/bpf-object-fuzzer.c:16
#5 0x000000000060be11 in testblitz_engine::fuzzer::Fuzzer::run_one ()
#6 0x000000000087ad92 in tracing::span::Span::in_scope ()
#7 0x00000000006078aa in testblitz_engine::fuzzer::util::walkdir ()
#8 0x00000000005f3217 in testblitz_engine::entrypoint::main::{{closure}} ()
#9 0x00000000005f2601 in main ()
(gdb)scn_data was null at this code(tools/lib/bpf/src/libbpf.c):
if (rel->r_offset % BPF_INSN_SZ || rel->r_offset >= scn_data->d_size) {The scn_data is derived from the code above:
scn = elf_sec_by_idx(obj, sec_idx); scn_data = elf_sec_data(obj, scn); relo_sec_name = elf_sec_str(obj, shdr->sh_name); sec_name = elf_sec_name(obj, scn); if (!relo_sec_name || !sec_name)// don't check whether scn_data is NULL return -EINVAL;
In certain special scenarios, such as reading a malformed ELF file, it is possible that scn_data may be a null pointer
--- tools/lib/bpf/libbpf.c | 2 ++ 1 file changed, 2 insertions(+)
tools/lib/bpf/libbpf.c +2 -0
@@ -1497,6 +1497,8 @@ static int bpf_object__sanitize_and_load_btf(struct bpf_object *obj)bpf_object__sanitize_btf (obj);bpf_object__sanitize_btf_ext (obj); +if (!scn_data) +return -LIBBPF_ERRNO__FORMAT ; err =btf__load (obj->btf);if (err) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 29/31 wifi: rtlwifi: add calculate_bit_shift()
In reply to Sasha LevinFrom: Su Hui <[email protected]>
[ Upstream commit 52221dfddbbfb5b4e029bb2efe9bb7da33ec1e46 ]
There are many same functions like _rtl88e_phy_calculate_bit_shift(), _rtl92c_phy_calculate_bit_shift() and so on. And these functions can cause undefined bitwise shift behavior. Add calculate_bit_shift() to replace them and fix undefined behavior in subsequent patches.
--- drivers/net/wireless/realtek/rtlwifi/wifi.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/wireless/realtek/rtlwifi/wifi.h +7 -0
@@ -3230,4 +3230,11 @@ static inline struct ieee80211_sta *rtl_find_sta(struct ieee80211_hw *hw, return ieee80211_find_sta(mac->vif, mac_addr); } +static inline u32 calculate_bit_shift (u32 bitmask) +{ +if (WARN_ON_ONCE (!bitmask)) +return 0 ; + +return __ffs (bitmask); +}#endif
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 30/31 wifi: rtlwifi: rtl8723{be,ae}: using calculate_bit_shift()
In reply to Sasha LevinFrom: Su Hui <[email protected]>
[ Upstream commit 5c16618bc06a41ad68fd8499a21d35ef57ca06c2 ]
Using calculate_bit_shift() to replace rtl8723_phy_calculate_bit_shift(). And fix an undefined bitwise shift behavior problem.
--- drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c | 6 +++--- drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c +3 -3
@@ -50,7 +50,7 @@ u32 rtl8723e_phy_query_rf_reg(struct ieee80211_hw *hw, rfpath, regaddr); } - bitshift =rtl8723_phy_calculate_bit_shift (bitmask); + bitshift =calculate_bit_shift (bitmask); readback_value = (original_value & bitmask) >> bitshift;spin_unlock_irqrestore (&rtlpriv->locks.rf_lock, flags);
@@ -82,7 +82,7 @@ void rtl8723e_phy_set_rf_reg(struct ieee80211_hw *hw, original_value =rtl8723_phy_rf_serial_read (hw, rfpath, regaddr); - bitshift =rtl8723_phy_calculate_bit_shift (bitmask); + bitshift =calculate_bit_shift (bitmask); data = ((original_value & (~bitmask)) | (data << bitshift));
@@ -91,7 +91,7 @@ void rtl8723e_phy_set_rf_reg(struct ieee80211_hw *hw,rtl8723_phy_rf_serial_write (hw, rfpath, regaddr, data); }else {if (bitmask !=RFREG_OFFSET_MASK ) { - bitshift =rtl8723_phy_calculate_bit_shift (bitmask); + bitshift =calculate_bit_shift (bitmask); data = ((original_value & (~bitmask)) | (data << bitshift));
drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c +2 -2
@@ -42,7 +42,7 @@ u32 rtl8723be_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,spin_lock_irqsave (&rtlpriv->locks.rf_lock, flags); original_value =rtl8723_phy_rf_serial_read (hw, rfpath, regaddr); - bitshift =rtl8723_phy_calculate_bit_shift (bitmask); + bitshift =calculate_bit_shift (bitmask); readback_value = (original_value & bitmask) >> bitshift;spin_unlock_irqrestore (&rtlpriv->locks.rf_lock, flags);
@@ -70,7 +70,7 @@ void rtl8723be_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path path,if (bitmask !=RFREG_OFFSET_MASK ) { original_value =rtl8723_phy_rf_serial_read (hw, path, regaddr); - bitshift =rtl8723_phy_calculate_bit_shift (bitmask); + bitshift =calculate_bit_shift (bitmask); data = ((original_value & (~bitmask)) | (data << bitshift)); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 31/31 wifi: cfg80211: free beacon_ies when overridden from hidden BSS
In reply to Sasha LevinFrom: Benjamin Berg <[email protected]>
[ Upstream commit 32af9a9e1069e55bc02741fb00ac9d0ca1a2eaef ]
This is a more of a cosmetic fix. The branch will only be taken if proberesp_ies is set, which implies that beacon_ies is not set unless we are connected to an AP that just did a channel switch. And, in that case we should have found the BSS in the internal storage to begin with.
--- net/wireless/scan.c | 4 ++++ 1 file changed, 4 insertions(+)
net/wireless/scan.c +4 -0
@@ -1294,8 +1294,12 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev,list_add (&new->hidden_list, &hidden->hidden_list); hidden->refcount++; + + ies = (void *)rcu_dereference (new->pub.beacon_ies);rcu_assign_pointer (new->pub.beacon_ies, hidden->pub.beacon_ies); +if (ies) +kfree_rcu (ies, rcu_head); } }else {/*
Signature · 1 line
2.43.0