scsi: lpfc: Fix possible file string name overflow when updating firmware
Subsystems (7)
Sasha Levin
maintainerPATCH 1/22 scsi: lpfc: Fix possible file string name overflow when updating firmware
From: 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
@@ -11428,7 +11428,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;
@@ -11437,7 +11437,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 2/22 PCI: Add no PM reset quirk for NVIDIA Spectrum devices
From: 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
@@ -3532,6 +3532,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 3/22 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
@@ -984,7 +984,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
@@ -2460,8 +2460,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 4/22 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
@@ -701,7 +701,7 @@ pwm4: pwm@30690000 { }; 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 5/22 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
@@ -1094,7 +1094,7 @@ dma_apbh: dma-apbh@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 6/22 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 7/22 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
@@ -44,7 +44,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
@@ -469,7 +469,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 ; }
@@ -485,7 +485,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 ;
@@ -509,8 +509,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); }
@@ -598,8 +599,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); }
@@ -640,7 +642,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
@@ -677,7 +677,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); } }
@@ -1337,7 +1337,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); } }
@@ -1378,7 +1378,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
@@ -102,7 +102,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
@@ -18,7 +18,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
Sasha Levin
maintainerPATCH 8/22 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
@@ -282,6 +282,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 ();
@@ -1710,11 +1715,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 9/22 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
@@ -1697,7 +1697,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 10/22 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
@@ -336,12 +336,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 11/22 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
@@ -35,7 +35,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
@@ -39,7 +39,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 12/22 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
@@ -71,7 +71,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
@@ -51,7 +51,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
@@ -96,7 +96,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
@@ -328,7 +328,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 13/22 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 14/22 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 15/22 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
@@ -53,7 +53,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 16/22 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 17/22 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
@@ -984,7 +984,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 18/22 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
@@ -1034,6 +1034,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);
@@ -1160,8 +1161,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);
@@ -1665,7 +1667,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);
@@ -1761,13 +1763,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
@@ -1788,8 +1792,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 ;
@@ -2691,7 +2725,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);
@@ -3593,7 +3627,7 @@ static void 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) {
@@ -3608,7 +3642,7 @@ static void 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);
@@ -6453,7 +6487,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 19/22 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
@@ -6366,6 +6366,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 20/22 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
@@ -3251,4 +3251,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 21/22 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
@@ -72,7 +72,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);
@@ -104,7 +104,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));
@@ -113,7 +113,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
@@ -64,7 +64,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);
@@ -92,7 +92,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 22/22 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
@@ -1018,8 +1018,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
Re: [PATCH AUTOSEL 4.19 07/22] bpf: Add map and need_defer parameters to .map_fd_put_ptr()
In reply to Sasha LevinQuoted 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.