6.15.11-rc1 review
Subsystems (7)
Greg Kroah-Hartman
maintainerPATCH 298/515 drm/amdgpu: Suspend IH during mode-2 reset
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lijo Lazar <[email protected]>
[ Upstream commit 3f1e81ecb61923934bd11c3f5c1e10893574e607 ]
On multi-aid SOCs, there could be a continuous stream of interrupts from GC after poison consumption. Suspend IH to disable them before doing mode-2 reset. This avoids conflicts in hardware accesses during interrupt handlers while a reset is ongoing.
--- drivers/gpu/drm/amd/amdgpu/aldebaran.c | 33 ++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/aldebaran.c +29 -4
@@ -71,18 +71,29 @@ aldebaran_get_reset_handler(struct amdgpu_reset_control *reset_ctl,return NULL ; } +static inline uint32_t aldebaran_get_ip_block_mask (struct amdgpu_device *adev) +{ +uint32_t ip_block_mask =BIT (AMD_IP_BLOCK_TYPE_GFX ) | +BIT (AMD_IP_BLOCK_TYPE_SDMA ); + +if (adev->aid_mask) + ip_block_mask |=BIT (AMD_IP_BLOCK_TYPE_IH ); + +return ip_block_mask; +} +static int aldebaran_mode2_suspend_ip (struct amdgpu_device *adev) { +uint32_t ip_block_mask =aldebaran_get_ip_block_mask (adev); +uint32_t ip_block;int r, i;amdgpu_device_set_pg_state (adev,AMD_PG_STATE_UNGATE );amdgpu_device_set_cg_state (adev,AMD_CG_STATE_UNGATE );for (i = adev->num_ip_blocks -1 ; i >=0 ; i--) { -if (!(adev->ip_blocks[i].version->type == -AMD_IP_BLOCK_TYPE_GFX || - adev->ip_blocks[i].version->type == -AMD_IP_BLOCK_TYPE_SDMA )) + ip_block =BIT (adev->ip_blocks[i].version->type); +if (!(ip_block_mask & ip_block))continue ; r =amdgpu_ip_block_suspend (&adev->ip_blocks[i]);
@@ -200,8 +211,10 @@ aldebaran_mode2_perform_reset(struct amdgpu_reset_control *reset_ctl,static int aldebaran_mode2_restore_ip (struct amdgpu_device *adev) {struct amdgpu_firmware_info *ucode_list[AMDGPU_UCODE_ID_MAXIMUM ]; +uint32_t ip_block_mask =aldebaran_get_ip_block_mask (adev);struct amdgpu_firmware_info *ucode;struct amdgpu_ip_block *cmn_block; +struct amdgpu_ip_block *ih_block;int ucode_count =0 ;int i, r;
@@ -243,6 +256,18 @@ static int aldebaran_mode2_restore_ip(struct amdgpu_device *adev)if (r)return r; +if (ip_block_mask &BIT (AMD_IP_BLOCK_TYPE_IH )) { + ih_block =amdgpu_device_ip_get_ip_block (adev, +AMD_IP_BLOCK_TYPE_IH ); +if (unlikely (!ih_block)) { +dev_err (adev->dev,"Failed to get IH handle\n" ); +return -EINVAL ; + } + r =amdgpu_ip_block_resume (ih_block); +if (r) +return r; + } +/* Reinit GFXHUB */ adev->gfxhub.funcs->init (adev); r = adev->gfxhub.funcs->gart_enable (adev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 299/515 drm/amdgpu: clear pa and mca record counter when resetting eeprom
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: ganglxie <[email protected]>
[ Upstream commit d0cc8d2b7df1848f98f0fea8135ba706814b1d13 ]
clear pa and mca record counter when resetting eeprom, so that ras_num_bad_pages can be calculated correctly
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +2 -0
@@ -475,6 +475,8 @@ int amdgpu_ras_eeprom_reset_table(struct amdgpu_ras_eeprom_control *control) control->ras_num_recs =0 ; control->ras_num_bad_pages =0 ; + control->ras_num_mca_recs =0 ; + control->ras_num_pa_recs =0 ; control->ras_fri =0 ;amdgpu_dpm_send_hbm_bad_pages_num (adev, control->ras_num_bad_pages);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 300/515 net: vlan: Make is_vlan_dev() a stub when VLAN is not configured
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gal Pressman <[email protected]>
[ Upstream commit 2de1ba0887e5d3bf02d7c212f380039b34e10aa3 ]
Add a stub implementation of is_vlan_dev() that returns false when VLAN support is not compiled in (CONFIG_VLAN_8021Q=n).
This allows us to compile-out VLAN-dependent dead code when it is not needed.
This also resolves the following compilation error when:
* CONFIG_VLAN_8021Q=n
* CONFIG_OBJTOOL=y
* CONFIG_OBJTOOL_WERROR=y
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.o: error: objtool: parse_mirred.isra.0+0x370: mlx5e_tc_act_vlan_add_push_action() missing __noreturn in .c/.h or NORETURN() in noreturns.h
The error occurs because objtool cannot determine that unreachable BUG() (which doesn't return) calls in VLAN code paths are actually dead code when VLAN support is disabled.
--- include/linux/if_vlan.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
include/linux/if_vlan.h +10 -5
@@ -79,11 +79,6 @@ static inline struct vlan_ethhdr *skb_vlan_eth_hdr(const struct sk_buff *skb)/* found in socket.c */ extern void vlan_ioctl_set (int (*hook)(struct net *,void __user *)); -static inline bool is_vlan_dev (const struct net_device *dev) -{ -return dev->priv_flags &IFF_802_1Q_VLAN ; -} -#define skb_vlan_tag_present (__skb) (!!(__skb)->vlan_all)#define skb_vlan_tag_get (__skb) ((__skb)->vlan_tci)#define skb_vlan_tag_get_id (__skb) ((__skb)->vlan_tci & VLAN_VID_MASK)
@@ -200,6 +195,11 @@ struct vlan_dev_priv {#endif }; +static inline bool is_vlan_dev (const struct net_device *dev) +{ +return dev->priv_flags &IFF_802_1Q_VLAN ; +} +static inline struct vlan_dev_priv *vlan_dev_priv (const struct net_device *dev) {return netdev_priv (dev);
@@ -237,6 +237,11 @@ extern void vlan_vids_del_by_dev(struct net_device *dev,extern bool vlan_uses_dev (const struct net_device *dev);#else +static inline bool is_vlan_dev (const struct net_device *dev) +{ +return false; +} +static inline struct net_device *__vlan_find_dev_deep_rcu (struct net_device *real_dev,__be16 vlan_proto,u16 vlan_id)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 301/515 net: vlan: Replace BUG() with WARN_ON_ONCE() in vlan_dev_* stubs
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gal Pressman <[email protected]>
[ Upstream commit 60a8b1a5d0824afda869f18dc0ecfe72f8dfda42 ]
When CONFIG_VLAN_8021Q=n, a set of stub helpers are used, three of these helpers use BUG() unconditionally.
This code should not be reached, as callers of these functions should always check for is_vlan_dev() first, but the usage of BUG() is not recommended, replace it with WARN_ON() instead.
--- include/linux/if_vlan.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/linux/if_vlan.h +3 -3
@@ -259,19 +259,19 @@ vlan_for_each(struct net_device *dev,static inline struct net_device *vlan_dev_real_dev (const struct net_device *dev) { -BUG (); +WARN_ON_ONCE (1 );return NULL ; }static inline u16 vlan_dev_vlan_id (const struct net_device *dev) { -BUG (); +WARN_ON_ONCE (1 );return 0 ; }static inline __be16 vlan_dev_vlan_proto (const struct net_device *dev) { -BUG (); +WARN_ON_ONCE (1 );return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 302/515 gve: Return error for unknown admin queue command
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alok Tiwari <[email protected]>
[ Upstream commit b11344f63fdd9e8c5121148a6965b41079071dd2 ]
In gve_adminq_issue_cmd(), return -EINVAL instead of 0 when an unknown admin queue command opcode is encountered.
This prevents the function from silently succeeding on invalid input and prevents undefined behavior by ensuring the function fails gracefully when an unrecognized opcode is provided.
These changes improve error handling.
--- drivers/net/ethernet/google/gve/gve_adminq.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/google/gve/gve_adminq.c +1 -0
@@ -564,6 +564,7 @@ static int gve_adminq_issue_cmd(struct gve_priv *priv,break ;default :dev_err (&priv->pdev->dev,"unknown AQ command opcode %d\n" , opcode); +return -EINVAL ; }return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 303/515 net: dsa: b53: ensure BCM5325 PHYs are enabled
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Álvaro Fernández Rojas <[email protected]>
[ Upstream commit 966a83df36c6f27476ac3501771422e7852098bc ]
According to the datasheet, BCM5325 uses B53_PD_MODE_CTRL_25 register to disable clocking to individual PHYs.
Only ports 1-4 can be enabled or disabled and the datasheet is explicit about not toggling BIT(0) since it disables the PLL power and the switch.
--- drivers/net/dsa/b53/b53_common.c | 13 +++++++++++++ drivers/net/dsa/b53/b53_regs.h | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-)
drivers/net/dsa/b53/b53_common.c +13 -0
@@ -615,6 +615,19 @@ int b53_setup_port(struct dsa_switch *ds, int port)if (dsa_is_user_port (ds, port))b53_set_eap_mode (dev, port,EAP_MODE_SIMPLIFIED ); +if (is5325 (dev) && +in_range (port,1 ,4 )) { +u8 reg; + +b53_read8 (dev,B53_CTRL_PAGE ,B53_PD_MODE_CTRL_25 , ®); + reg &= ~PD_MODE_POWER_DOWN_PORT (0 ); +if (dsa_is_unused_port (ds, port)) + reg |=PD_MODE_POWER_DOWN_PORT (port); +else + reg &= ~PD_MODE_POWER_DOWN_PORT (port); +b53_write8 (dev,B53_CTRL_PAGE ,B53_PD_MODE_CTRL_25 , reg); + } +return 0 ; }EXPORT_SYMBOL (b53_setup_port);
drivers/net/dsa/b53/b53_regs.h +4 -1
@@ -101,8 +101,11 @@#define PORT_OVERRIDE_SPEED_2000M BIT(6)/* BCM5301X only, requires setting 1000M */ #define PORT_OVERRIDE_EN BIT(7)/* Use the register contents */ -/* Power-down mode control */ +/* Power-down mode control (8 bit) */ #define B53_PD_MODE_CTRL_25 0x0f +#define PD_MODE_PORT_MASK 0x1f +/* Bit 0 also powers down the switch. */ +#define PD_MODE_POWER_DOWN_PORT (i) BIT(i)/* IP Multicast control (8 bit) */ #define B53_IP_MULTICAST_CTRL 0x21
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 304/515 net: dsa: b53: fix b53_imp_vlan_setup for BCM5325
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Álvaro Fernández Rojas <[email protected]>
[ Upstream commit c00df1018791185ea398f78af415a2a0aaa0c79c ]
CPU port should be B53_CPU_PORT instead of B53_CPU_PORT_25 for B53_PVLAN_PORT_MASK register.
--- drivers/net/dsa/b53/b53_common.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/dsa/b53/b53_common.c +4 -0
@@ -529,6 +529,10 @@ void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)unsigned int i;u16 pvlan; +/* BCM5325 CPU port is at 8 */ +if ((is5325 (dev) ||is5365 (dev)) && cpu_port ==B53_CPU_PORT_25 ) + cpu_port =B53_CPU_PORT ; +/* Enable the IMP port to be in the same VLAN as the other ports * on a per-port basis such that we only have Port i and IMP in * the same VLAN.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 305/515 net: dsa: b53: prevent GMII_PORT_OVERRIDE_CTRL access on BCM5325
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Álvaro Fernández Rojas <[email protected]>
[ Upstream commit 37883bbc45a8555d6eca88d3a9730504d2dac86c ]
BCM5325 doesn't implement GMII_PORT_OVERRIDE_CTRL register so we should avoid reading or writing it.PORT_OVERRIDE_RX_FLOW and PORT_OVERRIDE_TX_FLOW aren't defined on BCM5325 and we should use PORT_OVERRIDE_LP_FLOW_25 instead.
--- drivers/net/dsa/b53/b53_common.c | 21 +++++++++++++++++---- drivers/net/dsa/b53/b53_regs.h | 1 + 2 files changed, 18 insertions(+), 4 deletions(-)
drivers/net/dsa/b53/b53_common.c +17 -4
@@ -1274,6 +1274,8 @@ static void b53_force_link(struct b53_device *dev, int port, int link)if (port == dev->imp_port) { off =B53_PORT_OVERRIDE_CTRL ; val =PORT_OVERRIDE_EN ; + }else if (is5325 (dev)) { +return ; }else { off =B53_GMII_PORT_OVERRIDE_CTRL (port); val =GMII_PO_EN ;
@@ -1298,6 +1300,8 @@ static void b53_force_port_config(struct b53_device *dev, int port,if (port == dev->imp_port) { off =B53_PORT_OVERRIDE_CTRL ; val =PORT_OVERRIDE_EN ; + }else if (is5325 (dev)) { +return ; }else { off =B53_GMII_PORT_OVERRIDE_CTRL (port); val =GMII_PO_EN ;
@@ -1328,10 +1332,19 @@ static void b53_force_port_config(struct b53_device *dev, int port,return ; } -if (rx_pause) - reg |=PORT_OVERRIDE_RX_FLOW ; -if (tx_pause) - reg |=PORT_OVERRIDE_TX_FLOW ; +if (rx_pause) { +if (is5325 (dev)) + reg |=PORT_OVERRIDE_LP_FLOW_25 ; +else + reg |=PORT_OVERRIDE_RX_FLOW ; + } + +if (tx_pause) { +if (is5325 (dev)) + reg |=PORT_OVERRIDE_LP_FLOW_25 ; +else + reg |=PORT_OVERRIDE_TX_FLOW ; + }b53_write8 (dev,B53_CTRL_PAGE , off, reg); }
drivers/net/dsa/b53/b53_regs.h +1 -0
@@ -95,6 +95,7 @@#define PORT_OVERRIDE_SPEED_10M (0 << PORT_OVERRIDE_SPEED_S)#define PORT_OVERRIDE_SPEED_100M (1 << PORT_OVERRIDE_SPEED_S)#define PORT_OVERRIDE_SPEED_1000M (2 << PORT_OVERRIDE_SPEED_S) +#define PORT_OVERRIDE_LP_FLOW_25 BIT(3)/* BCM5325 only */ #define PORT_OVERRIDE_RV_MII_25 BIT(4)/* BCM5325 only */ #define PORT_OVERRIDE_RX_FLOW BIT(4)#define PORT_OVERRIDE_TX_FLOW BIT(5)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 306/515 net: dsa: b53: prevent DIS_LEARNING access on BCM5325
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Álvaro Fernández Rojas <[email protected]>
[ Upstream commit 800728abd9f83bda4de62a30ce62a8b41c242020 ]
BCM5325 doesn't implement DIS_LEARNING register so we should avoid reading or writing it.
--- drivers/net/dsa/b53/b53_common.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/dsa/b53/b53_common.c +10 -1
@@ -583,6 +583,9 @@ static void b53_port_set_learning(struct b53_device *dev, int port, {u16 reg; +if (is5325 (dev)) +return ; +b53_read16 (dev,B53_CTRL_PAGE ,B53_DIS_LEARNING , ®);if (learning) reg &= ~BIT (port);
@@ -2195,7 +2198,13 @@ int b53_br_flags_pre(struct dsa_switch *ds, int port,struct switchdev_brport_flags flags, struct netlink_ext_ack *extack) { -if (flags.mask & ~(BR_FLOOD |BR_MCAST_FLOOD |BR_LEARNING )) + struct b53_device *dev = ds->priv; +unsigned long mask = (BR_FLOOD |BR_MCAST_FLOOD ); + +if (!is5325 (dev)) + mask |=BR_LEARNING ; + +if (flags.mask & ~mask)return -EINVAL ;return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 307/515 net: dsa: b53: prevent SWITCH_CTRL access on BCM5325
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Álvaro Fernández Rojas <[email protected]>
[ Upstream commit 22ccaaca43440e90a3b68d2183045b42247dc4be ]
BCM5325 doesn't implement SWITCH_CTRL register so we should avoid reading or writing it.
--- drivers/net/dsa/b53/b53_common.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/dsa/b53/b53_common.c +6 -5
@@ -361,11 +361,12 @@ static void b53_set_forwarding(struct b53_device *dev, int enable)b53_write8 (dev,B53_CTRL_PAGE ,B53_SWITCH_MODE , mgmt); -/* Include IMP port in dumb forwarding mode -*/ -b53_read8 (dev,B53_CTRL_PAGE ,B53_SWITCH_CTRL , &mgmt); - mgmt |=B53_MII_DUMB_FWDG_EN ; -b53_write8 (dev,B53_CTRL_PAGE ,B53_SWITCH_CTRL , mgmt); +if (!is5325 (dev)) { +/* Include IMP port in dumb forwarding mode */ +b53_read8 (dev,B53_CTRL_PAGE ,B53_SWITCH_CTRL , &mgmt); + mgmt |=B53_MII_DUMB_FWDG_EN ; +b53_write8 (dev,B53_CTRL_PAGE ,B53_SWITCH_CTRL , mgmt); + }/* Look at B53_UC_FWD_EN and B53_MC_FWD_EN to decide whether * frames should be flooded or not.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 308/515 bpftool: Fix JSON writer resource leak in version command
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Chen <[email protected]>
[ Upstream commit 85cd83fed8267cde0dd1cea719808aad95ae4de7 ]
When using bpftool --version -j/-p, the JSON writer object created in do_version() was not properly destroyed after use. This caused a memory leak each time the version command was executed with JSON output.
Fix: 004b45c0e51a (tools: bpftool: provide JSON output for all possible commands)
--- tools/bpf/bpftool/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/bpf/bpftool/main.c +3 -3
@@ -534,9 +534,9 @@ int main(int argc, char **argv)usage ();if (version_requested) -return do_version (argc, argv); - - ret =cmd_select (commands, argc, argv, do_help); + ret =do_version (argc, argv); +else + ret =cmd_select (commands, argc, argv, do_help);if (json_output)jsonw_destroy (&json_wtr);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 309/515 ptp: Use ratelimite for freerun error message
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit e9a7795e75b78b56997fb0070c18d6e1057b6462 ]
Replace pr_err() with pr_err_ratelimited() in ptp_clock_settime() to prevent log flooding when the physical clock is free running, which happens on some of my hosts. This ensures error messages are rate-limited and improves kernel log readability.
--- drivers/ptp/ptp_clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ptp/ptp_clock.c +1 -1
@@ -96,7 +96,7 @@ static int ptp_clock_settime(struct posix_clock *pc, const struct timespec64 *tp struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);if (ptp_clock_freerun (ptp)) { -pr_err ("ptp: physical clock is free running\n" ); +pr_err_ratelimited ("ptp: physical clock is free running\n" );return -EBUSY ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 310/515 wifi: rtw89: scan abort when assign/unassign_vif
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chih-Kang Chang <[email protected]>
[ Upstream commit 3db8563bac6c34018cbb96b14549a95c368b0304 ]
If scan happen during start_ap, the register which control TX might be turned off during scan. Additionally, if set_channel occurs during scan will backup this register and set to firmware after set_channel done. When scan complete, firmware will also set TX by this register, causing TX to be disabled and beacon can't be TX. Therefore, in assign/unassign_vif call scan abort before set_channel to avoid scan racing with set_channel.
--- drivers/net/wireless/realtek/rtw89/chan.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/realtek/rtw89/chan.c +6 -0
@@ -2680,6 +2680,9 @@ int rtw89_chanctx_ops_assign_vif(struct rtw89_dev *rtwdev, rtwvif_link->chanctx_assigned = true; cfg->ref_count++; +if (rtwdev->scanning) +rtw89_hw_scan_abort (rtwdev, rtwdev->scan_info.scanning_vif); +if (list_empty (&rtwvif->mgnt_entry))list_add_tail (&rtwvif->mgnt_entry, &mgnt->active_list);
@@ -2719,6 +2722,9 @@ void rtw89_chanctx_ops_unassign_vif(struct rtw89_dev *rtwdev, rtwvif_link->chanctx_assigned = false; cfg->ref_count--; +if (rtwdev->scanning) +rtw89_hw_scan_abort (rtwdev, rtwdev->scan_info.scanning_vif); +if (!rtw89_vif_is_active_role (rtwvif))list_del_init (&rtwvif->mgnt_entry);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 311/515 wifi: rtlwifi: fix possible skb memory leak in _rtl_pci_init_one_rxdesc()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
[ Upstream commit 76b3e5078d76f0eeadb7aacf9845399f8473da0d ]
When dma_mapping_error() is true, if a new skb has been allocated, then it must be de-allocated.
Compile tested only
--- drivers/net/wireless/realtek/rtlwifi/pci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/pci.c +4 -1
@@ -572,8 +572,11 @@ static int _rtl_pci_init_one_rxdesc(struct ieee80211_hw *hw,dma_map_single (&rtlpci->pdev->dev,skb_tail_pointer (skb), rtlpci->rxbuffersize,DMA_FROM_DEVICE ); bufferaddress = *((dma_addr_t *)skb->cb); -if (dma_mapping_error (&rtlpci->pdev->dev, bufferaddress)) +if (dma_mapping_error (&rtlpci->pdev->dev, bufferaddress)) { +if (!new_skb) +kfree_skb (skb);return 0 ; + } rtlpci->rx_ring[rxring_idx].rx_buf[desc_idx] = skb;if (rtlpriv->use_new_trx_flow) {/* skb->cb may be 64 bit address */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 312/515 ionic: clean dbpage in de-init
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shannon Nelson <[email protected]>
[ Upstream commit c9080abea1e69b8b1408ec7dec0acdfdc577a3e2 ]
Since the kern_dbpage gets set up in ionic_lif_init() and that function's error path will clean it if needed, the kern_dbpage on teardown should be cleaned in ionic_lif_deinit(), not in ionic_lif_free(). As it is currently we get a double call to iounmap() on kern_dbpage if the PCI ionic fails setting up the lif. One example of this is when firmware isn't responding to AdminQ requests and ionic's first AdminQ call fails to setup the NotifyQ.
--- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +3 -4
@@ -3526,10 +3526,6 @@ void ionic_lif_free(struct ionic_lif *lif) lif->info =NULL ; lif->info_pa =0 ; -/* unmap doorbell page */ -ionic_bus_unmap_dbpage (lif->ionic, lif->kern_dbpage); - lif->kern_dbpage =NULL ; -mutex_destroy (&lif->config_lock);mutex_destroy (&lif->queue_lock);
@@ -3555,6 +3551,9 @@ void ionic_lif_deinit(struct ionic_lif *lif)ionic_lif_qcq_deinit (lif, lif->notifyqcq);ionic_lif_qcq_deinit (lif, lif->adminqcq); +ionic_bus_unmap_dbpage (lif->ionic, lif->kern_dbpage); + lif->kern_dbpage =NULL ; +ionic_lif_reset (lif); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 313/515 drm/xe: Make dma-fences compliant with the safe access rules
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tvrtko Ursulin <[email protected]>
[ Upstream commit 6bd90e700b4285e6a7541e00f969cab0d696adde ]
Xe can free some of the data pointed to by the dma-fences it exports. Most notably the timeline name can get freed if userspace closes the associated submit queue. At the same time the fence could have been exported to a third party (for example a sync_fence fd) which will then cause an use- after-free on subsequent access.
To make this safe we need to make the driver compliant with the newly documented dma-fence rules. Driver has to ensure a RCU grace period between signalling a fence and freeing any data pointed to by said fence.
For the timeline name we simply make the queue be freed via kfree_rcu and for the shared lock associated with multiple queues we add a RCU grace period before freeing the per GT structure holding the lock.
--- drivers/gpu/drm/xe/xe_guc_exec_queue_types.h | 2 ++ drivers/gpu/drm/xe/xe_guc_submit.c | 7 ++++++- drivers/gpu/drm/xe/xe_hw_fence.c | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_guc_exec_queue_types.h +2 -0
@@ -20,6 +20,8 @@ struct xe_exec_queue;struct xe_guc_exec_queue {/** @q: Backpointer to parent xe_exec_queue */ struct xe_exec_queue *q; +/** @rcu: For safe freeing of exported dma fences */ +struct rcu_head rcu;/** @sched: GPU scheduler for this xe_exec_queue */ struct xe_gpu_scheduler sched;/** @entity: Scheduler entity for this xe_exec_queue */
drivers/gpu/drm/xe/xe_guc_submit.c +6 -1
@@ -1282,7 +1282,11 @@ static void __guc_exec_queue_fini_async(struct work_struct *w)xe_sched_entity_fini (&ge->entity);xe_sched_fini (&ge->sched); -kfree (ge); +/* +* RCU free due sched being exported via DRM scheduler fences +* (timeline name). +*/ +kfree_rcu (ge, rcu);xe_exec_queue_fini (q);xe_pm_runtime_put (guc_to_xe (guc)); }
@@ -1465,6 +1469,7 @@ static int guc_exec_queue_init(struct xe_exec_queue *q) q->guc = ge; ge->q = q; +init_rcu_head (&ge->rcu);init_waitqueue_head (&ge->suspend_wait);for (i =0 ; i <MAX_STATIC_MSG_TYPE ; ++i)
drivers/gpu/drm/xe/xe_hw_fence.c +3 -0
@@ -100,6 +100,9 @@ void xe_hw_fence_irq_finish(struct xe_hw_fence_irq *irq)spin_unlock_irqrestore (&irq->lock, flags);dma_fence_end_signalling (tmp); } + +/* Safe release of the irq->lock used in dma_fence_init. */ +synchronize_rcu (); }void xe_hw_fence_irq_run (struct xe_hw_fence_irq *irq)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 314/515 net: ncsi: Fix buffer overflow in fetching version id
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hari Kalavakunta <[email protected]>
[ Upstream commit 8e16170ae972c7fed132bc928914a2ffb94690fc ]
In NC-SI spec v1.2 section 8.4.44.2, the firmware name doesn't need to be null terminated while its size occupies the full size of the field. Fix the buffer overflow issue by adding one additional byte for null terminator.
--- net/ncsi/internal.h | 2 +- net/ncsi/ncsi-rsp.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
net/ncsi/internal.h +1 -1
@@ -110,7 +110,7 @@ struct ncsi_channel_version {u8 update;/* NCSI version update */ char alpha1;/* NCSI version alpha1 */ char alpha2;/* NCSI version alpha2 */ -u8 fw_name[12 ];/* Firmware name string */ +u8 fw_name[12 +1 ];/* Firmware name string */ u32 fw_version;/* Firmware version */ u16 pci_ids[4 ];/* PCI identification */ u32 mf_id;/* Manufacture ID */
net/ncsi/ncsi-rsp.c +1 -0
@@ -775,6 +775,7 @@ static int ncsi_rsp_handler_gvi(struct ncsi_request *nr) ncv->alpha1 = rsp->alpha1; ncv->alpha2 = rsp->alpha2;memcpy (ncv->fw_name, rsp->fw_name,12 ); + ncv->fw_name[12 ] ='\0' ; ncv->fw_version =ntohl (rsp->fw_version);for (i =0 ; i <ARRAY_SIZE (ncv->pci_ids); i++) ncv->pci_ids[i] =ntohs (rsp->pci_ids[i]);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 315/515 drm: renesas: rz-du: mipi_dsi: Add min check for VCLK range
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit e37a95d01d5acce211da8446fefbd8684c67f516 ]
The VCLK range for Renesas RZ/G2L SoC is 5.803 MHz to 148.5 MHz. Add a minimum clock check in the mode_valid callback to ensure that the clock value does not fall below the valid range.
--- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +3 -0
@@ -584,6 +584,9 @@ rzg2l_mipi_dsi_bridge_mode_valid(struct drm_bridge *bridge,if (mode->clock >148500 )return MODE_CLOCK_HIGH ; +if (mode->clock <5803 ) +return MODE_CLOCK_LOW ; +return MODE_OK ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 316/515 drm/ttm: Should to return the evict error
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emily Deng <[email protected]>
[ Upstream commit 4e16a9a00239db5d819197b9a00f70665951bf50 ]
For the evict fail case, the evict error should be returned.
v2: Consider ENOENT case.
v3: Abort directly when the eviction failed for some reason (except for -ENOENT)
and not wait for the move to finish
--- drivers/gpu/drm/ttm/ttm_resource.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/ttm/ttm_resource.c +3 -0
@@ -558,6 +558,9 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev,cond_resched (); }while (!ret); +if (ret && ret != -ENOENT ) +return ret; +spin_lock (&man->move_lock); fence =dma_fence_get (man->move);spin_unlock (&man->move_lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 317/515 uapi: in6: restore visibility of most IPv6 socket options
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 31557b3487b349464daf42bc4366153743c1e727 ]
A decade ago commit 6d08acd2d32e ("in6: fix conflict with glibc") hid the definitions of IPV6 options, because GCC was complaining about duplicates. The commit did not list the warnings seen, but trying to recreate them now I think they are (building iproute2):
In file included from ./include/uapi/rdma/rdma_user_cm.h:39,
from rdma.h:16,
from res.h:9,
from res-ctx.c:7:
../include/uapi/linux/in6.h:171:9: warning: ‘IPV6_ADD_MEMBERSHIP’ redefined
171 | #define IPV6_ADD_MEMBERSHIP 20
| ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/netinet/in.h:37,
from rdma.h:13:
/usr/include/bits/in.h:233:10: note: this is the location of the previous definition
233 | # define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
| ^~~~~~~~~~~~~~~~~~~
../include/uapi/linux/in6.h:172:9: warning: ‘IPV6_DROP_MEMBERSHIP’ redefined
172 | #define IPV6_DROP_MEMBERSHIP 21
| ^~~~~~~~~~~~~~~~~~~~
/usr/include/bits/in.h:234:10: note: this is the location of the previous definition
234 | # define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
| ^~~~~~~~~~~~~~~~~~~~Compilers don't complain about redefinition if the defines are identical, but here we have the kernel using the literal value, and glibc using an indirection (defining to a name of another define, with the same numerical value).
Problem is, the commit in question hid all the IPV6 socket options, and glibc has a pretty sparse list. For instance it lacks Flow Label related options. Willem called this out in commit 3fb321fde22d ("selftests/net: ipv6 flowlabel"):
/* uapi/glibc weirdness may leave this undefined */ #ifndef IPV6_FLOWINFO #define IPV6_FLOWINFO 11 #endif
More interestingly some applications (socat) use a #ifdef IPV6_FLOWINFO to gate compilation of thier rudimentary flow label support. (For added confusion socat misspells it as IPV4_FLOWINFO in some places.)
Hide only the two defines we know glibc has a problem with. If we discover more warnings we can hide more but we should avoid covering the entire block of defines for "IPV6 socket options".
--- include/uapi/linux/in6.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/linux/in6.h +2 -2
@@ -152,7 +152,6 @@ struct in6_flowlabel_req {/* * IPV6 socket options */ -#if __UAPI_DEF_IPV6_OPTIONS#define IPV6_ADDRFORM 1#define IPV6_2292PKTINFO 2#define IPV6_2292HOPOPTS 3
@@ -169,8 +168,10 @@ struct in6_flowlabel_req {#define IPV6_MULTICAST_IF 17#define IPV6_MULTICAST_HOPS 18#define IPV6_MULTICAST_LOOP 19 +#if __UAPI_DEF_IPV6_OPTIONS#define IPV6_ADD_MEMBERSHIP 20#define IPV6_DROP_MEMBERSHIP 21 +#endif #define IPV6_ROUTER_ALERT 22#define IPV6_MTU_DISCOVER 23#define IPV6_MTU 24
@@ -203,7 +204,6 @@ struct in6_flowlabel_req {#define IPV6_IPSEC_POLICY 34#define IPV6_XFRM_POLICY 35#define IPV6_HDRINCL 36 -#endif /* * Multicast:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 318/515 bpf: Make reg_not_null() true for CONST_PTR_TO_MAP
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ihor Solodrai <[email protected]>
[ Upstream commit 5534e58f2e9bd72b253d033ee0af6e68eb8ac96b ]
When reg->type is CONST_PTR_TO_MAP, it can not be null. However the verifier explores the branches under rX == 0 in check_cond_jmp_op() even if reg->type is CONST_PTR_TO_MAP, because it was not checked for in reg_not_null().
Fix this by adding CONST_PTR_TO_MAP to the set of types that are considered non nullable in reg_not_null().
An old "unpriv: cmp map pointer with zero" selftest fails with this change, because now early out correctly triggers in check_cond_jmp_op(), making the verification to pass.
In practice verifier may allow pointer to null comparison in unpriv, since in many cases the relevant branch and comparison op are removed as dead code. So change the expected test result to __success_unpriv.
--- kernel/bpf/verifier.c | 3 ++- tools/testing/selftests/bpf/progs/verifier_unpriv.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
kernel/bpf/verifier.c +2 -1
@@ -404,7 +404,8 @@ static bool reg_not_null(const struct bpf_reg_state *reg) type ==PTR_TO_MAP_KEY || type ==PTR_TO_SOCK_COMMON || (type ==PTR_TO_BTF_ID &&is_trusted_reg (reg)) || - type ==PTR_TO_MEM ; + type ==PTR_TO_MEM || + type ==CONST_PTR_TO_MAP ; }static struct btf_record *reg_btf_record (const struct bpf_reg_state *reg)
tools/testing/selftests/bpf/progs/verifier_unpriv.c +1 -1
@@ -619,7 +619,7 @@ __naked void pass_pointer_to_tail_call(void) SEC("socket") __description("unpriv: cmp map pointer with zero") -__success __failure_unpriv __msg_unpriv("R1 pointer comparison") +__success __success_unpriv __retval(0) __naked void cmp_map_pointer_with_zero(void) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 319/515 selftests/bpf: Fix ringbuf/ringbuf_write test failure with arm64 64KB page size
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonghong Song <[email protected]>
[ Upstream commit 8c8c5e3c854a2593ec90dacd868f3066b67de1c4 ]
The ringbuf max_entries must be PAGE_ALIGNED. See kernel function ringbuf_map_alloc(). So for arm64 64KB page size, adjust max_entries and other related metrics properly.
--- tools/testing/selftests/bpf/prog_tests/ringbuf.c | 4 ++-- tools/testing/selftests/bpf/progs/test_ringbuf_write.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/bpf/prog_tests/ringbuf.c +2 -2
@@ -97,7 +97,7 @@ static void ringbuf_write_subtest(void)if (!ASSERT_OK_PTR (skel,"skel_open" ))return ; - skel->maps.ringbuf.max_entries =0x4000 ; + skel->maps.ringbuf.max_entries =0x40000 ; err =test_ringbuf_write_lskel__load (skel);if (!ASSERT_OK (err,"skel_load" ))
@@ -108,7 +108,7 @@ static void ringbuf_write_subtest(void) mmap_ptr =mmap (NULL , page_size,PROT_READ |PROT_WRITE ,MAP_SHARED , rb_fd,0 );if (!ASSERT_OK_PTR (mmap_ptr,"rw_cons_pos" )) goto cleanup; - *mmap_ptr =0x3000 ; + *mmap_ptr =0x30000 ;ASSERT_OK (munmap (mmap_ptr, page_size),"unmap_rw" ); skel->bss->pid =getpid ();
tools/testing/selftests/bpf/progs/test_ringbuf_write.c +2 -2
@@ -26,11 +26,11 @@ int test_ringbuf_write(void *ctx)if (cur_pid != pid)return 0 ; - sample1 =bpf_ringbuf_reserve (&ringbuf,0x3000 ,0 ); + sample1 =bpf_ringbuf_reserve (&ringbuf,0x30000 ,0 );if (!sample1)return 0 ;/* first one can pass */ - sample2 =bpf_ringbuf_reserve (&ringbuf,0x3000 ,0 ); + sample2 =bpf_ringbuf_reserve (&ringbuf,0x30000 ,0 );if (!sample2) {bpf_ringbuf_discard (sample1,0 );__sync_fetch_and_add (&discarded,1 );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 320/515 selftests/bpf: Fix a user_ringbuf failure with arm64 64KB page size
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonghong Song <[email protected]>
[ Upstream commit bbc7bd658ddc662083639b9e9a280b90225ecd9a ]
The ringbuf max_entries must be PAGE_ALIGNED. See kernel function ringbuf_map_alloc(). So for arm64 64KB page size, adjust max_entries properly.
--- tools/testing/selftests/bpf/prog_tests/user_ringbuf.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/prog_tests/user_ringbuf.c +7 -3
@@ -21,8 +21,7 @@#include "../progs/test_user_ringbuf.h" static const long c_sample_size =sizeof (struct sample ) +BPF_RINGBUF_HDR_SZ ; -static const long c_ringbuf_size =1 <<12 ;/* 1 small page */ -static const long c_max_entries = c_ringbuf_size / c_sample_size; +static long c_ringbuf_size, c_max_entries;static void drain_current_samples (void ) {
@@ -424,7 +423,9 @@ static void test_user_ringbuf_loop(void)uint32_t remaining_samples = total_samples;int err; -BUILD_BUG_ON (total_samples <= c_max_entries); +if (!ASSERT_LT (c_max_entries, total_samples,"compare_c_max_entries" )) +return ; + err =load_skel_create_user_ringbuf (&skel, &ringbuf);if (err)return ;
@@ -686,6 +687,9 @@ void test_user_ringbuf(void) {int i; + c_ringbuf_size =getpagesize ();/* 1 page */ + c_max_entries = c_ringbuf_size / c_sample_size; +for (i =0 ; i <ARRAY_SIZE (success_tests); i++) {if (!test__start_subtest (success_tests[i].test_name))continue ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 321/515 drm/amd/display: Update DMCUB loading sequence for DCN3.5
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Kazlauskas <[email protected]>
[ Upstream commit d42b2331e158fa6bcdc89e4c8c470dc5da20be1f ]
[Why]
New sequence from HW for reset and firmware reloading has been provided that aims to stabilize the reload sequence in the case the firmware is hung or has outstanding requests.
[How]
Update the sequence to remove the DMUIF reset and the redundant writes in the release.
--- .../gpu/drm/amd/display/dmub/src/dmub_dcn35.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn35.c +3 -13
@@ -92,19 +92,15 @@ void dmub_dcn35_reset(struct dmub_srv *dmub)uint32_t in_reset, is_enabled, scratch, i, pwait_mode;REG_GET (DMCUB_CNTL2 ,DMCUB_SOFT_RESET , &in_reset); +REG_GET (DMCUB_CNTL ,DMCUB_ENABLE , &is_enabled); -if (in_reset ==0 ) { +if (in_reset ==0 && is_enabled !=0 ) { cmd.bits.status =1 ; cmd.bits.command_code =DMUB_GPINT__STOP_FW ; cmd.bits.param =0 ; dmub->hw_funcs.set_gpint (dmub, cmd); -/** -* Timeout covers both the ACK and the wait -* for remaining work to finish. -*/ -for (i =0 ; i < timeout; ++i) {if (dmub->hw_funcs.is_gpint_acked (dmub, cmd))break ;
@@ -130,11 +126,9 @@ void dmub_dcn35_reset(struct dmub_srv *dmub)/* Force reset in case we timed out, DMCUB is likely hung. */ } -REG_GET (DMCUB_CNTL ,DMCUB_ENABLE , &is_enabled); -if (is_enabled) {REG_UPDATE (DMCUB_CNTL2 ,DMCUB_SOFT_RESET ,1 ); -REG_UPDATE (MMHUBBUB_SOFT_RESET ,DMUIF_SOFT_RESET ,1 ); +udelay (1 );REG_UPDATE (DMCUB_CNTL ,DMCUB_ENABLE ,0 ); }
@@ -160,11 +154,7 @@ void dmub_dcn35_reset_release(struct dmub_srv *dmub)LONO_SOCCLK_GATE_DISABLE ,1 , LONO_DMCUBCLK_GATE_DISABLE, 1); -REG_UPDATE (MMHUBBUB_SOFT_RESET ,DMUIF_SOFT_RESET ,1 ); -udelay (1 );REG_UPDATE_2 (DMCUB_CNTL ,DMCUB_ENABLE ,1 ,DMCUB_TRACEPORT_EN ,1 ); -REG_UPDATE (DMCUB_CNTL2 ,DMCUB_SOFT_RESET ,1 ); -udelay (1 );REG_UPDATE (MMHUBBUB_SOFT_RESET ,DMUIF_SOFT_RESET ,0 );REG_UPDATE (DMCUB_CNTL2 ,DMCUB_SOFT_RESET ,0 ); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 322/515 drm/amd/display: Avoid trying AUX transactions on disconnected ports
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wayne Lin <[email protected]>
[ Upstream commit deb24e64c8881c462b29e2c69afd9e6669058be5 ]
[Why & How]
Observe that we try to access DPCD 0x600h of disconnected DP ports. In order not to wasting time on retrying these ports, call dpcd_write_rx_power_ctrl() after checking its connection status.
--- drivers/gpu/drm/amd/display/dc/link/link_dpms.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/link/link_dpms.c +2 -1
@@ -140,7 +140,8 @@ void link_blank_dp_stream(struct dc_link *link, bool hw_init) } } -if ((!link->wa_flags.dp_keep_receiver_powered) || hw_init) +if (((!link->wa_flags.dp_keep_receiver_powered) || hw_init) && + (link->type != dc_connection_none))dpcd_write_rx_power_ctrl (link, false); } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 323/515 drm/ttm: Respect the shrinker core free target
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tvrtko Ursulin <[email protected]>
[ Upstream commit eac21f8ebeb4f84d703cf41dc3f81d16fa9dc00a ]
Currently the TTM shrinker aborts shrinking as soon as it frees pages from any of the page order pools and by doing so it can fail to respect the freeing target which was configured by the shrinker core.
We use the wording "can fail" because the number of freed pages will depend on the presence of pages in the pools and the order of the pools on the LRU list. For example if there are no free pages in the high order pools the shrinker core may require multiple passes over the TTM shrinker before it will free the default target of 128 pages (assuming there are free pages in the low order pools). This inefficiency can be compounded by the pool LRU where multiple further calls into the TTM shrinker are required to end up looking at the pool with pages.
Improve this by never freeing less than the shrinker core has requested.
At the same time we start reporting the number of scanned pages (freed in this case), which prevents the core shrinker from giving up on the TTM shrinker too soon and moving on.
v2:
* Simplify loop logic. (Christian)
* Improve commit message.
--- drivers/gpu/drm/ttm/ttm_pool.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/ttm/ttm_pool.c +5 -3
@@ -1132,7 +1132,6 @@ void ttm_pool_fini(struct ttm_pool *pool) }EXPORT_SYMBOL (ttm_pool_fini); -/* As long as pages are available make sure to release at least one */ static unsigned long ttm_pool_shrinker_scan (struct shrinker *shrink,struct shrink_control *sc) {
@@ -1140,9 +1139,12 @@ static unsigned long ttm_pool_shrinker_scan(struct shrinker *shrink,do num_freed +=ttm_pool_shrink (); -while (!num_freed &&atomic_long_read (&allocated_pages)); +while (num_freed < sc->nr_to_scan && +atomic_long_read (&allocated_pages)); -return num_freed; + sc->nr_scanned = num_freed; + +return num_freed ?:SHRINK_STOP ; }/* Return the number of pages available or SHRINK_EMPTY if we have none */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 324/515 rcu: Fix rcu_read_unlock() deadloop due to IRQ work
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joel Fernandes <[email protected]>
[ Upstream commit b41642c87716bbd09797b1e4ea7d904f06c39b7b ]
During rcu_read_unlock_special(), if this happens during irq_exit(), we can lockup if an IPI is issued. This is because the IPI itself triggers the irq_exit() path causing a recursive lock up.
This is precisely what Xiongfeng found when invoking a BPF program on the trace_tick_stop() tracepoint As shown in the trace below. Fix by managing the irq_work state correctly.
irq_exit()
__irq_exit_rcu()
/* in_hardirq() returns false after this */
preempt_count_sub(HARDIRQ_OFFSET)
tick_irq_exit()
tick_nohz_irq_exit()
tick_nohz_stop_sched_tick()
trace_tick_stop() /* a bpf prog is hooked on this trace point */
__bpf_trace_tick_stop()
bpf_trace_run2()
rcu_read_unlock_special()
/* will send a IPI to itself */
irq_work_queue_on(&rdp->defer_qs_iw, rdp->cpu);A simple reproducer can also be obtained by doing the following in tick_irq_exit(). It will hang on boot without the patch:
static inline void tick_irq_exit(void)
{
+ rcu_read_lock();
+ WRITE_ONCE(current->rcu_read_unlock_special.b.need_qs, true);
+ rcu_read_unlock();
+
--- kernel/rcu/tree.h | 13 ++++++++++++- kernel/rcu/tree_plugin.h | 37 ++++++++++++++++++++++++++----------- 2 files changed, 38 insertions(+), 12 deletions(-)
kernel/rcu/tree.h +12 -1
@@ -174,6 +174,17 @@ struct rcu_snap_record {unsigned long jiffies;/* Track jiffies value */ }; +/* +* An IRQ work (deferred_qs_iw) is used by RCU to get the scheduler's attention. +* to report quiescent states at the soonest possible time. +* The request can be in one of the following states: +* - DEFER_QS_IDLE: An IRQ work is yet to be scheduled. +* - DEFER_QS_PENDING: An IRQ work was scheduled but either not yet run, or it +* ran and we still haven't reported a quiescent state. +*/ +#define DEFER_QS_IDLE 0 +#define DEFER_QS_PENDING 1 +/* Per-CPU data for read-copy update. */ struct rcu_data {/* 1) quiescent-state and grace-period handling : */
@@ -191,7 +202,7 @@ struct rcu_data {/* during and after the last grace */ /* period it is aware of. */ struct irq_work defer_qs_iw;/* Obtain later scheduler attention. */ -bool defer_qs_iw_pending;/* Scheduler attention pending? */ +int defer_qs_iw_pending;/* Scheduler attention pending? */ struct work_struct strict_work;/* Schedule readers for strict GPs. */ /* 2) batch handling */
kernel/rcu/tree_plugin.h +26 -11
@@ -486,13 +486,16 @@ rcu_preempt_deferred_qs_irqrestore(struct task_struct *t, unsigned long flags)struct rcu_node *rnp;union rcu_special special; + rdp =this_cpu_ptr (&rcu_data); +if (rdp->defer_qs_iw_pending ==DEFER_QS_PENDING ) + rdp->defer_qs_iw_pending =DEFER_QS_IDLE ; +/* * If RCU core is waiting for this CPU to exit its critical section, * report the fact that it has exited. Because irqs are disabled, * t->rcu_read_unlock_special cannot change. */ special = t->rcu_read_unlock_special; - rdp =this_cpu_ptr (&rcu_data);if (!special.s && !rdp->cpu_no_qs.b.exp) {local_irq_restore (flags);return ;
@@ -629,7 +632,23 @@ static void rcu_preempt_deferred_qs_handler(struct irq_work *iwp) rdp = container_of(iwp, struct rcu_data, defer_qs_iw);local_irq_save (flags); - rdp->defer_qs_iw_pending = false; + +/* +* If the IRQ work handler happens to run in the middle of RCU read-side +* critical section, it could be ineffective in getting the scheduler's +* attention to report a deferred quiescent state (the whole point of the +* IRQ work). For this reason, requeue the IRQ work. +* +* Basically, we want to avoid following situation: +* 1. rcu_read_unlock() queues IRQ work (state -> DEFER_QS_PENDING) +* 2. CPU enters new rcu_read_lock() +* 3. IRQ work runs but cannot report QS due to rcu_preempt_depth() > 0 +* 4. rcu_read_unlock() does not re-queue work (state still PENDING) +* 5. Deferred QS reporting does not happen. +*/ +if (rcu_preempt_depth () >0 ) +WRITE_ONCE (rdp->defer_qs_iw_pending,DEFER_QS_IDLE ); +local_irq_restore (flags); }
@@ -676,17 +695,13 @@ static void rcu_read_unlock_special(struct task_struct *t)set_tsk_need_resched (current);set_preempt_need_resched ();if (IS_ENABLED (CONFIG_IRQ_WORK ) && irqs_were_disabled && - expboost && !rdp->defer_qs_iw_pending &&cpu_online (rdp->cpu)) { + expboost && rdp->defer_qs_iw_pending !=DEFER_QS_PENDING && +cpu_online (rdp->cpu)) {// Get scheduler to re-evaluate and call hooks. // If !IRQ_WORK, FQS scan will eventually IPI. -if (IS_ENABLED (CONFIG_RCU_STRICT_GRACE_PERIOD ) && -IS_ENABLED (CONFIG_PREEMPT_RT )) - rdp->defer_qs_iw =IRQ_WORK_INIT_HARD ( - rcu_preempt_deferred_qs_handler); -else -init_irq_work (&rdp->defer_qs_iw, - rcu_preempt_deferred_qs_handler); - rdp->defer_qs_iw_pending = true; + rdp->defer_qs_iw = +IRQ_WORK_INIT_HARD (rcu_preempt_deferred_qs_handler); + rdp->defer_qs_iw_pending =DEFER_QS_PENDING ;irq_work_queue_on (&rdp->defer_qs_iw, rdp->cpu); } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 325/515 net: dsa: b53: fix IP_MULTICAST_CTRL on BCM5325
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Álvaro Fernández Rojas <[email protected]>
[ Upstream commit 044d5ce2788b165798bfd173548e61bf7b6baf4d ]
BCM5325 doesn't implement B53_UC_FWD_EN, B53_MC_FWD_EN or B53_IPMC_FWD_EN.
--- drivers/net/dsa/b53/b53_common.c | 18 +++++++++++------- drivers/net/dsa/b53/b53_regs.h | 1 + 2 files changed, 12 insertions(+), 7 deletions(-)
drivers/net/dsa/b53/b53_common.c +11 -7
@@ -366,14 +366,18 @@ static void b53_set_forwarding(struct b53_device *dev, int enable)b53_read8 (dev,B53_CTRL_PAGE ,B53_SWITCH_CTRL , &mgmt); mgmt |=B53_MII_DUMB_FWDG_EN ;b53_write8 (dev,B53_CTRL_PAGE ,B53_SWITCH_CTRL , mgmt); - } -/* Look at B53_UC_FWD_EN and B53_MC_FWD_EN to decide whether -* frames should be flooded or not. -*/ -b53_read8 (dev,B53_CTRL_PAGE ,B53_IP_MULTICAST_CTRL , &mgmt); - mgmt |=B53_UC_FWD_EN |B53_MC_FWD_EN |B53_IPMC_FWD_EN ; -b53_write8 (dev,B53_CTRL_PAGE ,B53_IP_MULTICAST_CTRL , mgmt); +/* Look at B53_UC_FWD_EN and B53_MC_FWD_EN to decide whether +* frames should be flooded or not. +*/ +b53_read8 (dev,B53_CTRL_PAGE ,B53_IP_MULTICAST_CTRL , &mgmt); + mgmt |=B53_UC_FWD_EN |B53_MC_FWD_EN |B53_IPMC_FWD_EN ; +b53_write8 (dev,B53_CTRL_PAGE ,B53_IP_MULTICAST_CTRL , mgmt); + }else { +b53_read8 (dev,B53_CTRL_PAGE ,B53_IP_MULTICAST_CTRL , &mgmt); + mgmt |=B53_IP_MCAST_25 ; +b53_write8 (dev,B53_CTRL_PAGE ,B53_IP_MULTICAST_CTRL , mgmt); + } } static void b53_enable_vlan(struct b53_device *dev, int port, bool enable,
drivers/net/dsa/b53/b53_regs.h +1 -0
@@ -110,6 +110,7 @@/* IP Multicast control (8 bit) */ #define B53_IP_MULTICAST_CTRL 0x21 +#define B53_IP_MCAST_25 BIT(0)#define B53_IPMC_FWD_EN BIT(1)#define B53_UC_FWD_EN BIT(6)#define B53_MC_FWD_EN BIT(7)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 326/515 vsock/virtio: Resize receive buffers so that each SKB fits in a 4K page
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
[ Upstream commit 03a92f036a04fed2b00d69f5f46f1a486e70dc5c ]
When allocating receive buffers for the vsock virtio RX virtqueue, an SKB is allocated with a 4140 data payload (the 44-byte packet header + VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE). Even when factoring in the SKB overhead, the resulting 8KiB allocation thanks to the rounding in kmalloc_reserve() is wasteful (~3700 unusable bytes) and results in a higher-order page allocation on systems with 4KiB pages just for the sake of a few hundred bytes of packet data.
Limit the vsock virtio RX buffers to 4KiB per SKB, resulting in much better memory utilisation and removing the need to allocate higher-order pages entirely.
Message-Id: <[email protected]>
--- include/linux/virtio_vsock.h | 7 ++++++- net/vmw_vsock/virtio_transport.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-)
include/linux/virtio_vsock.h +6 -1
@@ -111,7 +111,12 @@ static inline size_t virtio_vsock_skb_len(struct sk_buff *skb)return (size_t )(skb_end_pointer (skb) - skb->head); } -#define VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE (1024 * 4) +/* Dimension the RX SKB so that the entire thing fits exactly into +* a single 4KiB page. This avoids wasting memory due to alloc_skb() +* rounding up to the next page order and also means that we +* don't leave higher-order pages sitting around in the RX queue. +*/ +#define VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE SKB_WITH_OVERHEAD(1024 * 4)#define VIRTIO_VSOCK_MAX_BUF_SIZE 0xFFFFFFFFUL#define VIRTIO_VSOCK_MAX_PKT_BUF_SIZE (1024 * 64)
net/vmw_vsock/virtio_transport.c +1 -1
@@ -307,7 +307,7 @@ virtio_transport_cancel_pkt(struct vsock_sock *vsk)static void virtio_vsock_rx_fill (struct virtio_vsock *vsock) { -int total_len =VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE +VIRTIO_VSOCK_SKB_HEADROOM ; +int total_len =VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE ;struct scatterlist pkt, *p;struct virtqueue *vq;struct sk_buff *skb;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 327/515 vhost: fail early when __vhost_add_used() fails
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Wang <[email protected]>
[ Upstream commit b4ba1207d45adaafa2982c035898b36af2d3e518 ]
This patch fails vhost_add_used_n() early when __vhost_add_used() fails to make sure used idx is not updated with stale used ring information.
Message-Id: <[email protected]>
--- drivers/vhost/vhost.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/vhost/vhost.c +3 -0
@@ -2971,6 +2971,9 @@ int vhost_add_used_n(struct vhost_virtqueue *vq, struct vring_used_elem *heads, } r =__vhost_add_used_n (vq, heads, count); +if (r <0 ) +return r; +/* Make sure buffer is written before we update index. */ smp_wmb ();if (vhost_put_used_idx (vq)) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 328/515 drm/amd/display: Only finalize atomic_obj if it was initialized
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit b174084b3fe15ad1acc69530e673c1535d2e4f85 ]
[Why]
If amdgpu_dm failed to initalize before amdgpu_dm_initialize_drm_device() completed then freeing atomic_obj will lead to list corruption.
[How]
Check if atomic_obj state is initialized before trying to free.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
@@ -5309,7 +5309,8 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)static void amdgpu_dm_destroy_drm_device (struct amdgpu_display_manager *dm) { -drm_atomic_private_obj_fini (&dm->atomic_obj); +if (dm->atomic_obj.state) +drm_atomic_private_obj_fini (&dm->atomic_obj); }/******************************************************************************
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 329/515 drm/amd/display: Avoid configuring PSR granularity if PSR-SU not supported
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit a5ce8695d6d1b40d6960d2d298b579042c158f25 ]
[Why]
If PSR-SU is disabled on the link, then configuring su_y granularity in mod_power_calc_psr_configs() can lead to assertions in psr_su_set_dsc_slice_height().
[How]
Check the PSR version in amdgpu_dm_link_setup_psr() to determine whether or not to configure granularity.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +4 -2
@@ -127,8 +127,10 @@ bool amdgpu_dm_link_setup_psr(struct dc_stream_state *stream) psr_config.allow_multi_disp_optimizations = (amdgpu_dc_feature_mask &DC_PSR_ALLOW_MULTI_DISP_OPT ); -if (!psr_su_set_dsc_slice_height (dc, link, stream, &psr_config)) -return false; +if (link->psr_settings.psr_version ==DC_PSR_VERSION_SU_1 ) { +if (!psr_su_set_dsc_slice_height (dc, link, stream, &psr_config)) +return false; + } ret =dc_link_setup_psr (link, stream, &psr_config, &psr_context);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 330/515 drm/amd/display: Disable dsc_power_gate for dcn314 by default
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roman Li <[email protected]>
[ Upstream commit 02f3ec53177243d32ee8b6f8ba99136d7887ee3a ]
[Why]
"REG_WAIT timeout 1us * 1000 tries - dcn314_dsc_pg_control line" warnings seen after resuming from s2idle.
DCN314 has issues with DSC power gating that cause REG_WAIT timeouts when attempting to power down DSC blocks.
[How]
Disable dsc_power_gate for dcn314 by default.
--- drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c +1 -0
@@ -926,6 +926,7 @@ static const struct dc_debug_options debug_defaults_drv = { .seamless_boot_odm_combine = true, .enable_legacy_fast_update = true, .using_dml2 = false, + .disable_dsc_power_gate = true, };static const struct dc_panel_config panel_config_defaults = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 331/515 watchdog: sbsa: Adjust keepalive timeout to avoid MediaTek WS0 race condition
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Plattner <[email protected]>
[ Upstream commit 48defdf6b083f74a44e1f742db284960d3444aec ]
The MediaTek implementation of the sbsa_gwdt watchdog has a race condition where a write to SBSA_GWDT_WRR is ignored if it occurs while the hardware is processing a timeout refresh that asserts WS0.
Detect this based on the hardware implementer and adjust wdd->min_hw_heartbeat_ms to avoid the race by forcing the keepalive ping to be one second later.
--- drivers/watchdog/sbsa_gwdt.c | 50 +++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-)
drivers/watchdog/sbsa_gwdt.c +47 -3
@@ -75,11 +75,17 @@#define SBSA_GWDT_VERSION_MASK 0xF#define SBSA_GWDT_VERSION_SHIFT 16 +#define SBSA_GWDT_IMPL_MASK 0x7FF +#define SBSA_GWDT_IMPL_SHIFT 0 +#define SBSA_GWDT_IMPL_MEDIATEK 0x426 +/** * struct sbsa_gwdt - Internal representation of the SBSA GWDT * @wdd: kernel watchdog_device structure * @clk: store the System Counter clock frequency, in Hz. * @version: store the architecture version +* @need_ws0_race_workaround: +* indicate whether to adjust wdd->timeout to avoid a race with WS0 * @refresh_base: Virtual address of the watchdog refresh frame * @control_base: Virtual address of the watchdog control frame */
@@ -87,6 +93,7 @@ struct sbsa_gwdt {struct watchdog_device wdd;u32 clk;int version; +bool need_ws0_race_workaround;void __iomem *refresh_base;void __iomem *control_base; };
@@ -161,6 +168,31 @@ static int sbsa_gwdt_set_timeout(struct watchdog_device *wdd,*/ sbsa_gwdt_reg_write (((u64 )gwdt->clk /2 ) * timeout, gwdt); +/* +* Some watchdog hardware has a race condition where it will ignore +* sbsa_gwdt_keepalive() if it is called at the exact moment that a +* timeout occurs and WS0 is being asserted. Unfortunately, the default +* behavior of the watchdog core is very likely to trigger this race +* when action=0 because it programs WOR to be half of the desired +* timeout, and watchdog_next_keepalive() chooses the exact same time to +* send keepalive pings. +* +* This triggers a race where sbsa_gwdt_keepalive() can be called right +* as WS0 is being asserted, and affected hardware will ignore that +* write and continue to assert WS0. After another (timeout / 2) +* seconds, the same race happens again. If the driver wins then the +* explicit refresh will reset WS0 to false but if the hardware wins, +* then WS1 is asserted and the system resets. +* +* Avoid the problem by scheduling keepalive heartbeats one second later +* than the WOR timeout. +* +* This workaround might not be needed in a future revision of the +* hardware. +*/ +if (gwdt->need_ws0_race_workaround) + wdd->min_hw_heartbeat_ms = timeout *500 +1000 ; +return 0 ; }
@@ -202,12 +234,15 @@ static int sbsa_gwdt_keepalive(struct watchdog_device *wdd)static void sbsa_gwdt_get_version (struct watchdog_device *wdd) {struct sbsa_gwdt *gwdt =watchdog_get_drvdata (wdd); -int ver; +int iidr, ver, impl; - ver =readl (gwdt->control_base +SBSA_GWDT_W_IIDR ); - ver = (ver >>SBSA_GWDT_VERSION_SHIFT ) &SBSA_GWDT_VERSION_MASK ; + iidr =readl (gwdt->control_base +SBSA_GWDT_W_IIDR ); + ver = (iidr >>SBSA_GWDT_VERSION_SHIFT ) &SBSA_GWDT_VERSION_MASK ; + impl = (iidr >>SBSA_GWDT_IMPL_SHIFT ) &SBSA_GWDT_IMPL_MASK ; gwdt->version = ver; + gwdt->need_ws0_race_workaround = + !action && (impl ==SBSA_GWDT_IMPL_MEDIATEK ); }static int sbsa_gwdt_start (struct watchdog_device *wdd)
@@ -299,6 +334,15 @@ static int sbsa_gwdt_probe(struct platform_device *pdev)else wdd->max_hw_heartbeat_ms =GENMASK_ULL (47 ,0 ) / gwdt->clk *1000 ; +if (gwdt->need_ws0_race_workaround) { +/* +* A timeout of 3 seconds means that WOR will be set to 1.5 +* seconds and the heartbeat will be scheduled every 2.5 +* seconds. +*/ + wdd->min_timeout =3 ; + } + status =readl (cf_base +SBSA_GWDT_WCS );if (status &SBSA_GWDT_WCS_WS1 ) {dev_warn (dev,"System reset by WDT.\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 332/515 cifs: Fix calling CIFSFindFirst() for root path without msearch
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pali Rohár <[email protected]>
[ Upstream commit b460249b9a1dab7a9f58483e5349d045ad6d585c ]
To query root path (without msearch wildcard) it is needed to send pattern '\' instead of '' (empty string).
This allows to use CIFSFindFirst() to query information about root path which is being used in followup changes.
This change fixes the stat() syscall called on the root path on the mount. It is because stat() syscall uses the cifs_query_path_info() function and it can fallback to the CIFSFindFirst() usage with msearch=false.
--- fs/smb/client/cifssmb.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/smb/client/cifssmb.c +10 -0
@@ -4000,6 +4000,12 @@ CIFSFindFirst(const unsigned int xid, struct cifs_tcon *tcon, pSMB->FileName[name_len] =0 ; pSMB->FileName[name_len+1 ] =0 ; name_len +=2 ; + }else if (!searchName[0 ]) { + pSMB->FileName[0 ] =CIFS_DIR_SEP (cifs_sb); + pSMB->FileName[1 ] =0 ; + pSMB->FileName[2 ] =0 ; + pSMB->FileName[3 ] =0 ; + name_len =4 ; } }else { name_len =copy_path_name (pSMB->FileName, searchName);
@@ -4011,6 +4017,10 @@ CIFSFindFirst(const unsigned int xid, struct cifs_tcon *tcon, pSMB->FileName[name_len] ='*' ; pSMB->FileName[name_len+1 ] =0 ; name_len +=2 ; + }else if (!searchName[0 ]) { + pSMB->FileName[0 ] =CIFS_DIR_SEP (cifs_sb); + pSMB->FileName[1 ] =0 ; + name_len =2 ; } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 333/515 smb: client: fix session setup against servers that require SPN
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <[email protected]>
[ Upstream commit 33cfdd726381828b9907a61c038a9f48b6690a31 ]
Some servers might enforce the SPN to be set in the target info blob (AV pairs) when sending NTLMSSP_AUTH message. In Windows Server, this could be enforced with SmbServerNameHardeningLevel set to 2.
Fix this by always appending SPN (cifs/<hostname>) to the existing list of target infos when setting up NTLMv2 response blob.
--- fs/smb/client/cifsencrypt.c | 79 ++++++++++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 18 deletions(-)
fs/smb/client/cifsencrypt.c +61 -18
@@ -532,17 +532,67 @@ CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash, struct shash_return rc; } +/* +* Set up NTLMv2 response blob with SPN (cifs/<hostname>) appended to the +* existing list of AV pairs. +*/ +static int set_auth_key_response (struct cifs_ses *ses) +{ +size_t baselen =CIFS_SESS_KEY_SIZE +sizeof (struct ntlmv2_resp ); +size_t len, spnlen, tilen =0 , num_avs =2 /* SPN + EOL */ ; +struct TCP_Server_Info *server = ses->server; + char *spn __free(kfree) = NULL; +struct ntlmssp2_name *av; +char *rsp =NULL ; +int rc; + + spnlen =strlen (server->hostname); + len =sizeof ("cifs/" ) + spnlen; + spn =kmalloc (len,GFP_KERNEL ); +if (!spn) { + rc = -ENOMEM ; + goto out; + } + + spnlen =scnprintf (spn, len,"cifs/%.*s" , + (int )spnlen, server->hostname); + +av_for_each_entry (ses, av) + tilen +=sizeof (*av) +AV_LEN (av); + + len = baselen + tilen + spnlen *sizeof (__le16) + num_avs *sizeof (*av); + rsp =kmalloc (len,GFP_KERNEL ); +if (!rsp) { + rc = -ENOMEM ; + goto out; + } + +memcpy (rsp + baselen, ses->auth_key.response, tilen); + av = (void *)(rsp + baselen + tilen); + av->type =cpu_to_le16 (NTLMSSP_AV_TARGET_NAME ); + av->length =cpu_to_le16 (spnlen *sizeof (__le16)); +cifs_strtoUTF16 ((__le16 *)av->data, spn, spnlen, ses->local_nls); + av = (void *)((__u8 *)av +sizeof (*av) +AV_LEN (av)); + av->type =cpu_to_le16 (NTLMSSP_AV_EOL ); + av->length =0 ; + + rc =0 ; + ses->auth_key.len = len; +out: + ses->auth_key.response = rsp; +return rc; +} +int setup_ntlmv2_rsp (struct cifs_ses *ses,const struct nls_table *nls_cp) {struct shash_desc *hmacmd5 =NULL ; -int rc; -int baselen; -unsigned int tilen; +unsigned char *tiblob =NULL ;/* target info blob */ struct ntlmv2_resp *ntlmv2;char ntlmv2_hash[16 ]; -unsigned char *tiblob =NULL ;/* target info blob */ __le64 rsp_timestamp; +__u64 cc; +int rc;if (nls_cp ==NULL ) {cifs_dbg (VFS ,"%s called with nls_cp==NULL\n" , __func__);
@@ -588,32 +638,25 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp)* (as Windows 7 does) */ rsp_timestamp =find_timestamp (ses); +get_random_bytes (&cc,sizeof (cc)); - baselen =CIFS_SESS_KEY_SIZE +sizeof (struct ntlmv2_resp ); - tilen = ses->auth_key.len; - tiblob = ses->auth_key.response; +cifs_server_lock (ses->server); - ses->auth_key.response =kmalloc (baselen + tilen,GFP_KERNEL ); -if (!ses->auth_key.response) { - rc = -ENOMEM ; + tiblob = ses->auth_key.response; + rc =set_auth_key_response (ses); +if (rc) { ses->auth_key.len =0 ; - goto setup_ntlmv2_rsp_ret; + goto unlock; } - ses->auth_key.len += baselen; ntlmv2 = (struct ntlmv2_resp *) (ses->auth_key.response +CIFS_SESS_KEY_SIZE ); ntlmv2->blob_signature =cpu_to_le32 (0x00000101 ); ntlmv2->reserved =0 ; ntlmv2->time = rsp_timestamp; - -get_random_bytes (&ntlmv2->client_chal,sizeof (ntlmv2->client_chal)); + ntlmv2->client_chal = cc; ntlmv2->reserved2 =0 ; -memcpy (ses->auth_key.response + baselen, tiblob, tilen); - -cifs_server_lock (ses->server); - rc =cifs_alloc_hash ("hmac(md5)" , &hmacmd5);if (rc) {cifs_dbg (VFS ,"Could not allocate HMAC-MD5, rc=%d\n" , rc);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 334/515 fbdev: fix potential buffer overflow in do_register_framebuffer()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yongzhen Zhang <[email protected]>
[ Upstream commit 523b84dc7ccea9c4d79126d6ed1cf9033cf83b05 ]
The current implementation may lead to buffer overflow when:
1. Unregistration creates NULL gaps in registered_fb[] 2. All array slots become occupied despite num_registered_fb < FB_MAX 3. The registration loop exceeds array bounds
Add boundary check to prevent registered_fb[FB_MAX] access.
--- drivers/video/fbdev/core/fbmem.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/video/fbdev/core/fbmem.c +3 -0
@@ -403,6 +403,9 @@ static int do_register_framebuffer(struct fb_info *fb_info)if (!registered_fb[i])break ; +if (i >=FB_MAX ) +return -ENXIO ; +if (!fb_info->modelist.prev || !fb_info->modelist.next)INIT_LIST_HEAD (&fb_info->modelist);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 335/515 crypto: hisilicon/hpre - fix dma unmap sequence
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhiqi Song <[email protected]>
[ Upstream commit 982fd1a74de63c388c060e4fa6f7fbd088d6d02e ]
Perform DMA unmapping operations before processing data. Otherwise, there may be unsynchronized data accessed by the CPU when the SWIOTLB is enabled.
--- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/crypto/hisilicon/hpre/hpre_crypto.c +6 -2
@@ -1491,11 +1491,13 @@ static void hpre_ecdh_cb(struct hpre_ctx *ctx, void *resp)if (overtime_thrhld &&hpre_is_bd_timeout (req, overtime_thrhld))atomic64_inc (&dfx[HPRE_OVER_THRHLD_CNT ].value); +/* Do unmap before data processing */ +hpre_ecdh_hw_data_clr_all (ctx, req, areq->dst, areq->src); + p =sg_virt (areq->dst);memmove (p, p + ctx->key_sz - curve_sz, curve_sz);memmove (p + curve_sz, p + areq->dst_len - curve_sz, curve_sz); -hpre_ecdh_hw_data_clr_all (ctx, req, areq->dst, areq->src);kpp_request_complete (areq, ret);atomic64_inc (&dfx[HPRE_RECV_CNT ].value);
@@ -1808,9 +1810,11 @@ static void hpre_curve25519_cb(struct hpre_ctx *ctx, void *resp)if (overtime_thrhld &&hpre_is_bd_timeout (req, overtime_thrhld))atomic64_inc (&dfx[HPRE_OVER_THRHLD_CNT ].value); +/* Do unmap before data processing */ +hpre_curve25519_hw_data_clr_all (ctx, req, areq->dst, areq->src); +hpre_key_to_big_end (sg_virt (areq->dst),CURVE25519_KEY_SIZE ); -hpre_curve25519_hw_data_clr_all (ctx, req, areq->dst, areq->src);kpp_request_complete (areq, ret);atomic64_inc (&dfx[HPRE_RECV_CNT ].value);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 336/515 ext4: do not BUG when INLINE_DATA_FL lacks system.data xattr
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
[ Upstream commit 099b847ccc6c1ad2f805d13cfbcc83f5b6d4bc42 ]
A syzbot fuzzed image triggered a BUG_ON in ext4_update_inline_data() when an inode had the INLINE_DATA_FL flag set but was missing the system.data extended attribute.
Since this can happen due to a maiciouly fuzzed file system, we shouldn't BUG, but rather, report it as a corrupted file system.
Add similar replacements of BUG_ON with EXT4_ERROR_INODE() ii ext4_create_inline_data() and ext4_inline_data_truncate().
--- fs/ext4/inline.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
fs/ext4/inline.c +16 -3
@@ -303,7 +303,11 @@ static int ext4_create_inline_data(handle_t *handle,if (error) goto out; -BUG_ON (!is.s.not_found); +if (!is.s.not_found) { +EXT4_ERROR_INODE (inode,"unexpected inline data xattr" ); + error = -EFSCORRUPTED ; + goto out; + } error =ext4_xattr_ibody_set (handle, inode, &i, &is);if (error) {
@@ -354,7 +358,11 @@ static int ext4_update_inline_data(handle_t *handle, struct inode *inode,if (error) goto out; -BUG_ON (is.s.not_found); +if (is.s.not_found) { +EXT4_ERROR_INODE (inode,"missing inline data xattr" ); + error = -EFSCORRUPTED ; + goto out; + } len -=EXT4_MIN_INLINE_DATA_SIZE ; value =kzalloc (len,GFP_NOFS );
@@ -1904,7 +1912,12 @@ int ext4_inline_data_truncate(struct inode *inode, int *has_inline)if ((err =ext4_xattr_ibody_find (inode, &i, &is)) !=0 ) goto out_error; -BUG_ON (is.s.not_found); +if (is.s.not_found) { +EXT4_ERROR_INODE (inode, +"missing inline data xattr" ); + err = -EFSCORRUPTED ; + goto out_error; + } value_len =le32_to_cpu (is.s.here->e_value_size); value =kmalloc (value_len,GFP_NOFS );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 337/515 clk: tegra: periph: Fix error handling and resolve unsigned compare warning
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pei Xiao <[email protected]>
[ Upstream commit 2dc2ca9000eea2eb749f658196204cb84d4306f7 ]
./drivers/clk/tegra/clk-periph.c:59:5-9: WARNING:
Unsigned expression compared with zero: rate < 0
The unsigned long 'rate' variable caused:
- Incorrect handling of negative errors
- Compile warning: "Unsigned expression compared with zero"
Fix by changing to long type and adding req->rate cast.
--- drivers/clk/tegra/clk-periph.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/tegra/clk-periph.c +2 -2
@@ -51,7 +51,7 @@ static int clk_periph_determine_rate(struct clk_hw *hw,struct tegra_clk_periph *periph =to_clk_periph (hw);const struct clk_ops *div_ops = periph->div_ops;struct clk_hw *div_hw = &periph->divider.hw; -unsigned long rate; +long rate;__clk_hw_set_clk (div_hw, hw);
@@ -59,7 +59,7 @@ static int clk_periph_determine_rate(struct clk_hw *hw,if (rate <0 )return rate; - req->rate = rate; + req->rate = (unsigned long )rate;return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 338/515 sphinx: kernel_abi: fix performance regression with O=<dir>
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 2b16b71a05a7f056221751b906c13f8809656b1f ]
The logic there which adds a dependency note to Sphinx cache is not taking into account that the build dir may not be the source dir. This causes a performance regression:
$ time make O=/tmp/foo SPHINXDIRS=admin-guide htmldocs
[OUTDATED]
Added: set()
Changed: {'abi-obsolete', 'abi-removed', 'abi-stable-files', 'abi-obsolete-files', 'abi-stable', 'abi', 'abi-removed-files', 'abi-testing-files', 'abi-testing', 'gpio/index', 'gpio/obsolete'}
Removed: set()
All docs count: 385
Found docs count: 385
real 0m11,324s
user 0m15,783s
sys 0m1,164sTo get the root cause of the problem (ABI files reported as changed), I used this changeset:
# diff --git a/Documentation/conf.py b/Documentation/conf.py
# index e8766e689c1b..ab486623bd8b 100644
# --- a/Documentation/conf.py
# +++ b/Documentation/conf.py
# @@ -571,3 +571,16 @@ def setup(app):
# """Patterns need to be updated at init time on older Sphinx versions"""
#
# app.connect('config-inited', update_patterns)
# + app.connect('env-get-outdated', on_outdated)
# +
# +def on_outdated(app, env, added, changed, removed):
# + """Track cache outdated due to added/changed/removed files"""
# + print("\n[OUTDATED]")
# + print(f"Added: {added}")
# + print(f"Changed: {changed}")
# + print(f"Removed: {removed}")
# + print(f"All docs count: {len(env.all_docs)}")
# + print(f"Found docs count: {len(env.found_docs)}")# +
# + # Just return what we have
# + return added | changed | removed
--- Documentation/sphinx/kernel_abi.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Documentation/sphinx/kernel_abi.py +4 -2
@@ -146,8 +146,10 @@ class KernelCmd(Directive): n += 1 if f != old_f: - # Add the file to Sphinx build dependencies - env.note_dependency(os.path.abspath(f)) + # Add the file to Sphinx build dependencies if the file exists + fname = os.path.join(srctree, f) + if os.path.isfile(fname): + env.note_dependency(fname) old_f = f
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 339/515 mfd: axp20x: Set explicit ID for AXP313 regulator
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
[ Upstream commit 88828c7e940dd45d139ad4a39d702b23840a37c5 ]
On newer boards featuring the A523 SoC, the AXP323 (related to the AXP313) is paired with the AXP717 and serves as a secondary PMIC providing additional regulator outputs. However the MFD cells are all registered with PLATFORM_DEVID_NONE, which causes the regulator cells to conflict with each other.
Commit e37ec3218870 ("mfd: axp20x: Allow multiple regulators") attempted to fix this by switching to PLATFORM_DEVID_AUTO so that the device names would all be different, however that broke IIO channel mapping, which is also tied to the device names. As a result the change was later reverted.
Instead, here we attempt to make sure the AXP313/AXP323 regulator cell does not conflict by explicitly giving it an ID number. This was previously done for the AXP809+AXP806 pair used with the A80 SoC.
--- drivers/mfd/axp20x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mfd/axp20x.c +2 -1
@@ -1053,7 +1053,8 @@ static const struct mfd_cell axp152_cells[] = { };static struct mfd_cell axp313a_cells[] = { -MFD_CELL_NAME ("axp20x-regulator" ), +/* AXP323 is sometimes paired with AXP717 as sub-PMIC */ +MFD_CELL_BASIC ("axp20x-regulator" ,NULL ,NULL ,0 ,1 ),MFD_CELL_RES ("axp313a-pek" , axp313a_pek_resources), };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 340/515 phy: rockchip-pcie: Properly disable TEST_WRITE strobe signal
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geraldo Nascimento <[email protected]>
[ Upstream commit 25facbabc3fc33c794ad09d73f73268c0f8cbc7d ]
pcie_conf is used to touch TEST_WRITE strobe signal. This signal should be enabled, a little time waited, and then disabled. Current code clearly was copy-pasted and never disables the strobe signal. Adjust the define. While at it, remove PHY_CFG_RD_MASK which has been unused since 64cdc0360811 ("phy: rockchip-pcie: remove unused phy_rd_cfg function").
--- drivers/phy/rockchip/phy-rockchip-pcie.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/phy/rockchip/phy-rockchip-pcie.c +1 -2
@@ -30,9 +30,8 @@#define PHY_CFG_ADDR_SHIFT 1#define PHY_CFG_DATA_MASK 0xf#define PHY_CFG_ADDR_MASK 0x3f -#define PHY_CFG_RD_MASK 0x3ff#define PHY_CFG_WR_ENABLE 1 -#define PHY_CFG_WR_DISABLE 1 +#define PHY_CFG_WR_DISABLE 0#define PHY_CFG_WR_SHIFT 0#define PHY_CFG_WR_MASK 1#define PHY_CFG_PLL_LOCK 0x10
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 341/515 phy: rockchip-pcie: Enable all four lanes if required
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Valmantas Paliksa <[email protected]>
[ Upstream commit c3fe7071e196e25789ecf90dbc9e8491a98884d7 ]
Current code enables only Lane 0 because pwr_cnt will be incremented on first call to the function. Let's reorder the enablement code to enable all 4 lanes through GRF.
--- drivers/phy/rockchip/phy-rockchip-pcie.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/phy/rockchip/phy-rockchip-pcie.c +6 -6
@@ -159,6 +159,12 @@ static int rockchip_pcie_phy_power_on(struct phy *phy)guard (mutex)(&rk_phy->pcie_mutex); +regmap_write (rk_phy->reg_base, + rk_phy->phy_data->pcie_laneoff, +HIWORD_UPDATE (!PHY_LANE_IDLE_OFF , +PHY_LANE_IDLE_MASK , +PHY_LANE_IDLE_A_SHIFT + inst->index)); +if (rk_phy->pwr_cnt++) {return 0 ; }
@@ -175,12 +181,6 @@ static int rockchip_pcie_phy_power_on(struct phy *phy)PHY_CFG_ADDR_MASK , PHY_CFG_ADDR_SHIFT)); -regmap_write (rk_phy->reg_base, - rk_phy->phy_data->pcie_laneoff, -HIWORD_UPDATE (!PHY_LANE_IDLE_OFF , -PHY_LANE_IDLE_MASK , -PHY_LANE_IDLE_A_SHIFT + inst->index)); -/* * No documented timeout value for phy operation below, * so we make it large enough here. And we use loop-break
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 342/515 scsi: libiscsi: Initialize iscsi_conn->dd_data only if memory is allocated
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Showrya M N <[email protected]>
[ Upstream commit 3ea3a256ed81f95ab0f3281a0e234b01a9cae605 ]
In case of an ib_fast_reg_mr allocation failure during iSER setup, the machine hits a panic because iscsi_conn->dd_data is initialized unconditionally, even when no memory is allocated (dd_size == 0). This leads invalid pointer dereference during connection teardown.
Fix by setting iscsi_conn->dd_data only if memory is actually allocated.
Panic trace:
------------
iser: iser_create_fastreg_desc: Failed to allocate ib_fast_reg_mr err=-12
iser: iser_alloc_rx_descriptors: failed allocating rx descriptors / data buffers
BUG: unable to handle page fault for address: fffffffffffffff8 RIP: 0010:swake_up_locked.part.5+0xa/0x40 Call Trace: complete+0x31/0x40 iscsi_iser_conn_stop+0x88/0xb0 [ib_iser] iscsi_stop_conn+0x66/0xc0 [scsi_transport_iscsi] iscsi_if_stop_conn+0x14a/0x150 [scsi_transport_iscsi] iscsi_if_rx+0x1135/0x1834 [scsi_transport_iscsi] ? netlink_lookup+0x12f/0x1b0 ? netlink_deliver_tap+0x2c/0x200 netlink_unicast+0x1ab/0x280 netlink_sendmsg+0x257/0x4f0 ? _copy_from_user+0x29/0x60 sock_sendmsg+0x5f/0x70
--- drivers/scsi/libiscsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/libiscsi.c +2 -1
@@ -3184,7 +3184,8 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size,return NULL ; conn = cls_conn->dd_data; - conn->dd_data = cls_conn->dd_data +sizeof (*conn); +if (dd_size) + conn->dd_data = cls_conn->dd_data +sizeof (*conn); conn->session = session; conn->cls_conn = cls_conn; conn->c_stage =ISCSI_CONN_INITIAL_STAGE ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 343/515 fs/orangefs: use snprintf() instead of sprintf()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Mohammad Jahangirzad <[email protected]>
[ Upstream commit cdfa1304657d6f23be8fd2bb0516380a3c89034e ]
sprintf() is discouraged for use with bounded destination buffers as it does not prevent buffer overflows when the formatted output exceeds the destination buffer size. snprintf() is a safer alternative as it limits the number of bytes written and ensures NUL-termination.
Replace sprintf() with snprintf() for copying the debug string into a temporary buffer, using ORANGEFS_MAX_DEBUG_STRING_LEN as the maximum size to ensure safe formatting and prevent memory corruption in edge cases.
EDIT: After this patch sat on linux-next for a few days, Dan Carpenter saw it and suggested that I use scnprintf instead of snprintf. I made the change and retested.
--- fs/orangefs/orangefs-debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/orangefs/orangefs-debugfs.c +1 -1
@@ -396,7 +396,7 @@ static ssize_t orangefs_debug_read(struct file *file, goto out;mutex_lock (&orangefs_debug_lock); - sprintf_ret =sprintf (buf,"%s" , (char *)file->private_data); + sprintf_ret =scnprintf (buf,ORANGEFS_MAX_DEBUG_STRING_LEN ,"%s" , (char *)file->private_data);mutex_unlock (&orangefs_debug_lock); read_ret =simple_read_from_buffer (ubuf, count, ppos, buf, sprintf_ret);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 344/515 watchdog: dw_wdt: Fix default timeout
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Reichel <[email protected]>
[ Upstream commit ac3dbb91e0167d017f44701dd51c1efe30d0c256 ]
The Synopsys Watchdog driver sets the default timeout to 30 seconds, but on some devices this is not a valid timeout. E.g. on RK3588 the actual timeout being used is 44 seconds instead.
Once the watchdog is started the value is updated accordingly, but it would be better to expose a sensible timeout to userspace without the need to first start the watchdog.
--- drivers/watchdog/dw_wdt.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/watchdog/dw_wdt.c +2 -0
@@ -644,6 +644,8 @@ static int dw_wdt_drv_probe(struct platform_device *pdev) }else { wdd->timeout =DW_WDT_DEFAULT_SECONDS ;watchdog_init_timeout (wdd,0 , dev); +/* Limit timeout value to hardware constraints. */ +dw_wdt_set_timeout (wdd, wdd->timeout); }platform_set_drvdata (pdev, dw_wdt);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 345/515 hwmon: (emc2305) Set initial PWM minimum value during probe based on thermal state
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florin Leotescu <[email protected]>
[ Upstream commit 0429415a084a15466e87d504e8c2a502488184a5 ]
Prevent the PWM value from being set to minimum when thermal zone temperature exceeds any trip point during driver probe. Otherwise, the PWM fan speed will remains at minimum speed and not respond to temperature changes.
--- drivers/hwmon/emc2305.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/hwmon/emc2305.c +8 -2
@@ -299,6 +299,12 @@ static int emc2305_set_single_tz(struct device *dev, int idx)dev_err (dev,"Failed to register cooling device %s\n" , emc2305_fan_name[idx]);return PTR_ERR (data->cdev_data[cdev_idx].cdev); } + +if (data->cdev_data[cdev_idx].cur_state >0 ) +/* Update pwm when temperature is above trips */ + pwm =EMC2305_PWM_STATE2DUTY (data->cdev_data[cdev_idx].cur_state, + data->max_state,EMC2305_FAN_MAX ); +/* Set minimal PWM speed. */ if (data->pwm_separate) { ret =emc2305_set_pwm (dev, pwm, cdev_idx);
@@ -312,10 +318,10 @@ static int emc2305_set_single_tz(struct device *dev, int idx) } } data->cdev_data[cdev_idx].cur_state = -EMC2305_PWM_DUTY2STATE (data->pwm_min[cdev_idx], data->max_state, +EMC2305_PWM_DUTY2STATE (pwm, data->max_state,EMC2305_FAN_MAX ); data->cdev_data[cdev_idx].last_hwmon_state = -EMC2305_PWM_DUTY2STATE (data->pwm_min[cdev_idx], data->max_state, +EMC2305_PWM_DUTY2STATE (pwm, data->max_state,EMC2305_FAN_MAX );return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 346/515 clk: qcom: ipq5018: keep XO clock always on
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: George Moussalem <[email protected]>
[ Upstream commit 693a723291d0634eaea24cff2f9d807f3223f204 ]
The XO clock must not be disabled to avoid the kernel trying to disable the it. As such, keep the XO clock always on by flagging it as critical.
--- drivers/clk/qcom/gcc-ipq5018.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gcc-ipq5018.c +1 -1
@@ -1371,7 +1371,7 @@ static struct clk_branch gcc_xo_clk = { &gcc_xo_clk_src.clkr.hw, }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, },
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 347/515 MIPS: vpe-mt: add missing prototypes for vpe_{alloc,start,stop,free}
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shiji Yang <[email protected]>
[ Upstream commit 844615dd0f2d95c018ec66b943e08af22b62aff3 ]
These functions are exported but their prototypes are not defined. This patch adds the missing function prototypes to fix the following compilation warnings:
arch/mips/kernel/vpe-mt.c:180:7: error: no previous prototype for 'vpe_alloc' [-Werror=missing-prototypes]
180 | void *vpe_alloc(void)
| ^~~~~~~~~
arch/mips/kernel/vpe-mt.c:198:5: error: no previous prototype for 'vpe_start' [-Werror=missing-prototypes]
198 | int vpe_start(void *vpe, unsigned long start)
| ^~~~~~~~~
arch/mips/kernel/vpe-mt.c:208:5: error: no previous prototype for 'vpe_stop' [-Werror=missing-prototypes]
208 | int vpe_stop(void *vpe)
| ^~~~~~~~
arch/mips/kernel/vpe-mt.c:229:5: error: no previous prototype for 'vpe_free' [-Werror=missing-prototypes]
229 | int vpe_free(void *vpe)
| ^~~~~~~~--- arch/mips/include/asm/vpe.h | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/mips/include/asm/vpe.h +8 -0
@@ -119,4 +119,12 @@ void cleanup_tc(struct tc *tc);int __init vpe_module_init (void ); void __exit vpe_module_exit(void); + +#ifdef CONFIG_MIPS_VPE_LOADER_MT +void *vpe_alloc (void ); +int vpe_start (void *vpe,unsigned long start); +int vpe_stop (void *vpe); +int vpe_free (void *vpe); +#endif /* CONFIG_MIPS_VPE_LOADER_MT */ +#endif /* _ASM_VPE_H */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 348/515 watchdog: iTCO_wdt: Report error if timeout configuration fails
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ziyan Fu <[email protected]>
[ Upstream commit 40efc43eb7ffb5a4e2f998c13b8cfb555e671b92 ]
The driver probes with the invalid timeout value when 'iTCO_wdt_set_timeout()' fails, as its return value is not checked. In this case, when executing "wdctl", we may get:
Device: /dev/watchdog0 Timeout: 30 seconds Timeleft: 613 seconds
The timeout value is the value of "heartbeat" or "WATCHDOG_TIMEOUT", and the timeleft value is calculated from the register value we actually read (0xffff) by masking with 0x3ff and converting ticks to seconds (* 6 / 10).
Add error handling to return the failure code if 'iTCO_wdt_set_timeout()' fails, ensuring the driver probe fails and prevents invalid operation.
--- drivers/watchdog/iTCO_wdt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/watchdog/iTCO_wdt.c +5 -1
@@ -601,7 +601,11 @@ static int iTCO_wdt_probe(struct platform_device *pdev)/* Check that the heartbeat value is within it's range; if not reset to the default */ if (iTCO_wdt_set_timeout (&p->wddev, heartbeat)) { -iTCO_wdt_set_timeout (&p->wddev,WATCHDOG_TIMEOUT ); + ret =iTCO_wdt_set_timeout (&p->wddev,WATCHDOG_TIMEOUT ); +if (ret !=0 ) { +dev_err (dev,"Failed to set watchdog timeout (%d)\n" ,WATCHDOG_TIMEOUT ); +return ret; + }dev_info (dev,"timeout value out of range, using %d\n" ,WATCHDOG_TIMEOUT ); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 349/515 scsi: bfa: Double-free fix
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: jackysliu <[email protected]>
[ Upstream commit add4c4850363d7c1b72e8fce9ccb21fdd2cf5dc9 ]
When the bfad_im_probe() function fails during initialization, the memory pointed to by bfad->im is freed without setting bfad->im to NULL.
Subsequently, during driver uninstallation, when the state machine enters the bfad_sm_stopping state and calls the bfad_im_probe_undo() function, it attempts to free the memory pointed to by bfad->im again, thereby triggering a double-free vulnerability.
Set bfad->im to NULL if probing fails.
--- drivers/scsi/bfa/bfad_im.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/bfa/bfad_im.c +1 -0
@@ -706,6 +706,7 @@ bfad_im_probe(struct bfad_s *bfad)if (bfad_thread_workq (bfad) !=BFA_STATUS_OK ) {kfree (im); + bfad->im =NULL ;return BFA_STATUS_FAILED ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 350/515 jfs: truncate good inode pages when hard link is 0
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Xu <[email protected]>
[ Upstream commit 2d91b3765cd05016335cd5df5e5c6a29708ec058 ]
The fileset value of the inode copy from the disk by the reproducer is AGGR_RESERVED_I. When executing evict, its hard link number is 0, so its inode pages are not truncated. This causes the bugon to be triggered when executing clear_inode() because nrpages is greater than 0.
--- fs/jfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jfs/inode.c +1 -1
@@ -145,9 +145,9 @@ void jfs_evict_inode(struct inode *inode)if (!inode->i_nlink && !is_bad_inode (inode)) {dquot_initialize (inode); +truncate_inode_pages_final (&inode->i_data);if (JFS_IP (inode)->fileset ==FILESYSTEM_I ) {struct inode *ipimap =JFS_SBI (inode->i_sb)->ipimap; -truncate_inode_pages_final (&inode->i_data);if (test_cflag (COMMIT_Freewmap, inode))jfs_free_zero_link (inode);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 351/515 jfs: Regular file corruption check
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <[email protected]>
[ Upstream commit 2d04df8116426b6c7b9f8b9b371250f666a2a2fb ]
The reproducer builds a corrupted file on disk with a negative i_size value. Add a check when opening this file to avoid subsequent operation failures.
--- fs/jfs/file.c | 3 +++ 1 file changed, 3 insertions(+)
fs/jfs/file.c +3 -0
@@ -44,6 +44,9 @@ static int jfs_open(struct inode *inode, struct file *file) {int rc; +if (S_ISREG (inode->i_mode) && inode->i_size <0 ) +return -EIO ; +if ((rc =dquot_file_open (inode, file)))return rc;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 352/515 jfs: upper bound check of tree index in dbAllocAG
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaud Lecomte <[email protected]>
[ Upstream commit c214006856ff52a8ff17ed8da52d50601d54f9ce ]
When computing the tree index in dbAllocAG, we never check if we are out of bounds realative to the size of the stree.
This could happen in a scenario where the filesystem metadata are corrupted.
--- fs/jfs/jfs_dmap.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/jfs/jfs_dmap.c +6 -0
@@ -1389,6 +1389,12 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results) (1 << (L2LPERCTL - (bmp->db_agheight <<1 ))) / bmp->db_agwidth; ti = bmp->db_agstart + bmp->db_agwidth * (agno & (agperlev -1 )); +if (ti <0 || ti >=le32_to_cpu (dcp->nleafs)) { +jfs_error (bmp->db_ipbmap->i_sb,"Corrupt dmapctl page\n" ); +release_metapage (mp); +return -EIO ; + } +/* dmap control page trees fan-out by 4 and a single allocation * group may be described by 1 or 2 subtrees within the ag level * dmap control page, depending upon the ag size. examine the ag's
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 353/515 media: hi556: Fix reset GPIO timings
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 99f2211a9d89fe34b3fa847fd7a4475171406cd0 ]
probe() requests the reset GPIO to be set to high when getting it. Immeditately after this hi556_resume() is called and sets the GPIO low.
If the GPIO was low before requesting it this will result in the GPIO only very briefly spiking high and the sensor not being properly reset. The same problem also happens on back to back runtime suspend + resume.
Fix this by adding a sleep of 2 ms in hi556_resume() before setting the GPIO low (if there is a reset GPIO).
The final sleep is kept unconditional, because if there is e.g. no reset GPIO but a controllable clock then the sensor also needs some time after enabling the clock.
--- drivers/media/i2c/hi556.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/media/i2c/hi556.c +6 -1
@@ -1321,7 +1321,12 @@ static int hi556_resume(struct device *dev)return ret; } -gpiod_set_value_cansleep (hi556->reset_gpio,0 ); +if (hi556->reset_gpio) { +/* Assert reset for at least 2ms on back to back off-on */ +usleep_range (2000 ,2200 ); +gpiod_set_value_cansleep (hi556->reset_gpio,0 ); + } +usleep_range (5000 ,5500 );return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 354/515 RDMA/bnxt_re: Fix size of uverbs_copy_to() in BNXT_RE_METHOD_GET_TOGGLE_MEM
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kalesh AP <[email protected]>
[ Upstream commit 09d231ab569ca97478445ccc1ad44ab026de39b1 ]
Since both "length" and "offset" are of type u32, there is no functional issue here.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +1 -1
@@ -4738,7 +4738,7 @@ static int UVERBS_HANDLER(BNXT_RE_METHOD_GET_TOGGLE_MEM)(struct uverbs_attr_bundreturn err; err =uverbs_copy_to (attrs,BNXT_RE_TOGGLE_MEM_MMAP_OFFSET , - &offset,sizeof (length)); + &offset,sizeof (offset));if (err)return err;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 355/515 crypto: jitter - fix intermediary handling
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markus Theil <[email protected]>
[ Upstream commit 735b72568c73875269a6b73ab9543a70f6ac8a9f ]
The intermediary value was included in the wrong hash state. While there, adapt to user-space by setting the timestamp to 0 if stuck and inserting the values nevertheless.
--- crypto/jitterentropy-kcapi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
crypto/jitterentropy-kcapi.c +5 -4
@@ -144,7 +144,7 @@ int jent_hash_time(void *hash_state, __u64 time, u8 *addtl,* Inject the data from the previous loop into the pool. This data is * not considered to contain any entropy, but it stirs the pool a bit. */ - ret =crypto_shash_update (desc, intermediary,sizeof (intermediary)); + ret =crypto_shash_update (hash_state_desc, intermediary,sizeof (intermediary));if (ret) goto err;
@@ -157,11 +157,12 @@ int jent_hash_time(void *hash_state, __u64 time, u8 *addtl,* conditioning operation to have an identical amount of input data * according to section 3.1.5. */ -if (!stuck) { - ret =crypto_shash_update (hash_state_desc, (u8 *)&time, -sizeof (__u64)); +if (stuck) { + time =0 ; } + ret =crypto_shash_update (hash_state_desc, (u8 *)&time,sizeof (__u64)); + err:shash_desc_zero (desc);memzero_explicit (intermediary,sizeof (intermediary));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 356/515 MIPS: Dont crash in stack_top() for tasks without ABI or vDSO
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit e9f4a6b3421e936c3ee9d74710243897d74dbaa2 ]
Not all tasks have an ABI associated or vDSO mapped,
for example kthreads never do.
If such a task ever ends up calling stack_top(), it will derefence the NULL ABI pointer and crash.
This can for example happen when using kunit:
mips_stack_top+0x28/0xc0
arch_pick_mmap_layout+0x190/0x220
kunit_vm_mmap_init+0xf8/0x138
__kunit_add_resource+0x40/0xa8
kunit_vm_mmap+0x88/0xd8
usercopy_test_init+0xb8/0x240
kunit_try_run_case+0x5c/0x1a8
kunit_generic_run_threadfn_adapter+0x28/0x50
kthread+0x118/0x240
ret_from_kernel_thread+0x14/0x1cOnly dereference the ABI point if it is set.
The GIC page is also included as it is specific to the vDSO. Also move the randomization adjustment into the same conditional.
--- arch/mips/kernel/process.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
arch/mips/kernel/process.c +9 -7
@@ -690,18 +690,20 @@ unsigned long mips_stack_top(void) }/* Space for the VDSO, data page & GIC user page */ - top -=PAGE_ALIGN (current->thread.abi->vdso->size); - top -=PAGE_SIZE ; - top -=mips_gic_present () ?PAGE_SIZE :0 ; +if (current->thread.abi) { + top -=PAGE_ALIGN (current->thread.abi->vdso->size); + top -=PAGE_SIZE ; + top -=mips_gic_present () ?PAGE_SIZE :0 ; + +/* Space to randomize the VDSO base */ +if (current->flags &PF_RANDOMIZE ) + top -=VDSO_RANDOMIZE_SIZE ; + }/* Space for cache colour alignment */ if (cpu_has_dc_aliases) top -= shm_align_mask +1 ; -/* Space to randomize the VDSO base */ -if (current->flags &PF_RANDOMIZE ) - top -=VDSO_RANDOMIZE_SIZE ; -return top; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 357/515 MIPS: lantiq: falcon: sysctrl: fix request memory check logic
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shiji Yang <[email protected]>
[ Upstream commit 9c9a7ff9882fc6ba7d2f4050697e8bb80383e8dc ]
request_mem_region() will return NULL instead of error code when the memory request fails. Therefore, we should check if the return value is non-zero instead of less than zero. In this way, this patch also fixes the build warnings:
arch/mips/lantiq/falcon/sysctrl.c:214:50: error: ordered comparison of pointer with integer zero [-Werror=extra]
214 | res_status.name) < 0) ||
| ^arch/mips/lantiq/falcon/sysctrl.c:216:47: error: ordered comparison of pointer with integer zero [-Werror=extra]
216 | res_ebu.name) < 0) ||
| ^arch/mips/lantiq/falcon/sysctrl.c:219:50: error: ordered comparison of pointer with integer zero [-Werror=extra]
219 | res_sys[0].name) < 0) ||
| ^arch/mips/lantiq/falcon/sysctrl.c:222:50: error: ordered comparison of pointer with integer zero [-Werror=extra]
222 | res_sys[1].name) < 0) ||
| ^arch/mips/lantiq/falcon/sysctrl.c:225:50: error: ordered comparison of pointer with integer zero [-Werror=extra]
225 | res_sys[2].name) < 0))
|
--- arch/mips/lantiq/falcon/sysctrl.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
arch/mips/lantiq/falcon/sysctrl.c +10 -13
@@ -214,19 +214,16 @@ void __init ltq_soc_init(void)of_node_put (np_syseth);of_node_put (np_sysgpe); -if ((request_mem_region (res_status.start,resource_size (&res_status), - res_status.name) <0 ) || - (request_mem_region (res_ebu.start,resource_size (&res_ebu), - res_ebu.name) <0 ) || - (request_mem_region (res_sys[0 ].start, -resource_size (&res_sys[0 ]), - res_sys[0 ].name) <0 ) || - (request_mem_region (res_sys[1 ].start, -resource_size (&res_sys[1 ]), - res_sys[1 ].name) <0 ) || - (request_mem_region (res_sys[2 ].start, -resource_size (&res_sys[2 ]), - res_sys[2 ].name) <0 )) +if ((!request_mem_region (res_status.start,resource_size (&res_status), + res_status.name)) || + (!request_mem_region (res_ebu.start,resource_size (&res_ebu), + res_ebu.name)) || + (!request_mem_region (res_sys[0 ].start,resource_size (&res_sys[0 ]), + res_sys[0 ].name)) || + (!request_mem_region (res_sys[1 ].start,resource_size (&res_sys[1 ]), + res_sys[1 ].name)) || + (!request_mem_region (res_sys[2 ].start,resource_size (&res_sys[2 ]), + res_sys[2 ].name)))pr_err ("Failed to request core resources" ); status_membase = ioremap(res_status.start,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 358/515 media: iris: Add handling for corrupt and drop frames
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dikshita Agarwal <[email protected]>
[ Upstream commit b791dcfcba3a0c46fb3e2decab31d2340c5dc313 ]
Firmware attach DATACORRUPT/DROP buffer flags for the frames which needs to be dropped, handle it by setting VB2_BUF_STATE_ERROR for these buffers before calling buf_done.
--- drivers/media/platform/qcom/iris/iris_buffer.c | 11 ++++++++--- .../media/platform/qcom/iris/iris_hfi_gen1_defines.h | 2 ++ .../media/platform/qcom/iris/iris_hfi_gen1_response.c | 6 ++++++ 3 files changed, 16 insertions(+), 3 deletions(-)
drivers/media/platform/qcom/iris/iris_buffer.c +8 -3
@@ -593,10 +593,13 @@ int iris_vb2_buffer_done(struct iris_inst *inst, struct iris_buffer *buf) vb2 = &vbuf->vb2_buf; -if (buf->flags &V4L2_BUF_FLAG_ERROR ) +if (buf->flags &V4L2_BUF_FLAG_ERROR ) { state =VB2_BUF_STATE_ERROR ; -else - state =VB2_BUF_STATE_DONE ; +vb2_set_plane_payload (vb2,0 ,0 ); + vb2->timestamp =0 ; +v4l2_m2m_buf_done (vbuf, state); +return 0 ; + } vbuf->flags |= buf->flags;
@@ -616,6 +619,8 @@ int iris_vb2_buffer_done(struct iris_inst *inst, struct iris_buffer *buf)v4l2_m2m_mark_stopped (m2m_ctx); } } + + state =VB2_BUF_STATE_DONE ; vb2->timestamp = buf->timestamp;v4l2_m2m_buf_done (vbuf, state);
drivers/media/platform/qcom/iris/iris_hfi_gen1_defines.h +2 -0
@@ -117,6 +117,8 @@#define HFI_FRAME_NOTCODED 0x7f002000#define HFI_FRAME_YUV 0x7f004000#define HFI_UNUSED_PICT 0x10000000 +#define HFI_BUFFERFLAG_DATACORRUPT 0x00000008 +#define HFI_BUFFERFLAG_DROP_FRAME 0x20000000struct hfi_pkt_hdr {u32 size;
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c +6 -0
@@ -481,6 +481,12 @@ static void iris_hfi_gen1_session_ftb_done(struct iris_inst *inst, void *packet) buf->attr |=BUF_ATTR_DEQUEUED ; buf->attr |=BUF_ATTR_BUFFER_DONE ; +if (hfi_flags &HFI_BUFFERFLAG_DATACORRUPT ) + flags |=V4L2_BUF_FLAG_ERROR ; + +if (hfi_flags &HFI_BUFFERFLAG_DROP_FRAME ) + flags |=V4L2_BUF_FLAG_ERROR ; + buf->flags |= flags;iris_vb2_buffer_done (inst, buf);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 359/515 clk: thead: Mark essential bus clocks as CLK_IGNORE_UNUSED
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Wilczynski <[email protected]>
[ Upstream commit 0370395d45ca6dd53bb931978f0e91ac8dd6f1c5 ]
Probing peripherals in the AON and PERI domains, such as the PVT thermal sensor and the PWM controller, can lead to boot hangs or unresponsive devices on the LPi4A board. The root cause is that their parent bus clocks ('CLK_CPU2AON_X2H' and the 'CLK_PERISYS_APB' clocks) are automatically gated by the kernel's power-saving mechanisms when the bus is perceived as idle.
Alternative solutions were investigated, including modeling the parent bus in the Device Tree with 'simple-pm-bus' or refactoring the clock driver's parentage. The 'simple-pm-bus' approach is not viable due to the lack of defined bus address ranges in the hardware manual and its creation of improper dependencies on the 'pm_runtime' API for consumer drivers.
Therefore, applying the'`CLK_IGNORE_UNUSED' flag directly to the essential bus clocks is the most direct and targeted fix. This prevents the kernel from auto-gating these buses and ensures peripherals remain accessible.
This change fixes the boot hang associated with the PVT sensor and resolves the functional issues with the PWM controller.
--- drivers/clk/thead/clk-th1520-ap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clk/thead/clk-th1520-ap.c +3 -2
@@ -799,11 +799,12 @@ static CCU_GATE(CLK_AON2CPU_A2X, aon2cpu_a2x_clk, "aon2cpu-a2x", axi4_cpusys2_ac 0x134, BIT(8), 0); static CCU_GATE(CLK_X2X_CPUSYS, x2x_cpusys_clk, "x2x-cpusys", axi4_cpusys2_aclk_pd, 0x134, BIT(7), 0); -static CCU_GATE(CLK_CPU2AON_X2H, cpu2aon_x2h_clk, "cpu2aon-x2h", axi_aclk_pd, 0x138, BIT(8), 0); +static CCU_GATE(CLK_CPU2AON_X2H, cpu2aon_x2h_clk, "cpu2aon-x2h", axi_aclk_pd, + 0x138, BIT(8), CLK_IGNORE_UNUSED); static CCU_GATE(CLK_CPU2PERI_X2H, cpu2peri_x2h_clk, "cpu2peri-x2h", axi4_cpusys2_aclk_pd, 0x140, BIT(9), CLK_IGNORE_UNUSED); static CCU_GATE(CLK_PERISYS_APB1_HCLK, perisys_apb1_hclk, "perisys-apb1-hclk", perisys_ahb_hclk_pd, - 0x150, BIT(9), 0); + 0x150, BIT(9), CLK_IGNORE_UNUSED); static CCU_GATE(CLK_PERISYS_APB2_HCLK, perisys_apb2_hclk, "perisys-apb2-hclk", perisys_ahb_hclk_pd, 0x150, BIT(10), CLK_IGNORE_UNUSED); static CCU_GATE(CLK_PERISYS_APB3_HCLK, perisys_apb3_hclk, "perisys-apb3-hclk", perisys_ahb_hclk_pd,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 360/515 media: ipu-bridge: Add _HID for OV5670
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Scally <[email protected]>
[ Upstream commit 484f8bec3ddb453321ef0b8621c25de6ce3d0302 ]
The OV5670 is found on Dell 7212 tablets paired with an IPU3 ISP and needs to be connected by the ipu-bridge. Add it to the list of supported devices.
--- drivers/media/pci/intel/ipu-bridge.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/pci/intel/ipu-bridge.c +2 -0
@@ -60,6 +60,8 @@ static const struct ipu_sensor_config ipu_supported_sensors[] = {IPU_SENSOR_CONFIG ("INT33BE" ,1 ,419200000 ),/* Omnivision OV2740 */ IPU_SENSOR_CONFIG ("INT3474" ,1 ,180000000 ), +/* Omnivision OV5670 */ +IPU_SENSOR_CONFIG ("INT3479" ,1 ,422400000 ),/* Omnivision OV8865 */ IPU_SENSOR_CONFIG("INT347A", 1, 360000000),/* Omnivision OV7251 */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 361/515 media: v4l2-common: Reduce warnings about missing V4L2_CID_LINK_FREQ control
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Söderlund <[email protected]>
[ Upstream commit 5a0abb8909b9dcf347fce1d201ac6686ac33fd64 ]
When operating a pipeline with a missing V4L2_CID_LINK_FREQ control this two line warning is printed each time the pipeline is started. Reduce this excessive logging by only warning once for the missing control.
--- drivers/media/v4l2-core/v4l2-common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/v4l2-core/v4l2-common.c +4 -4
@@ -494,10 +494,10 @@ s64 __v4l2_get_link_freq_ctrl(struct v4l2_ctrl_handler *handler, freq =div_u64 (v4l2_ctrl_g_ctrl_int64 (ctrl) * mul, div); -pr_warn ("%s: Link frequency estimated using pixel rate: result might be inaccurate\n" , - __func__); -pr_warn ("%s: Consider implementing support for V4L2_CID_LINK_FREQ in the transmitter driver\n" , - __func__); +pr_warn_once ("%s: Link frequency estimated using pixel rate: result might be inaccurate\n" , + __func__); +pr_warn_once ("%s: Consider implementing support for V4L2_CID_LINK_FREQ in the transmitter driver\n" , + __func__); }return freq >0 ? freq : -EINVAL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 362/515 leds: leds-lp50xx: Handle reg to get correct multi_index
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Adolfsson <[email protected]>
[ Upstream commit 2e84a5e5374232e6f356ce5c079a5658d7e4af2c ]
mc_subled used for multi_index needs well defined array indexes, to guarantee the desired result, use reg for that.
If devicetree child nodes is processed in random or reverse order you may end up with multi_index "blue green red" instead of the expected "red green blue".
If user space apps uses multi_index to deduce how to control the leds they would most likely be broken without this patch if devicetree processing is reversed (which it appears to be).
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-fuji.dts has reg set but I don't see how it can have worked without this change.
If reg is not set, an error is returned,
If reg is out of range, an error is returned.
reg within led child nodes starts with 0, to map to the iout in each bank.
--- drivers/leds/leds-lp50xx.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/leds/leds-lp50xx.c +10 -1
@@ -476,6 +476,7 @@ static int lp50xx_probe_dt(struct lp50xx *priv)return -ENOMEM ;fwnode_for_each_child_node (child, led_node) { +int multi_index; ret =fwnode_property_read_u32 (led_node,"color" , &color_id);if (ret) {
@@ -483,8 +484,16 @@ static int lp50xx_probe_dt(struct lp50xx *priv)dev_err (priv->dev,"Cannot read color\n" );return ret; } + ret =fwnode_property_read_u32 (led_node,"reg" , &multi_index); +if (ret !=0 ) { +dev_err (priv->dev,"reg must be set\n" ); +return -EINVAL ; + }else if (multi_index >=LP50XX_LEDS_PER_MODULE ) { +dev_err (priv->dev,"reg %i out of range\n" , multi_index); +return -EINVAL ; + } - mc_led_info[num_colors].color_index = color_id; + mc_led_info[multi_index].color_index = color_id; num_colors++; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 363/515 dmaengine: stm32-dma: configure next sg only if there are more than 2 sgs
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amelie Delaunay <[email protected]>
[ Upstream commit e19bdbaa31082b43dab1d936e20efcebc30aa73d ]
DMA operates in Double Buffer Mode (DBM) when the transfer is cyclic and there are at least two periods.
When DBM is enabled, the DMA toggles between two memory targets (SxM0AR and SxM1AR), indicated by the SxSCR.CT bit (Current Target).
There is no need to update the next memory address if two periods are configured, as SxM0AR and SxM1AR are already properly set up before the transfer begins in the stm32_dma_start_transfer() function. This avoids unnecessary updates to SxM0AR/SxM1AR, thereby preventing potential Transfer Errors. Specifically, when the channel is enabled, SxM0AR and SxM1AR can only be written if SxSCR.CT=1 and SxSCR.CT=0, respectively. Otherwise, a Transfer Error interrupt is triggered, and the stream is automatically disabled.
--- drivers/dma/stm32/stm32-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/stm32/stm32-dma.c +1 -1
@@ -744,7 +744,7 @@ static void stm32_dma_handle_chan_done(struct stm32_dma_chan *chan, u32 scr)/* cyclic while CIRC/DBM disable => post resume reconfiguration needed */ if (!(scr & (STM32_DMA_SCR_CIRC |STM32_DMA_SCR_DBM )))stm32_dma_post_resume_reconfigure (chan); -else if (scr &STM32_DMA_SCR_DBM ) +else if (scr &STM32_DMA_SCR_DBM && chan->desc->num_sgs >2 )stm32_dma_configure_next_sg (chan); }else { chan->busy = false;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 364/515 RDMA: hfi1: fix possible divide-by-zero in find_hw_thread_mask()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yury Norov [NVIDIA] <[email protected]>
[ Upstream commit 59f7d2138591ef8f0e4e4ab5f1ab674e8181ad3a ]
The function divides number of online CPUs by num_core_siblings, and later checks the divider by zero. This implies a possibility to get and divide-by-zero runtime error. Fix it by moving the check prior to division. This also helps to save one indentation level.
--- drivers/infiniband/hw/hfi1/affinity.c | 44 +++++++++++++++------------ 1 file changed, 24 insertions(+), 20 deletions(-)
drivers/infiniband/hw/hfi1/affinity.c +24 -20
@@ -964,31 +964,35 @@ static void find_hw_thread_mask(uint hw_thread_no, cpumask_var_t hw_thread_mask, struct hfi1_affinity_node_list *affinity) {int possible, curr_cpu, i; -uint num_cores_per_socket = node_affinity.num_online_cpus / +uint num_cores_per_socket; + +cpumask_copy (hw_thread_mask, &affinity->proc.mask); + +if (affinity->num_core_siblings ==0 ) +return ; + + num_cores_per_socket = node_affinity.num_online_cpus / affinity->num_core_siblings / node_affinity.num_online_nodes; -cpumask_copy (hw_thread_mask, &affinity->proc.mask); -if (affinity->num_core_siblings >0 ) { -/* Removing other siblings not needed for now */ - possible =cpumask_weight (hw_thread_mask); - curr_cpu =cpumask_first (hw_thread_mask); -for (i =0 ; - i < num_cores_per_socket * node_affinity.num_online_nodes; - i++) - curr_cpu =cpumask_next (curr_cpu, hw_thread_mask); - -for (; i < possible; i++) { -cpumask_clear_cpu (curr_cpu, hw_thread_mask); - curr_cpu =cpumask_next (curr_cpu, hw_thread_mask); - } +/* Removing other siblings not needed for now */ + possible =cpumask_weight (hw_thread_mask); + curr_cpu =cpumask_first (hw_thread_mask); +for (i =0 ; + i < num_cores_per_socket * node_affinity.num_online_nodes; + i++) + curr_cpu =cpumask_next (curr_cpu, hw_thread_mask); -/* Identifying correct HW threads within physical cores */ -cpumask_shift_left (hw_thread_mask, hw_thread_mask, - num_cores_per_socket * - node_affinity.num_online_nodes * - hw_thread_no); +for (; i < possible; i++) { +cpumask_clear_cpu (curr_cpu, hw_thread_mask); + curr_cpu =cpumask_next (curr_cpu, hw_thread_mask); } + +/* Identifying correct HW threads within physical cores */ +cpumask_shift_left (hw_thread_mask, hw_thread_mask, + num_cores_per_socket * + node_affinity.num_online_nodes * + hw_thread_no); }int hfi1_get_proc_affinity (int node)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 365/515 RDMA/core: reduce stack using in nldev_stat_get_doit()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 43163f4c30f94d2103c948a247cdf2cda5068ca7 ]
In the s390 defconfig, gcc-10 and earlier end up inlining three functions into nldev_stat_get_doit(), and each of them uses some 600 bytes of stack.
The result is a function with an overly large stack frame and a warning:
drivers/infiniband/core/nldev.c:2466:1: error: the frame size of 1720 bytes is larger than 1280 bytes [-Werror=frame-larger-than=]
Mark the three functions noinline_for_stack to prevent this, ensuring that only one copy of the nlattr array is on the stack of each function.
--- drivers/infiniband/core/nldev.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/infiniband/core/nldev.c +12 -10
@@ -1469,10 +1469,11 @@ static const struct nldev_fill_res_entry fill_entries[RDMA_RESTRACK_MAX] = { }; -static int res_get_common_doit (struct sk_buff *skb,struct nlmsghdr *nlh, -struct netlink_ext_ack *extack, -enum rdma_restrack_type res_type, -res_fill_func_t fill_func) +static noinline_for_stack int +res_get_common_doit (struct sk_buff *skb,struct nlmsghdr *nlh, +struct netlink_ext_ack *extack, +enum rdma_restrack_type res_type, +res_fill_func_t fill_func) {const struct nldev_fill_res_entry *fe = &fill_entries[res_type];struct nlattr *tb[RDMA_NLDEV_ATTR_MAX ];
@@ -2263,10 +2264,10 @@ static int nldev_stat_del_doit(struct sk_buff *skb, struct nlmsghdr *nlh,return ret; } -static int stat_get_doit_default_counter (struct sk_buff *skb, -struct nlmsghdr *nlh, -struct netlink_ext_ack *extack, -struct nlattr *tb[]) +static noinline_for_stack int +stat_get_doit_default_counter (struct sk_buff *skb,struct nlmsghdr *nlh, +struct netlink_ext_ack *extack, +struct nlattr *tb[]) {struct rdma_hw_stats *stats;struct nlattr *table_attr;
@@ -2356,8 +2357,9 @@ static int stat_get_doit_default_counter(struct sk_buff *skb,return ret; } -static int stat_get_doit_qp (struct sk_buff *skb,struct nlmsghdr *nlh, -struct netlink_ext_ack *extack,struct nlattr *tb[]) +static noinline_for_stack int +stat_get_doit_qp (struct sk_buff *skb,struct nlmsghdr *nlh, +struct netlink_ext_ack *extack,struct nlattr *tb[]) {static enum rdma_nl_counter_mode mode;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 366/515 scsi: lpfc: Ensure HBA_SETUP flag is used only for SLI4 in dev_loss_tmo_callbk
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Tee <[email protected]>
[ Upstream commit 1cced5779e7a3ff7ec025fc47c76a7bd3bb38877 ]
For SLI3, the HBA_SETUP flag is never set so the lpfc_dev_loss_tmo_callbk always early returns. Add a phba->sli_rev check for SLI4 mode so that the SLI3 path can flow through the original dev_loss_tmo worker thread design to lpfc_dev_loss_tmo_handler instead of early return.
--- drivers/scsi/lpfc/lpfc_hbadisc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +2 -1
@@ -183,7 +183,8 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)/* Don't schedule a worker thread event if the vport is going down. */ if (test_bit (FC_UNLOADING , &vport->load_flag) || - !test_bit (HBA_SETUP , &phba->hba_flag)) { + (phba->sli_rev ==LPFC_SLI_REV4 && + !test_bit (HBA_SETUP , &phba->hba_flag))) {spin_lock_irqsave (&ndlp->lock, iflags); ndlp->rport =NULL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 367/515 scsi: lpfc: Check for hdwq null ptr when cleaning up lpfc_vport structure
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Tee <[email protected]>
[ Upstream commit 6698796282e828733cde3329c887b4ae9e5545e9 ]
If a call to lpfc_sli4_read_rev() from lpfc_sli4_hba_setup() fails, the resultant cleanup routine lpfc_sli4_vport_delete_fcp_xri_aborted() may occur before sli4_hba.hdwqs are allocated. This may result in a null pointer dereference when attempting to take the abts_io_buf_list_lock for the first hardware queue. Fix by adding a null ptr check on phba->sli4_hba.hdwq and early return because this situation means there must have been an error during port initialization.
--- drivers/scsi/lpfc/lpfc_scsi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/scsi/lpfc/lpfc_scsi.c +4 -0
@@ -390,6 +390,10 @@ lpfc_sli4_vport_delete_fcp_xri_aborted(struct lpfc_vport *vport)if (!(vport->cfg_enable_fc4_type &LPFC_ENABLE_FCP ))return ; +/* may be called before queues established if hba_setup fails */ +if (!phba->sli4_hba.hdwq) +return ; +spin_lock_irqsave (&phba->hbalock, iflag);for (idx =0 ; idx < phba->cfg_hdw_queue; idx++) { qp = &phba->sli4_hba.hdwq[idx];
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 368/515 power: supply: qcom_battmgr: Add lithium-polymer entry
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit 202ac22b8e2e015e6c196fd8113f3d2a62dd1afc ]
On some Dell XPS 13 (9345) variants, the battery used is lithium-polymer based. Currently, this is reported as unknown technology due to the entry missing.
[ 4083.135325] Unknown battery technology 'LIP'
Add another check for lithium-polymer in the technology parsing callback and return that instead of unknown.
--- drivers/power/supply/qcom_battmgr.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/power/supply/qcom_battmgr.c +2 -0
@@ -981,6 +981,8 @@ static unsigned int qcom_battmgr_sc8280xp_parse_technology(const char *chemistry {if (!strncmp (chemistry,"LIO" ,BATTMGR_CHEMISTRY_LEN ))return POWER_SUPPLY_TECHNOLOGY_LION ; +if (!strncmp (chemistry,"LIP" ,BATTMGR_CHEMISTRY_LEN )) +return POWER_SUPPLY_TECHNOLOGY_LIPO ;pr_err ("Unknown battery technology '%s'\n" , chemistry);return POWER_SUPPLY_TECHNOLOGY_UNKNOWN ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 369/515 HID: rate-limit hid_warn to prevent log flooding
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Chen <[email protected]>
[ Upstream commit 4051ead99888f101be92c7ce90d2de09aac6fd1c ]
Syzkaller can create many uhid devices that trigger repeated warnings like:
"hid-generic xxxx: unknown main item tag 0x0"
These messages can flood the system log, especially if a crash occurs (e.g., with a slow UART console, leading to soft lockups). To mitigate this, convert hid_warn() to use dev_warn_ratelimited().
This helps reduce log noise and improves system stability under fuzzing or faulty device scenarios.
--- drivers/hid/hid-core.c | 4 ++-- include/linux/hid.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/hid/hid-core.c +2 -2
@@ -663,9 +663,9 @@ static int hid_parser_main(struct hid_parser *parser, struct hid_item *item)default :if (item->tag >=HID_MAIN_ITEM_TAG_RESERVED_MIN && item->tag <=HID_MAIN_ITEM_TAG_RESERVED_MAX ) -hid_warn (parser->device,"reserved main item tag 0x%x\n" , item->tag); +hid_warn_ratelimited (parser->device,"reserved main item tag 0x%x\n" , item->tag);else -hid_warn (parser->device,"unknown main item tag 0x%x\n" , item->tag); +hid_warn_ratelimited (parser->device,"unknown main item tag 0x%x\n" , item->tag); ret =0 ; }
include/linux/hid.h +2 -0
@@ -1233,6 +1233,8 @@ void hid_quirks_exit(__u16 bus); dev_notice(&(hid)->dev, fmt, ##__VA_ARGS__)#define hid_warn (hid, fmt, ...) \ dev_warn(&(hid)->dev, fmt, ##__VA_ARGS__) +#define hid_warn_ratelimited (hid, fmt, ...) \ + dev_warn_ratelimited(&(hid)->dev, fmt, ##__VA_ARGS__)#define hid_info (hid, fmt, ...) \ dev_info(&(hid)->dev, fmt, ##__VA_ARGS__)#define hid_dbg (hid, fmt, ...) \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 370/515 scsi: mpt3sas: Correctly handle ATA device errors
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
[ Upstream commit 15592a11d5a5c8411ac8494ec49736b658f6fbff ]
With the ATA error model, an NCQ command failure always triggers an abort (termination) of all NCQ commands queued on the device. In such case, the SAT or the host must handle the failed command according to the command sense data and immediately retry all other NCQ commands that were aborted due to the failed NCQ command.
For SAS HBAs controlled by the mpt3sas driver, NCQ command aborts are not handled by the HBA SAT and sent back to the host, with an ioc log information equal to 0x31080000 (IOC_LOGINFO_PREFIX_PL with the PL code PL_LOGINFO_CODE_SATA_NCQ_FAIL_ALL_CMDS_AFTR_ERR). The function _scsih_io_done() always forces a retry of commands terminated with the status MPI2_IOCSTATUS_SCSI_IOC_TERMINATED using the SCSI result DID_SOFT_ERROR, regardless of the log_info for the command. This correctly forces the retry of collateral NCQ abort commands, but with the retry counter for the command being incremented. If a command to an ATA device is subject to too many retries due to other NCQ commands failing (e.g. read commands trying to access unreadable sectors), the collateral NCQ abort commands may be terminated with an error as they run out of retries. This violates the SAT specification and causes hard-to-debug command errors.
Solve this issue by modifying the handling of the MPI2_IOCSTATUS_SCSI_IOC_TERMINATED status to check if a command is for an ATA device and if the command loginfo indicates an NCQ collateral abort. If that is the case, force the command retry using the SCSI result DID_IMM_RETRY to avoid incrementing the command retry count.
--- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/scsi/mpt3sas/mpt3sas_scsih.c +19 -0
@@ -195,6 +195,14 @@ struct sense_info {#define MPT3SAS_PORT_ENABLE_COMPLETE (0xFFFD)#define MPT3SAS_ABRT_TASK_SET (0xFFFE)#define MPT3SAS_REMOVE_UNRESPONDING_DEVICES (0xFFFF) + +/* +* SAS Log info code for a NCQ collateral abort after an NCQ error: +* IOC_LOGINFO_PREFIX_PL | PL_LOGINFO_CODE_SATA_NCQ_FAIL_ALL_CMDS_AFTR_ERR +* See: drivers/message/fusion/lsi/mpi_log_sas.h +*/ +#define IOC_LOGINFO_SATA_NCQ_FAIL_AFTER_ERR 0x31080000 +/** * struct fw_event_work - firmware event struct * @list: link list framework
@@ -5814,6 +5822,17 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) scmd->result =DID_TRANSPORT_DISRUPTED <<16 ; goto out; } +if (log_info ==IOC_LOGINFO_SATA_NCQ_FAIL_AFTER_ERR ) { +/* +* This is a ATA NCQ command aborted due to another NCQ +* command failure. We must retry this command +* immediately but without incrementing its retry +* counter. +*/ +WARN_ON_ONCE (xfer_cnt !=0 ); + scmd->result =DID_IMM_RETRY <<16 ; +break ; + }if (log_info ==0x31110630 ) {if (scmd->retries >2 ) { scmd->result =DID_NO_CONNECT <<16 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 371/515 scsi: pm80xx: Free allocated tags after failure
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Francisco Gutierrez <[email protected]>
[ Upstream commit 258a0a19621793b811356fc9d1849f950629d669 ]
This change frees resources after an error is detected.
--- drivers/scsi/pm8001/pm80xx_hwi.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +10 -2
@@ -4677,8 +4677,12 @@ pm80xx_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id) &pm8001_ha->phy[phy_id].dev_sas_addr, SAS_ADDR_SIZE); payload.sas_identify.phy_id = phy_id; -return pm8001_mpi_build_cmd (pm8001_ha,0 , opcode, &payload, + ret =pm8001_mpi_build_cmd (pm8001_ha,0 , opcode, &payload,sizeof (payload),0 ); +if (ret <0 ) +pm8001_tag_free (pm8001_ha, tag); + +return ret; }/**
@@ -4704,8 +4708,12 @@ static int pm80xx_chip_phy_stop_req(struct pm8001_hba_info *pm8001_ha, payload.tag =cpu_to_le32 (tag); payload.phy_id =cpu_to_le32 (phy_id); -return pm8001_mpi_build_cmd (pm8001_ha,0 , opcode, &payload, + ret =pm8001_mpi_build_cmd (pm8001_ha,0 , opcode, &payload,sizeof (payload),0 ); +if (ret <0 ) +pm8001_tag_free (pm8001_ha, tag); + +return ret; }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 372/515 scsi: mpi3mr: Correctly handle ATA device errors
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
[ Upstream commit 04caad5a7ba86e830d04750417a15bad8ac2613c ]
With the ATA error model, an NCQ command failure always triggers an abort (termination) of all NCQ commands queued on the device. In such case, the SAT or the host must handle the failed command according to the command sense data and immediately retry all other NCQ commands that were aborted due to the failed NCQ command.
For SAS HBAs controlled by the mpi3mr driver, NCQ command aborts are not handled by the HBA SAT and sent back to the host, with an ioc log information equal to 0x31080000 (IOC_LOGINFO_PREFIX_PL with the PL code PL_LOGINFO_CODE_SATA_NCQ_FAIL_ALL_CMDS_AFTR_ERR). The function mpi3mr_process_op_reply_desc() always forces a retry of commands terminated with the status MPI3_IOCSTATUS_SCSI_IOC_TERMINATED using the SCSI result DID_SOFT_ERROR, regardless of the ioc_loginfo for the command. This correctly forces the retry of collateral NCQ abort commands, but with the retry counter for the command being incremented. If a command to an ATA device is subject to too many retries due to other NCQ commands failing (e.g. read commands trying to access unreadable sectors), the collateral NCQ abort commands may be terminated with an error as they run out of retries. This violates the SAT specification and causes hard-to-debug command errors.
Solve this issue by modifying the handling of the MPI3_IOCSTATUS_SCSI_IOC_TERMINATED status to check if a command is for an ATA device and if the command ioc_loginfo indicates an NCQ collateral abort. If that is the case, force the command retry using the SCSI result DID_IMM_RETRY to avoid incrementing the command retry count.
--- drivers/scsi/mpi3mr/mpi3mr_os.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/scsi/mpi3mr/mpi3mr_os.c +19 -1
@@ -49,6 +49,13 @@ static void mpi3mr_send_event_ack(struct mpi3mr_ioc *mrioc, u8 event,#define MPI3_EVENT_WAIT_FOR_DEVICES_TO_REFRESH (0xFFFE) +/* +* SAS Log info code for a NCQ collateral abort after an NCQ error: +* IOC_LOGINFO_PREFIX_PL | PL_LOGINFO_CODE_SATA_NCQ_FAIL_ALL_CMDS_AFTR_ERR +* See: drivers/message/fusion/lsi/mpi_log_sas.h +*/ +#define IOC_LOGINFO_SATA_NCQ_FAIL_AFTER_ERR 0x31080000 +/** * mpi3mr_host_tag_for_scmd - Get host tag for a scmd * @mrioc: Adapter instance reference
@@ -3397,7 +3404,18 @@ void mpi3mr_process_op_reply_desc(struct mpi3mr_ioc *mrioc, scmd->result =DID_NO_CONNECT <<16 ;break ;case MPI3_IOCSTATUS_SCSI_IOC_TERMINATED : - scmd->result =DID_SOFT_ERROR <<16 ; +if (ioc_loginfo ==IOC_LOGINFO_SATA_NCQ_FAIL_AFTER_ERR ) { +/* +* This is a ATA NCQ command aborted due to another NCQ +* command failure. We must retry this command +* immediately but without incrementing its retry +* counter. +*/ +WARN_ON_ONCE (xfer_count !=0 ); + scmd->result =DID_IMM_RETRY <<16 ; + }else { + scmd->result =DID_SOFT_ERROR <<16 ; + }break ;case MPI3_IOCSTATUS_SCSI_TASK_TERMINATED :case MPI3_IOCSTATUS_SCSI_EXT_TERMINATED :
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 373/515 pinctrl: stm32: Manage irq affinity settings
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cheick Traore <[email protected]>
[ Upstream commit 4c5cc2f65386e22166ce006efe515c667aa075e4 ]
Trying to set the affinity of the interrupts associated to stm32 pinctrl results in a write error.
Fill struct irq_chip::irq_set_affinity to use the default helper function.
--- drivers/pinctrl/stm32/pinctrl-stm32.c | 1 + 1 file changed, 1 insertion(+)
drivers/pinctrl/stm32/pinctrl-stm32.c +1 -0
@@ -408,6 +408,7 @@ static struct irq_chip stm32_gpio_irq_chip = { .irq_set_wake = irq_chip_set_wake_parent, .irq_request_resources = stm32_gpio_irq_request_resources, .irq_release_resources = stm32_gpio_irq_release_resources, + .irq_set_affinity = IS_ENABLED(CONFIG_SMP) ? irq_chip_set_affinity_parent : NULL, }; static int stm32_gpio_domain_translate(struct irq_domain *d,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 374/515 media: raspberrypi: cfe: Fix min_reqbufs_allocation
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
[ Upstream commit 57b5a302b5d529db96ddc52fbccec005092ebb3d ]
The driver checks if "vq->max_num_buffers + *nbuffers < 3", but vq->max_num_buffers is (by default) 32, so the check is never true. Nor does the check make sense.
The original code in the BSP kernel was "vq->num_buffers + *nbuffers < 3", but got mangled along the way to upstream. The intention was to make sure that at least 3 buffers are allocated.
Fix this by removing the bad lines and setting q->min_reqbufs_allocation to three.
--- drivers/media/platform/raspberrypi/rp1-cfe/cfe.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/platform/raspberrypi/rp1-cfe/cfe.c +1 -3
@@ -1025,9 +1025,6 @@ static int cfe_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,cfe_dbg (cfe,"%s: [%s] type:%u\n" , __func__, node_desc[node->id].name, node->buffer_queue.type); -if (vq->max_num_buffers + *nbuffers <3 ) - *nbuffers =3 - vq->max_num_buffers; -if (*nplanes) {if (sizes[0 ] < size) {cfe_err (cfe,"sizes[0] %i < size %u\n" , sizes[0 ], size);
@@ -1999,6 +1996,7 @@ static int cfe_register_node(struct cfe_device *cfe, int id) q->timestamp_flags =V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC ; q->lock = &node->lock; q->min_queued_buffers =1 ; + q->min_reqbufs_allocation =3 ; q->dev = &cfe->pdev->dev; ret =vb2_queue_init (q);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 375/515 media: tc358743: Check I2C succeeded during probe
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Stevenson <[email protected]>
[ Upstream commit 303d81635e1d9c949b370215cc94526ed81f2e3d ]
The probe for the TC358743 reads the CHIPID register from the device and compares it to the expected value of 0. If the I2C request fails then that also returns 0, so the driver loads thinking that the device is there.
Generally I2C communications are reliable so there is limited need to check the return value on every transfer, therefore only amend the one read during probe to check for I2C errors.
--- drivers/media/i2c/tc358743.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
drivers/media/i2c/tc358743.c +23 -4
@@ -114,7 +114,7 @@ static inline struct tc358743_state *to_state(struct v4l2_subdev *sd)/* --------------- I2C --------------- */ -static void i2c_rd (struct v4l2_subdev *sd,u16 reg,u8 *values,u32 n) +static int i2c_rd (struct v4l2_subdev *sd,u16 reg,u8 *values,u32 n) {struct tc358743_state *state =to_state (sd);struct i2c_client *client = state->i2c_client;
@@ -140,6 +140,7 @@ static void i2c_rd(struct v4l2_subdev *sd, u16 reg, u8 *values, u32 n)v4l2_err (sd,"%s: reading register 0x%x from 0x%x failed: %d\n" , __func__, reg, client->addr, err); } +return err !=ARRAY_SIZE (msgs); }static void i2c_wr (struct v4l2_subdev *sd,u16 reg,u8 *values,u32 n)
@@ -196,15 +197,24 @@ static void i2c_wr(struct v4l2_subdev *sd, u16 reg, u8 *values, u32 n) } } -static noinline u32 i2c_rdreg(struct v4l2_subdev *sd, u16 reg, u32 n) +static noinline u32 i2c_rdreg_err(struct v4l2_subdev *sd, u16 reg, u32 n, +int *err) { +int error;__le32 val =0 ; -i2c_rd (sd, reg, (u8 __force *)&val, n); + error =i2c_rd (sd, reg, (u8 __force *)&val, n); +if (err) + *err = error;return le32_to_cpu (val); } +static inline u32 i2c_rdreg (struct v4l2_subdev *sd,u16 reg,u32 n) +{ +return i2c_rdreg_err (sd, reg, n,NULL ); +} + static noinline void i2c_wrreg(struct v4l2_subdev *sd, u16 reg, u32 val, u32 n) {__le32 raw =cpu_to_le32 (val);
@@ -233,6 +243,13 @@ static u16 i2c_rd16(struct v4l2_subdev *sd, u16 reg)return i2c_rdreg (sd, reg,2 ); } +static int i2c_rd16_err (struct v4l2_subdev *sd,u16 reg,u16 *value) +{ +int err; + *value =i2c_rdreg_err (sd, reg,2 , &err); +return err; +} +static void i2c_wr16 (struct v4l2_subdev *sd,u16 reg,u16 val) {i2c_wrreg (sd, reg, val,2 );
@@ -2061,6 +2078,7 @@ static int tc358743_probe(struct i2c_client *client)struct tc358743_platform_data *pdata = client->dev.platform_data;struct v4l2_subdev *sd;u16 irq_mask =MASK_HDMI_MSK |MASK_CSI_MSK ; +u16 chipid;int err;if (!i2c_check_functionality (client->adapter,I2C_FUNC_SMBUS_BYTE_DATA ))
@@ -2092,7 +2110,8 @@ static int tc358743_probe(struct i2c_client *client) sd->flags |=V4L2_SUBDEV_FL_HAS_DEVNODE |V4L2_SUBDEV_FL_HAS_EVENTS ;/* i2c access */ -if ((i2c_rd16 (sd,CHIPID ) &MASK_CHIPID ) !=0 ) { +if (i2c_rd16_err (sd,CHIPID , &chipid) || + (chipid &MASK_CHIPID ) !=0 ) {v4l2_info (sd,"not a TC358743 on address 0x%x\n" , client->addr <<1 );return -ENODEV ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 376/515 media: tc358743: Return an appropriate colorspace from tc358743_set_fmt
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Stevenson <[email protected]>
[ Upstream commit 377cc006a364dfdab2f3f221cfad63a9265200b8 ]
When calling tc358743_set_fmt, the code was calling tc358743_get_fmt to choose a valid format. However that sets the colorspace based on information read back from the chip, not the colour format requested.
The result was that if you called try or set format for UYVY when the current format was RGB3 then you would get told SRGB, and try RGB3 when current was UYVY and you would get told SMPTE170M.
The value programmed in the VI_REP register for the colorspace is always set by this driver, therefore there is no need to read back the value, and never set to REC709.
Return the colorspace based on the format set/tried instead.
--- drivers/media/i2c/tc358743.c | 44 ++++++++++++++---------------------- 1 file changed, 17 insertions(+), 27 deletions(-)
drivers/media/i2c/tc358743.c +17 -27
@@ -1708,12 +1708,23 @@ static int tc358743_enum_mbus_code(struct v4l2_subdev *sd,return 0 ; } +static u32 tc358743_g_colorspace (u32 code) +{ +switch (code) { +case MEDIA_BUS_FMT_RGB888_1X24 : +return V4L2_COLORSPACE_SRGB ; +case MEDIA_BUS_FMT_UYVY8_1X16 : +return V4L2_COLORSPACE_SMPTE170M ; +default : +return 0 ; + } +} +static int tc358743_get_fmt (struct v4l2_subdev *sd,struct v4l2_subdev_state *sd_state,struct v4l2_subdev_format *format) {struct tc358743_state *state =to_state (sd); -u8 vi_rep =i2c_rd8 (sd,VI_REP );if (format->pad !=0 )return -EINVAL ;
@@ -1723,23 +1734,7 @@ static int tc358743_get_fmt(struct v4l2_subdev *sd, format->format.height = state->timings.bt.height; format->format.field =V4L2_FIELD_NONE ; -switch (vi_rep &MASK_VOUT_COLOR_SEL ) { -case MASK_VOUT_COLOR_RGB_FULL : -case MASK_VOUT_COLOR_RGB_LIMITED : - format->format.colorspace =V4L2_COLORSPACE_SRGB ; -break ; -case MASK_VOUT_COLOR_601_YCBCR_LIMITED : -case MASK_VOUT_COLOR_601_YCBCR_FULL : - format->format.colorspace =V4L2_COLORSPACE_SMPTE170M ; -break ; -case MASK_VOUT_COLOR_709_YCBCR_FULL : -case MASK_VOUT_COLOR_709_YCBCR_LIMITED : - format->format.colorspace =V4L2_COLORSPACE_REC709 ; -break ; -default : - format->format.colorspace =0 ; -break ; - } + format->format.colorspace =tc358743_g_colorspace (format->format.code);return 0 ; }
@@ -1753,19 +1748,14 @@ static int tc358743_set_fmt(struct v4l2_subdev *sd,u32 code = format->format.code;/* is overwritten by get_fmt */ int ret =tc358743_get_fmt (sd, sd_state, format); - format->format.code = code; +if (code ==MEDIA_BUS_FMT_RGB888_1X24 || + code ==MEDIA_BUS_FMT_UYVY8_1X16 ) + format->format.code = code; + format->format.colorspace =tc358743_g_colorspace (format->format.code);if (ret)return ret; -switch (code) { -case MEDIA_BUS_FMT_RGB888_1X24 : -case MEDIA_BUS_FMT_UYVY8_1X16 : -break ; -default : -return -EINVAL ; - } -if (format->which ==V4L2_SUBDEV_FORMAT_TRY )return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 377/515 media: tc358743: Increase FIFO trigger level to 374
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Stevenson <[email protected]>
[ Upstream commit 86addd25314a1e77dbdcfddfeed0bab2f27da0e2 ]
The existing fixed value of 16 worked for UYVY 720P60 over 2 lanes at 594MHz, or UYVY 1080P60 over 4 lanes. (RGB888 1080P60 needs 6 lanes at 594MHz).
It doesn't allow for lower resolutions to work as the FIFO underflows.
374 is required for 1080P24 or 1080P30 UYVY over 2 lanes @ 972Mbit/s, but >374 means that the FIFO underflows on 1080P50 UYVY over 2 lanes @ 972Mbit/s.
Whilst it would be nice to compute it, the required information isn't published by Toshiba.
--- drivers/media/i2c/tc358743.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/media/i2c/tc358743.c +13 -2
@@ -1979,8 +1979,19 @@ static int tc358743_probe_of(struct tc358743_state *state) state->pdata.refclk_hz =clk_get_rate (refclk); state->pdata.ddc5v_delay =DDC5V_DELAY_100_MS ; state->pdata.enable_hdcp = false; -/* A FIFO level of 16 should be enough for 2-lane 720p60 at 594 MHz. */ - state->pdata.fifo_level =16 ; +/* +* Ideally the FIFO trigger level should be set based on the input and +* output data rates, but the calculations required are buried in +* Toshiba's register settings spreadsheet. +* A value of 16 works with a 594Mbps data rate for 720p60 (using 2 +* lanes) and 1080p60 (using 4 lanes), but fails when the data rate +* is increased, or a lower pixel clock is used that result in CSI +* reading out faster than the data is arriving. +* +* A value of 374 works with both those modes at 594Mbps, and with most +* modes on 972Mbps. +*/ + state->pdata.fifo_level =374 ;/* * The PLL input clock is obtained by dividing refclk by pll_prd. * It must be between 6 MHz and 40 MHz, lower frequency is better.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 378/515 media: usb: hdpvr: disable zero-length read messages
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit b5ae5a79825ba8037b0be3ef677a24de8c063abf ]
This driver passes the length of an i2c_msg directly to usb_control_msg(). If the message is now a read and of length 0, it violates the USB protocol and a warning will be printed. Enable the I2C_AQ_NO_ZERO_LEN_READ quirk for this adapter thus forbidding 0-length read messages altogether.
--- drivers/media/usb/hdpvr/hdpvr-i2c.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/media/usb/hdpvr/hdpvr-i2c.c +6 -0
@@ -165,10 +165,16 @@ static const struct i2c_algorithm hdpvr_algo = { .functionality = hdpvr_functionality, }; +/* prevent invalid 0-length usb_control_msg */ +static const struct i2c_adapter_quirks hdpvr_quirks = { + .flags =I2C_AQ_NO_ZERO_LEN_READ , +}; +static const struct i2c_adapter hdpvr_i2c_adapter_template = { .name ="Hauppauge HD PVR I2C" , .owner =THIS_MODULE , .algo = &hdpvr_algo, + .quirks = &hdpvr_quirks, };static int hdpvr_activate_ir (struct hdpvr_device *dev)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 379/515 media: dvb-frontends: dib7090p: fix null-ptr-deref in dib7090p_rw_on_apb()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Guo <[email protected]>
[ Upstream commit ce5cac69b2edac3e3246fee03e8f4c2a1075238b ]
In dib7090p_rw_on_apb, msg is controlled by user. When msg[0].buf is null and msg[0].len is zero, former checks on msg[0].buf would be passed. If accessing msg[0].buf[2] without sanity check, null pointer deref would happen. We add check on msg[0].len to prevent crash. Similar issue occurs when access msg[1].buf[0] and msg[1].buf[1].
Similar commit: commit 0ed554fd769a ("media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()")
--- drivers/media/dvb-frontends/dib7000p.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/dvb-frontends/dib7000p.c +4 -0
@@ -2256,8 +2256,12 @@ static int dib7090p_rw_on_apb(struct i2c_adapter *i2c_adap,u16 word;if (num ==1 ) {/* write */ +if (msg[0 ].len <3 ) +return -EOPNOTSUPP ;dib7000p_write_word (state, apb_address, ((msg[0 ].buf[1 ] <<8 ) | (msg[0 ].buf[2 ]))); }else { +if (msg[1 ].len <2 ) +return -EOPNOTSUPP ; word =dib7000p_read_word (state, apb_address); msg[1 ].buf[0 ] = (word >>8 ) &0xff ; msg[1 ].buf[1 ] = (word) &0xff ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 380/515 media: dvb-frontends: w7090p: fix null-ptr-deref in w7090p_tuner_write_serpar and w7090p_tuner_read_serpar
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Guo <[email protected]>
[ Upstream commit ed0234c8458b3149f15e496b48a1c9874dd24a1b ]
In w7090p_tuner_write_serpar, msg is controlled by user. When msg[0].buf is null and msg[0].len is zero, former checks on msg[0].buf would be passed. If accessing msg[0].buf[2] without sanity check, null pointer deref would happen. We add check on msg[0].len to prevent crash.
Similar commit: commit 0ed554fd769a ("media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()")
--- drivers/media/dvb-frontends/dib7000p.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/dvb-frontends/dib7000p.c +4 -0
@@ -2193,6 +2193,8 @@ static int w7090p_tuner_write_serpar(struct i2c_adapter *i2c_adap, struct i2c_msstruct dib7000p_state *state =i2c_get_adapdata (i2c_adap);u8 n_overflow =1 ;u16 i =1000 ; +if (msg[0 ].len <3 ) +return -EOPNOTSUPP ;u16 serpar_num = msg[0 ].buf[0 ];while (n_overflow ==1 && i) {
@@ -2212,6 +2214,8 @@ static int w7090p_tuner_read_serpar(struct i2c_adapter *i2c_adap, struct i2c_msgstruct dib7000p_state *state =i2c_get_adapdata (i2c_adap);u8 n_overflow =1 , n_empty =1 ;u16 i =1000 ; +if (msg[0 ].len <1 || msg[1 ].len <2 ) +return -EOPNOTSUPP ;u16 serpar_num = msg[0 ].buf[0 ];u16 read_word;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 381/515 media: uvcvideo: Add quirk for HP Webcam HD 2300
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
[ Upstream commit 53b0b80e5240fec7c5a420bffb310edc83faf4fd ]
HP Webcam HD 2300 does not seem to flip the FID bit according to spec.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 [unknown]
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x03f0 HP, Inc
idProduct 0xe207 HP Webcam HD 2300
bcdDevice 10.20
iManufacturer 3 Hewlett Packard iProduct 1 HP Webcam HD 2300 iSerial 0 bNumConfigurations 1
--- drivers/media/usb/uvc/uvc_driver.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/media/usb/uvc/uvc_driver.c +9 -0
@@ -2511,6 +2511,15 @@ static const struct uvc_device_info uvc_quirk_force_y8 = {* Sort these by vendor/product ID. */ static const struct usb_device_id uvc_ids[] = { +/* HP Webcam HD 2300 */ + { .match_flags =USB_DEVICE_ID_MATCH_DEVICE + |USB_DEVICE_ID_MATCH_INT_INFO , + .idVendor =0x03f0 , + .idProduct =0xe207 , + .bInterfaceClass =USB_CLASS_VIDEO , + .bInterfaceSubClass =1 , + .bInterfaceProtocol =0 , + .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },/* Quanta ACER HD User Facing */ { .match_flags =USB_DEVICE_ID_MATCH_DEVICE |USB_DEVICE_ID_MATCH_INT_INFO ,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 382/515 media: uvcvideo: Set V4L2_CTRL_FLAG_DISABLED during queryctrl errors
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
[ Upstream commit 649c033711d7fd6e1d5d69e4cfc3fceca7de2867 ]
To implement VIDIOC_QUERYCTRL, we need to know the minimum, maximum, step and flags of the control. For some of the controls, this involves querying the actual hardware.
Some non-compliant cameras produce errors when we query them. These error can be triggered every time, sometimes, or when other controls do not have the "right value". Right now, we populate that error to userspace. When an error happens, the v4l2 framework does not copy the v4l2_queryctrl struct to userspace. Also, userspace apps are not ready to handle any other error than -EINVAL.
One of the main usecases of VIDIOC_QUERYCTRL is enumerating the controls of a device. This is done using the V4L2_CTRL_FLAG_NEXT_CTRL flag. In that usecase, a non-compliant control will make it almost impossible to enumerate all controls of the device.
A control with an invalid max/min/step/flags is better than non being able to enumerate the rest of the controls.
This patch:
- Retries for an extra attempt to read the control, to avoid spurious errors. More attempts do not seem to produce better results in the tested hardware.
- Makes VIDIOC_QUERYCTRL return 0 for -EIO errors.
- Introduces a warning in dmesg so we can have a trace of what has happened and sets the V4L2_CTRL_FLAG_DISABLED.
- Makes sure we keep returning V4L2_CTRL_FLAG_DISABLED for all the next attempts to query that control (other operations have the same functionality as now).
--- drivers/media/usb/uvc/uvc_ctrl.c | 55 +++++++++++++++++++++++++++----- drivers/media/usb/uvc/uvcvideo.h | 2 ++ 2 files changed, 49 insertions(+), 8 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +47 -8
@@ -1483,14 +1483,28 @@ static u32 uvc_get_ctrl_bitmap(struct uvc_control *ctrl,return ~0 ; } +/* +* Maximum retry count to avoid spurious errors with controls. Increasing this +* value does no seem to produce better results in the tested hardware. +*/ +#define MAX_QUERY_RETRIES 2 +static int __uvc_queryctrl_boundaries (struct uvc_video_chain *chain,struct uvc_control *ctrl,struct uvc_control_mapping *mapping,struct v4l2_query_ext_ctrl *v4l2_ctrl) {if (!ctrl->cached) { -int ret =uvc_ctrl_populate_cache (chain, ctrl); -if (ret <0 ) +unsigned int retries; +int ret; + +for (retries =0 ; retries <MAX_QUERY_RETRIES ; retries++) { + ret =uvc_ctrl_populate_cache (chain, ctrl); +if (ret != -EIO ) +break ; + } + +if (ret)return ret; }
@@ -1567,6 +1581,7 @@ static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, {struct uvc_control_mapping *master_map =NULL ;struct uvc_control *master_ctrl =NULL ; +int ret;memset (v4l2_ctrl,0 ,sizeof (*v4l2_ctrl)); v4l2_ctrl->id = mapping->id;
@@ -1587,18 +1602,31 @@ static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,__uvc_find_control (ctrl->entity, mapping->master_id, &master_map, &master_ctrl,0 ,0 );if (master_ctrl && (master_ctrl->info.flags &UVC_CTRL_FLAG_GET_CUR )) { +unsigned int retries;s32 val;int ret;if (WARN_ON (uvc_ctrl_mapping_is_compound (master_map)))return -EIO ; - ret =__uvc_ctrl_get (chain, master_ctrl, master_map, &val); -if (ret <0 ) -return ret; +for (retries =0 ; retries <MAX_QUERY_RETRIES ; retries++) { + ret =__uvc_ctrl_get (chain, master_ctrl, master_map, + &val); +if (!ret) +break ; +if (ret <0 && ret != -EIO ) +return ret; + } -if (val != mapping->master_manual) - v4l2_ctrl->flags |=V4L2_CTRL_FLAG_INACTIVE ; +if (ret == -EIO ) { +dev_warn_ratelimited (&chain->dev->udev->dev, +"UVC non compliance: Error %d querying master control %x (%s)\n" , + ret, master_map->id, +uvc_map_get_name (master_map)); + }else { +if (val != mapping->master_manual) + v4l2_ctrl->flags |=V4L2_CTRL_FLAG_INACTIVE ; + } } v4l2_ctrl->elem_size =uvc_mapping_v4l2_size (mapping);
@@ -1613,7 +1641,18 @@ static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,return 0 ; } -return __uvc_queryctrl_boundaries (chain, ctrl, mapping, v4l2_ctrl); + ret =__uvc_queryctrl_boundaries (chain, ctrl, mapping, v4l2_ctrl); +if (ret && !mapping->disabled) { +dev_warn (&chain->dev->udev->dev, +"UVC non compliance: permanently disabling control %x (%s), due to error %d\n" , + mapping->id,uvc_map_get_name (mapping), ret); + mapping->disabled = true; + } + +if (mapping->disabled) + v4l2_ctrl->flags |=V4L2_CTRL_FLAG_DISABLED ; + +return 0 ; } int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
drivers/media/usb/uvc/uvcvideo.h +2 -0
@@ -134,6 +134,8 @@ struct uvc_control_mapping {s32 master_manual;u32 slave_ids[2 ]; +bool disabled; +const struct uvc_control_mapping *(*filter_mapping) (struct uvc_video_chain *chain,struct uvc_control *ctrl);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 383/515 media: uvcvideo: Fix bandwidth issue for Alcor camera
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: chenchangcheng <[email protected]>
[ Upstream commit 9764401bf6f8a20eb11c2e78470f20fee91a9ea7 ]
Some broken device return wrong dwMaxPayloadTransferSize fields as follows:
[ 218.632537] uvcvideo: Device requested 2752512 B/frame bandwidth. [ 218.632598] uvcvideo: No fast enough alt setting for requested bandwidth.
When dwMaxPayloadTransferSize is greater than maxpsize, it will prevent the camera from starting. So use the bandwidth of maxpsize.
--- drivers/media/usb/uvc/uvc_video.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/media/usb/uvc/uvc_video.c +9 -0
@@ -262,6 +262,15 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream, ctrl->dwMaxPayloadTransferSize = bandwidth; } + +if (stream->intf->num_altsetting >1 && + ctrl->dwMaxPayloadTransferSize > stream->maxpsize) { +dev_warn_ratelimited (&stream->intf->dev, +"UVC non compliance: the max payload transmission size (%u) exceeds the size of the ep max packet (%u). Using the max size.\n" , + ctrl->dwMaxPayloadTransferSize, + stream->maxpsize); + ctrl->dwMaxPayloadTransferSize = stream->maxpsize; + } }static size_t uvc_video_ctrl_size (struct uvc_streaming *stream)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 384/515 crypto: octeontx2 - add timeout for load_fvc completion poll
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bharat Bhushan <[email protected]>
[ Upstream commit 2157e50f65d2030f07ea27ef7ac4cfba772e98ac ]
Adds timeout to exit from possible infinite loop, which polls on CPT instruction(load_fvc) completion.
--- .../crypto/marvell/octeontx2/otx2_cptpf_ucode.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c +14 -2
@@ -1494,6 +1494,7 @@ int otx2_cpt_discover_eng_capabilities(struct otx2_cptpf_dev *cptpf)dma_addr_t rptr_baddr;struct pci_dev *pdev;u32 len, compl_rlen; +int timeout =10000 ;int ret, etype;void *rptr;
@@ -1556,16 +1557,27 @@ int otx2_cpt_discover_eng_capabilities(struct otx2_cptpf_dev *cptpf) etype);otx2_cpt_fill_inst (&inst, &iq_cmd, rptr_baddr); lfs->ops->send_cmd (&inst,1 , &cptpf->lfs.lf[0 ]); + timeout =10000 ;while (lfs->ops->cpt_get_compcode (result) == -OTX2_CPT_COMPLETION_CODE_INIT ) +OTX2_CPT_COMPLETION_CODE_INIT ) {cpu_relax (); +udelay (1 ); + timeout--; +if (!timeout) { + ret = -ENODEV ; + cptpf->is_eng_caps_discovered = false; +dev_warn (&pdev->dev,"Timeout on CPT load_fvc completion poll\n" ); + goto error_no_response; + } + } cptpf->eng_caps[etype].u =be64_to_cpup (rptr); } -dma_unmap_single (&pdev->dev, rptr_baddr, len,DMA_BIDIRECTIONAL ); cptpf->is_eng_caps_discovered = true; +error_no_response: +dma_unmap_single (&pdev->dev, rptr_baddr, len,DMA_BIDIRECTIONAL ); free_result:kfree (result); lf_cleanup:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 385/515 crypto: ccp - Add missing bootloader info reg for pspv6
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit aaeff14688d0254b39731d9bb303c79bfd610f7d ]
The bootloader info reg for pspv6 is the same as pspv4 and pspv5.
--- drivers/crypto/ccp/sp-pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/ccp/sp-pci.c +1 -0
@@ -451,6 +451,7 @@ static const struct psp_vdata pspv6 = { .cmdresp_reg = 0x10944, /* C2PMSG_17 */ .cmdbuff_addr_lo_reg = 0x10948, /* C2PMSG_18 */ .cmdbuff_addr_hi_reg = 0x1094c, /* C2PMSG_19 */ + .bootloader_info_reg = 0x109ec, /* C2PMSG_59 */ .feature_reg = 0x109fc, /* C2PMSG_63 */ .inten_reg = 0x10510, /* P2CMSG_INTEN */ .intsts_reg = 0x10514, /* P2CMSG_INTSTS */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 386/515 clk: renesas: rzg2l: Postpone updating priv->clks[]
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
[ Upstream commit 2f96afdffad4ef74e3c511207058c41c54a2d014 ]
Since the sibling data is filled after the priv->clks[] array entry is populated, the first clock that is probed and has a sibling will temporarily behave as its own sibling until its actual sibling is populated. To avoid any issues, postpone updating priv->clks[] until after the sibling is populated.
--- drivers/clk/renesas/rzg2l-cpg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/renesas/rzg2l-cpg.c +4 -4
@@ -1388,10 +1388,6 @@ rzg2l_cpg_register_mod_clk(const struct rzg2l_mod_clk *mod, goto fail; } - clk = clock->hw.clk; -dev_dbg (dev,"Module clock %pC at %lu Hz\n" , clk,clk_get_rate (clk)); - priv->clks[id] = clk; -if (mod->is_coupled) {struct mstp_clock *sibling;
@@ -1403,6 +1399,10 @@ rzg2l_cpg_register_mod_clk(const struct rzg2l_mod_clk *mod, } } + clk = clock->hw.clk; +dev_dbg (dev,"Module clock %pC at %lu Hz\n" , clk,clk_get_rate (clk)); + priv->clks[id] = clk; +return ; fail:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 387/515 soundwire: amd: serialize amd manager resume sequence during pm_prepare
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vijendar Mukunda <[email protected]>
[ Upstream commit 03837341790039d6f1cbf7a1ae7dfa2cb77ef0a4 ]
During pm_prepare callback, pm_request_resume() delays SoundWire manager D0 entry sequence. Synchronize runtime resume sequence for amd_manager instance prior to invoking child devices resume sequence for both the amd power modes(ClockStop Mode and Power off mode).
Change the power_mode_mask check and use pm_runtime_resume() in amd_pm_prepare() callback.
--- drivers/soundwire/amd_manager.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/soundwire/amd_manager.c +3 -3
@@ -1178,10 +1178,10 @@ static int __maybe_unused amd_pm_prepare(struct device *dev)* device is not in runtime suspend state, observed that device alerts are missing * without pm_prepare on AMD platforms in clockstop mode0. */ -if (amd_manager->power_mode_mask &AMD_SDW_CLK_STOP_MODE ) { - ret =pm_request_resume (dev); +if (amd_manager->power_mode_mask) { + ret =pm_runtime_resume (dev);if (ret <0 ) { -dev_err (bus->dev,"pm_request_resume failed: %d\n" , ret); +dev_err (bus->dev,"pm_runtime_resume failed: %d\n" , ret);return 0 ; } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 388/515 soundwire: amd: cancel pending slave status handling workqueue during remove sequence
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vijendar Mukunda <[email protected]>
[ Upstream commit f93b697ed98e3c85d1973ea170d4f4e7a6b2b45d ]
During remove sequence, cancel the pending slave status update workqueue.
--- drivers/soundwire/amd_manager.c | 1 + 1 file changed, 1 insertion(+)
drivers/soundwire/amd_manager.c +1 -0
@@ -1074,6 +1074,7 @@ static void amd_sdw_manager_remove(struct platform_device *pdev)int ret;pm_runtime_disable (&pdev->dev); +cancel_work_sync (&amd_manager->amd_sdw_work);amd_disable_sdw_interrupts (amd_manager);sdw_bus_master_delete (&amd_manager->bus); ret =amd_disable_sdw_manager (amd_manager);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 389/515 soundwire: Move handle_nested_irq outside of sdw_dev_lock
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
[ Upstream commit ccb7bb13c00bcc3178d270da052635c56148bc16 ]
The sdw_dev_lock protects the SoundWire driver callbacks against the probed flag, which is used to skip the callbacks if the driver gets removed. For more information see commit bd29c00edd0a ("soundwire: revisit driver bind/unbind and callbacks").
However, this lock is a frequent source of mutex inversions. Many audio operations eventually hit the hardware resulting in a SoundWire callback, this means that typically the driver has the locking order ALSA/ASoC locks -> sdw_dev_lock. Conversely, the IRQ comes in directly from the SoundWire hardware, but then will often want to access ALSA/ASoC, such as updating something in DAPM or an ALSA control. This gives the other lock order sdw_dev_lock -> ALSA/ASoC locks.
When the IRQ handling was initially added to SoundWire this was through a callback mechanism. As such it required being covered by the lock because the callbacks are part of the sdw_driver structure and are thus present regardless of if the driver is currently probed.
Since then a newer mechanism using the IRQ framework has been added, which is currently covered by the same lock but this isn't actually required. Handlers for the IRQ framework are registered in probe and should by released during remove, thus the IRQ framework will have already unbound the IRQ before the slave driver is removed. Avoid the aforementioned mutex inversion by moving the handle_nested_irq call outside of the sdw_dev_lock.
--- drivers/soundwire/bus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/soundwire/bus.c +3 -3
@@ -1756,15 +1756,15 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)/* Update the Slave driver */ if (slave_notify) { +if (slave->prop.use_domain_irq && slave->irq) +handle_nested_irq (slave->irq); +mutex_lock (&slave->sdw_dev_lock);if (slave->probed) {struct device *dev = &slave->dev;struct sdw_driver *drv =drv_to_sdw_driver (dev->driver); -if (slave->prop.use_domain_irq && slave->irq) -handle_nested_irq (slave->irq); -if (drv->ops && drv->ops->interrupt_callback) { slave_intr.sdca_cascade = sdca_cascade; slave_intr.control_port = clear;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 390/515 md: dm-zoned-target: Initialize return variable r to avoid uninitialized use
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Purva Yeshi <[email protected]>
[ Upstream commit 487767bff572d46f7c37ad846c4078f6d6c9cc55 ]
Fix Smatch-detected error:drivers/md/dm-zoned-target.c:1073 dmz_iterate_devices()
error: uninitialized symbol 'r'.
Smatch detects a possible use of the uninitialized variable 'r' in dmz_iterate_devices() because if dmz->nr_ddevs is zero, the loop is skipped and 'r' is returned without being set, leading to undefined behavior.
Initialize 'r' to 0 before the loop. This ensures that if there are no devices to iterate over, the function still returns a defined value.
--- drivers/md/dm-zoned-target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-zoned-target.c +1 -1
@@ -1061,7 +1061,7 @@ static int dmz_iterate_devices(struct dm_target *ti,struct dmz_target *dmz = ti->private;unsigned int zone_nr_sectors =dmz_zone_nr_sectors (dmz->metadata);sector_t capacity; -int i, r; +int i, r =0 ;for (i =0 ; i < dmz->nr_ddevs; i++) { capacity = dmz->dev[i].capacity & ~(zone_nr_sectors -1 );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 391/515 module: Prevent silent truncation of module name in delete_module(2)
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Pavlu <[email protected]>
[ Upstream commit a6323bd4e611567913e23df5b58f2d4e4da06789 ]
Passing a module name longer than MODULE_NAME_LEN to the delete_module syscall results in its silent truncation. This really isn't much of a problem in practice, but it could theoretically lead to the removal of an incorrect module. It is more sensible to return ENAMETOOLONG or ENOENT in such a case.
Update the syscall to return ENOENT, as documented in the delete_module(2) man page to mean "No module by that name exists." This is appropriate because a module with a name longer than MODULE_NAME_LEN cannot be loaded in the first place.
--- kernel/module/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
kernel/module/main.c +6 -4
@@ -727,14 +727,16 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user,struct module *mod;char name[MODULE_NAME_LEN ];char buf[MODULE_FLAGS_BUF_SIZE ]; -int ret, forced =0 ; +int ret, len, forced =0 ;if (!capable (CAP_SYS_MODULE ) || modules_disabled)return -EPERM ; -if (strncpy_from_user (name, name_user,MODULE_NAME_LEN -1 ) <0 ) -return -EFAULT ; - name[MODULE_NAME_LEN -1 ] ='\0' ; + len =strncpy_from_user (name, name_user,MODULE_NAME_LEN ); +if (len ==0 || len ==MODULE_NAME_LEN ) +return -ENOENT ; +if (len <0 ) +return len;audit_log_kern_module (name);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 392/515 i3c: add missing include to internal header
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit 3b661ca549b9e5bb11d0bc97ada6110aac3282d2 ]
LKP found a random config which failed to build because IO accessors were not defined:
In file included from drivers/i3c/master.c:21:
drivers/i3c/internals.h: In function 'i3c_writel_fifo':
Quoted 1 line
Quoted 1 line
drivers/i3c/internals.h:35:9: error: implicit declaration of function 'writesl' [-Werror=implicit-function-declaration]
Add the proper header to where the IO accessors are used.
--- drivers/i3c/internals.h | 1 + 1 file changed, 1 insertion(+)
drivers/i3c/internals.h +1 -0
@@ -9,6 +9,7 @@#define I3C_INTERNALS_H #include <linux/i3c/master.h> +#include <linux/io.h> void i3c_bus_normaluse_lock (struct i3c_bus *bus);void i3c_bus_normaluse_unlock (struct i3c_bus *bus);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 393/515 rtc: ds1307: handle oscillator stop flag (OSF) for ds1341
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Meagan Lloyd <[email protected]>
[ Upstream commit 523923cfd5d622b8f4ba893fdaf29fa6adeb8c3e ]
In using CONFIG_RTC_HCTOSYS, rtc_hctosys() will sync the RTC time to the kernel time as long as rtc_read_time() succeeds. In some power loss situations, our supercapacitor-backed DS1342 RTC comes up with either an unpredictable future time or the default 01/01/00 from the datasheet. The oscillator stop flag (OSF) is set in these scenarios due to the power loss and can be used to determine the validity of the RTC data.
This change expands the oscillator stop flag (OSF) handling that has already been implemented for some chips to the ds1341 chip (DS1341 and DS1342 share a datasheet). This handling manages the validity of the RTC data in .read_time and .set_time based on the OSF.
--- drivers/rtc/rtc-ds1307.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/rtc/rtc-ds1307.c +11 -0
@@ -279,6 +279,13 @@ static int ds1307_get_time(struct device *dev, struct rtc_time *t)if (tmp &DS1340_BIT_OSF )return -EINVAL ;break ; +case ds_1341: + ret =regmap_read (ds1307->regmap,DS1337_REG_STATUS , &tmp); +if (ret) +return ret; +if (tmp &DS1337_BIT_OSF ) +return -EINVAL ; +break ;case ds_1388: ret =regmap_read (ds1307->regmap,DS1388_REG_FLAG , &tmp);if (ret)
@@ -377,6 +384,10 @@ static int ds1307_set_time(struct device *dev, struct rtc_time *t)regmap_update_bits (ds1307->regmap,DS1340_REG_FLAG ,DS1340_BIT_OSF ,0 );break ; +case ds_1341: +regmap_update_bits (ds1307->regmap,DS1337_REG_STATUS , +DS1337_BIT_OSF ,0 ); +break ;case ds_1388:regmap_update_bits (ds1307->regmap,DS1388_REG_FLAG ,DS1388_BIT_OSF ,0 );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 394/515 apparmor: shift ouid when mediating hard links in userns
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriel Totev <[email protected]>
[ Upstream commit c5bf96d20fd787e4909b755de4705d52f3458836 ]
When using AppArmor profiles inside an unprivileged container, the link operation observes an unshifted ouid. (tested with LXD and Incus)
For example, root inside container and uid 1000000 outside, with owner /root/link l, profile entry for ln:
/root$ touch chain && ln chain link
==> dmesg
apparmor="DENIED" operation="link" class="file" namespace="root//lxd-feet_<var-snap-lxd-common-lxd>" profile="linkit" name="/root/link" pid=1655 comm="ln" requested_mask="l" denied_mask="l" fsuid=1000000 ouid=0 [<== should be 1000000] target="/root/chain"
Fix by mapping inode uid of old_dentry in aa_path_link() rather than using it directly, similarly to how it's mapped in __file_path_perm() later in the file.
--- security/apparmor/file.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
security/apparmor/file.c +4 -2
@@ -423,9 +423,11 @@ int aa_path_link(const struct cred *subj_cred, {struct path link = { .mnt = new_dir->mnt, .dentry = new_dentry };struct path target = { .mnt = new_dir->mnt, .dentry = old_dentry }; +struct inode *inode =d_backing_inode (old_dentry); +vfsuid_t vfsuid =i_uid_into_vfsuid (mnt_idmap (target.mnt), inode);struct path_cond cond = { -d_backing_inode (old_dentry)->i_uid, -d_backing_inode (old_dentry)->i_mode + .uid =vfsuid_into_kuid (vfsuid), + .mode = inode->i_mode, };char *buffer =NULL , *buffer2 =NULL ;struct aa_profile *profile;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 395/515 i3c: dont fail if GETHDRCAP is unsupported
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit 447270cdb41b1c8c3621bb14b93a6749f942556e ]
'I3C_BCR_HDR_CAP' is still spec v1.0 and has been renamed to 'advanced capabilities' in v1.1 onwards. The ST pressure sensor LPS22DF does not have HDR, but has the 'advanced cap' bit set. The core still wants to get additional information using the CCC 'GETHDRCAP' (or GETCAPS in v1.1 onwards). Not all controllers support this CCC and will notify the upper layers about it. For instantiating the device, we can ignore this unsupported CCC as standard communication will work. Without this patch, the device will not be instantiated at all.
--- drivers/i3c/master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i3c/master.c +1 -1
@@ -1439,7 +1439,7 @@ static int i3c_master_retrieve_dev_info(struct i3c_dev_desc *dev)if (dev->info.bcr &I3C_BCR_HDR_CAP ) { ret =i3c_master_gethdrcap_locked (master, &dev->info); -if (ret) +if (ret && ret != -ENOTSUPP )return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 396/515 i3c: master: Initialize ret in i3c_i2c_notifier_call()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jorge Marques <[email protected]>
[ Upstream commit 290ce8b2d0745e45a3155268184523a8c75996f1 ]
Set ret to -EINVAL if i3c_i2c_notifier_call() receives an invalid action, resolving uninitialized warning.
--- drivers/i3c/master.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/i3c/master.c +2 -0
@@ -2467,6 +2467,8 @@ static int i3c_i2c_notifier_call(struct notifier_block *nb, unsigned long actioncase BUS_NOTIFY_DEL_DEVICE : ret =i3c_master_i2c_detach (adap, client);break ; +default : + ret = -EINVAL ; }i3c_bus_maintenance_unlock (&master->bus);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 397/515 dm-mpath: dont print the "loaded" message if registering fails
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
[ Upstream commit 6e11952a6abc4641dc8ae63f01b318b31b44e8db ]
If dm_register_path_selector, don't print the "version X loaded" message.
--- drivers/md/dm-ps-historical-service-time.c | 4 +++- drivers/md/dm-ps-queue-length.c | 4 +++- drivers/md/dm-ps-round-robin.c | 4 +++- drivers/md/dm-ps-service-time.c | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-)
drivers/md/dm-ps-historical-service-time.c +3 -1
@@ -541,8 +541,10 @@ static int __init dm_hst_init(void) {int r =dm_register_path_selector (&hst_ps); -if (r <0 ) +if (r <0 ) {DMERR ("register failed %d" , r); +return r; + }DMINFO ("version " HST_VERSION " loaded" );
drivers/md/dm-ps-queue-length.c +3 -1
@@ -260,8 +260,10 @@ static int __init dm_ql_init(void) {int r =dm_register_path_selector (&ql_ps); -if (r <0 ) +if (r <0 ) {DMERR ("register failed %d" , r); +return r; + }DMINFO ("version " QL_VERSION " loaded" );
drivers/md/dm-ps-round-robin.c +3 -1
@@ -220,8 +220,10 @@ static int __init dm_rr_init(void) {int r =dm_register_path_selector (&rr_ps); -if (r <0 ) +if (r <0 ) {DMERR ("register failed %d" , r); +return r; + }DMINFO ("version " RR_VERSION " loaded" );
drivers/md/dm-ps-service-time.c +3 -1
@@ -341,8 +341,10 @@ static int __init dm_st_init(void) {int r =dm_register_path_selector (&st_ps); -if (r <0 ) +if (r <0 ) {DMERR ("register failed %d" , r); +return r; + }DMINFO ("version " ST_VERSION " loaded" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 398/515 dm-table: fix checking for rq stackable devices
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Marzinski <[email protected]>
[ Upstream commit 8ca719b81987be690f197e82fdb030580c0a07f3 ]
Due to the semantics of iterate_devices(), the current code allows a request-based dm table as long as it includes one request-stackable device. It is supposed to only allow tables where there are no non-request-stackable devices.
--- drivers/md/dm-table.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/md/dm-table.c +5 -5
@@ -900,17 +900,17 @@ static bool dm_table_supports_dax(struct dm_table *t,return true; } -static int device_is_rq_stackable (struct dm_target *ti,struct dm_dev *dev, -sector_t start,sector_t len,void *data) +static int device_is_not_rq_stackable (struct dm_target *ti,struct dm_dev *dev, +sector_t start,sector_t len,void *data) {struct block_device *bdev = dev->bdev;struct request_queue *q =bdev_get_queue (bdev);/* request-based cannot stack on partitions! */ if (bdev_is_partition (bdev)) -return false; +return true; -return queue_is_mq (q); +return !queue_is_mq (q); }static int dm_table_determine_type (struct dm_table *t)
@@ -1006,7 +1006,7 @@ static int dm_table_determine_type(struct dm_table *t)/* Non-request-stackable devices can't be used for request-based dm */ if (!ti->type->iterate_devices || - !ti->type->iterate_devices (ti, device_is_rq_stackable,NULL )) { + ti->type->iterate_devices (ti, device_is_not_rq_stackable,NULL )) {DMERR ("table load rejected: including non-request-stackable devices" );return -EINVAL ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 399/515 apparmor: use the condition in AA_BUG_FMT even with debug disabled
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mateusz Guzik <[email protected]>
[ Upstream commit 67e370aa7f968f6a4f3573ed61a77b36d1b26475 ]
This follows the established practice and fixes a build failure for me:security/apparmor/file.c: In function ‘__file_sock_perm’:security/apparmor/file.c:544:24: error: unused variable ‘sock’ [-Werror=unused-variable]
544 | struct socket *sock = (struct socket *) file->private_data;
| ^~~~
--- security/apparmor/include/lib.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
security/apparmor/include/lib.h +5 -1
@@ -48,7 +48,11 @@ extern struct aa_dfa *stacksplitdfa; #define AA_BUG_FMT(X, fmt, args...) \ WARN((X), "AppArmor WARN %s: (" #X "): " fmt, __func__, ##args)#else -#define AA_BUG_FMT(X, fmt, args...) no_printk(fmt, ##args) +#define AA_BUG_FMT(X, fmt, args...) \ + do { \ + BUILD_BUG_ON_INVALID(X); \ + no_printk(fmt, ##args); \ + } while (0)#endif #define AA_ERROR(fmt, args...) \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 400/515 apparmor: fix x_table_lookup when stacking is not the first entry
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Johansen <[email protected]>
[ Upstream commit a9eb185be84e998aa9a99c7760534ccc06216705 ]
x_table_lookup currently does stacking during label_parse() if the target specifies a stack but its only caller ensures that it will never be used with stacking.
Refactor to slightly simplify the code in x_to_label(), this also fixes a long standing problem where x_to_labels check on stacking is only on the first element to the table option list, instead of the element that is found and used.
--- security/apparmor/domain.c | 52 +++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 23 deletions(-)
security/apparmor/domain.c +29 -23
@@ -508,6 +508,7 @@ static const char *next_name(int xtype, const char *name)* @name: returns: name tested to find label (NOT NULL) * * Returns: refcounted label, or NULL on failure (MAYBE NULL) +* @name will always be set with the last name tried */ struct aa_label *x_table_lookup (struct aa_profile *profile,u32 xindex,const char **name)
@@ -517,6 +518,7 @@ struct aa_label *x_table_lookup(struct aa_profile *profile, u32 xindex,struct aa_label *label =NULL ;u32 xtype = xindex &AA_X_TYPE_MASK ;int index = xindex &AA_X_INDEX_MASK ; +const char *next;AA_BUG (!name);
@@ -524,25 +526,27 @@ struct aa_label *x_table_lookup(struct aa_profile *profile, u32 xindex,/* TODO: move lookup parsing to unpack time so this is a straight * index into the resultant label */ -for (*name = rules->file->trans.table[index]; !label && *name; - *name =next_name (xtype, *name)) { +for (next = rules->file->trans.table[index]; next; + next =next_name (xtype, next)) { +const char *lookup = (*next =='&' ) ? next +1 : next; + *name = next;if (xindex &AA_X_CHILD ) { -struct aa_profile *new_profile; -/* release by caller */ - new_profile =aa_find_child (profile, *name); -if (new_profile) - label = &new_profile->label; +/* TODO: switich to parse to get stack of child */ +struct aa_profile *new =aa_find_child (profile, lookup); + +if (new) +/* release by caller */ +return &new->label;continue ; } - label =aa_label_parse (&profile->label, *name,GFP_KERNEL , + label =aa_label_parse (&profile->label, lookup,GFP_KERNEL , true, false); -if (IS_ERR (label)) - label =NULL ; +if (!IS_ERR_OR_NULL (label)) +/* release by caller */ +return label; } -/* released by caller */ - -return label; +return NULL ; }/**
@@ -567,9 +571,9 @@ static struct aa_label *x_to_label(struct aa_profile *profile,struct aa_ruleset *rules =list_first_entry (&profile->rules,typeof (*rules), list);struct aa_label *new =NULL ; +struct aa_label *stack =NULL ;struct aa_ns *ns = profile->ns;u32 xtype = xindex &AA_X_TYPE_MASK ; -const char *stack =NULL ;switch (xtype) {case AA_X_NONE :
@@ -578,13 +582,14 @@ static struct aa_label *x_to_label(struct aa_profile *profile,break ;case AA_X_TABLE :/* TODO: fix when perm mapping done at unload */ - stack = rules->file->trans.table[xindex &AA_X_INDEX_MASK ]; -if (*stack !='&' ) { -/* released by caller */ - new =x_table_lookup (profile, xindex, lookupname); - stack =NULL ; +/* released by caller +* if null for both stack and direct want to try fallback +*/ + new =x_table_lookup (profile, xindex, lookupname); +if (!new || **lookupname !='&' )break ; - } + stack = new; + new =NULL ; fallthrough;/* to X_NAME */ case AA_X_NAME :if (xindex &AA_X_CHILD )
@@ -599,6 +604,7 @@ static struct aa_label *x_to_label(struct aa_profile *profile,break ; } +/* fallback transition check */ if (!new) {if (xindex &AA_X_INHERIT ) {/* (p|c|n)ix - don't change profile but do
@@ -617,12 +623,12 @@ static struct aa_label *x_to_label(struct aa_profile *profile,/* base the stack on post domain transition */ struct aa_label *base = new; - new =aa_label_parse (base, stack,GFP_KERNEL , true, false); -if (IS_ERR (new)) - new =NULL ; + new =aa_label_merge (base, stack,GFP_KERNEL ); +/* null on error */ aa_put_label (base); } +aa_put_label (stack);/* released by caller */ return new; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 401/515 i2c: Force DLL0945 touchpad i2c freq to 100khz
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: fangzhong.zhou <[email protected]>
[ Upstream commit 0b7c9528facdb5a73ad78fea86d2e95a6c48dbc4 ]
This patch fixes an issue where the touchpad cursor movement becomes slow on the Dell Precision 5560. Force the touchpad freq to 100khz as a workaround.
Tested on Dell Precision 5560 with 6.14 to 6.14.6. Cursor movement is now smooth and responsive.
--- drivers/i2c/i2c-core-acpi.c | 1 + 1 file changed, 1 insertion(+)
drivers/i2c/i2c-core-acpi.c +1 -0
@@ -370,6 +370,7 @@ static const struct acpi_device_id i2c_acpi_force_100khz_device_ids[] = {* the device works without issues on Windows at what is expected to be * a 400KHz frequency. The root cause of the issue is not known. */ + { "DLL0945", 0 }, { "ELAN06FA", 0 }, {} };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 402/515 exfat: add cluster chain loop check for dir
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuezhang Mo <[email protected]>
[ Upstream commit 99f9a97dce39ad413c39b92c90393bbd6778f3fd ]
An infinite loop may occur if the following conditions occur due to file system corruption.
(1) Condition for exfat_count_dir_entries() to loop infinitely.
- The cluster chain includes a loop.
- There is no UNUSED entry in the cluster chain.
(2) Condition for exfat_create_upcase_table() to loop infinitely.
- The cluster chain of the root directory includes a loop.
- There are no UNUSED entry and up-case table entry in the cluster chain of the root directory.
(3) Condition for exfat_load_bitmap() to loop infinitely.
- The cluster chain of the root directory includes a loop.
- There are no UNUSED entry and bitmap entry in the cluster chain of the root directory.
(4) Condition for exfat_find_dir_entry() to loop infinitely.
- The cluster chain includes a loop.
- The unused directory entries were exhausted by some operation.
(5) Condition for exfat_check_dir_empty() to loop infinitely.
- The cluster chain includes a loop.
- The unused directory entries were exhausted by some operation.
- All files and sub-directories under the directory are deleted.
This commit adds checks to break the above infinite loop.
--- fs/exfat/dir.c | 12 ++++++++++++ fs/exfat/fatent.c | 10 ++++++++++ fs/exfat/namei.c | 5 +++++ fs/exfat/super.c | 32 +++++++++++++++++++++----------- 4 files changed, 48 insertions(+), 11 deletions(-)
fs/exfat/dir.c +12 -0
@@ -996,6 +996,7 @@ int exfat_find_dir_entry(struct super_block *sb, struct exfat_inode_info *ei,struct exfat_hint_femp candi_empty;struct exfat_sb_info *sbi =EXFAT_SB (sb);int num_entries =exfat_calc_num_entries (p_uniname); +unsigned int clu_count =0 ;if (num_entries <0 )return num_entries;
@@ -1133,6 +1134,10 @@ int exfat_find_dir_entry(struct super_block *sb, struct exfat_inode_info *ei, }else {if (exfat_get_next_cluster (sb, &clu.dir))return -EIO ; + +/* break if the cluster chain includes a loop */ +if (unlikely (++clu_count >EXFAT_DATA_CLUSTER_COUNT (sbi))) + goto not_found; } }
@@ -1195,6 +1200,7 @@ int exfat_count_dir_entries(struct super_block *sb, struct exfat_chain *p_dir)int i, count =0 ;int dentries_per_clu;unsigned int entry_type; +unsigned int clu_count =0 ;struct exfat_chain clu;struct exfat_dentry *ep;struct exfat_sb_info *sbi =EXFAT_SB (sb);
@@ -1227,6 +1233,12 @@ int exfat_count_dir_entries(struct super_block *sb, struct exfat_chain *p_dir) }else {if (exfat_get_next_cluster (sb, &(clu.dir)))return -EIO ; + +if (unlikely (++clu_count > sbi->used_clusters)) { +exfat_fs_error (sb,"FAT or bitmap is corrupted" ); +return -EIO ; + } + } }
fs/exfat/fatent.c +10 -0
@@ -490,5 +490,15 @@ int exfat_count_num_clusters(struct super_block *sb, } *ret_count = count; + +/* +* since exfat_count_used_clusters() is not called, sbi->used_clusters +* cannot be used here. +*/ +if (unlikely (i == sbi->num_clusters && clu !=EXFAT_EOF_CLUSTER )) { +exfat_fs_error (sb,"The cluster chain has a loop" ); +return -EIO ; + } +return 0 ; }
fs/exfat/namei.c +5 -0
@@ -890,6 +890,7 @@ static int exfat_check_dir_empty(struct super_block *sb, {int i, dentries_per_clu;unsigned int type; +unsigned int clu_count =0 ;struct exfat_chain clu;struct exfat_dentry *ep;struct exfat_sb_info *sbi =EXFAT_SB (sb);
@@ -926,6 +927,10 @@ static int exfat_check_dir_empty(struct super_block *sb, }else {if (exfat_get_next_cluster (sb, &(clu.dir)))return -EIO ; + +/* break if the cluster chain includes a loop */ +if (unlikely (++clu_count >EXFAT_DATA_CLUSTER_COUNT (sbi))) +break ; } }
fs/exfat/super.c +21 -11
@@ -341,13 +341,12 @@ static void exfat_hash_init(struct super_block *sb)INIT_HLIST_HEAD (&sbi->inode_hashtable[i]); } -static int exfat_read_root (struct inode *inode) +static int exfat_read_root (struct inode *inode,struct exfat_chain *root_clu) {struct super_block *sb = inode->i_sb;struct exfat_sb_info *sbi =EXFAT_SB (sb);struct exfat_inode_info *ei =EXFAT_I (inode); -struct exfat_chain cdir; -int num_subdirs, num_clu =0 ; +int num_subdirs;exfat_chain_set (&ei->dir, sbi->root_dir,0 ,ALLOC_FAT_CHAIN ); ei->entry =-1 ;
@@ -360,12 +359,9 @@ static int exfat_read_root(struct inode *inode) ei->hint_stat.clu = sbi->root_dir; ei->hint_femp.eidx =EXFAT_HINT_NONE ; -exfat_chain_set (&cdir, sbi->root_dir,0 ,ALLOC_FAT_CHAIN ); -if (exfat_count_num_clusters (sb, &cdir, &num_clu)) -return -EIO ; -i_size_write (inode, num_clu << sbi->cluster_size_bits); +i_size_write (inode,EXFAT_CLU_TO_B (root_clu->size, sbi)); - num_subdirs =exfat_count_dir_entries (sb, &cdir); + num_subdirs =exfat_count_dir_entries (sb, root_clu);if (num_subdirs <0 )return -EIO ;set_nlink (inode, num_subdirs +EXFAT_MIN_SUBDIR );
@@ -578,7 +574,8 @@ static int exfat_verify_boot_region(struct super_block *sb) }/* mount the file system volume */ -static int __exfat_fill_super (struct super_block *sb) +static int __exfat_fill_super (struct super_block *sb, +struct exfat_chain *root_clu) {int ret;struct exfat_sb_info *sbi =EXFAT_SB (sb);
@@ -595,6 +592,18 @@ static int __exfat_fill_super(struct super_block *sb) goto free_bh; } +/* +* Call exfat_count_num_cluster() before searching for up-case and +* bitmap directory entries to avoid infinite loop if they are missing +* and the cluster chain includes a loop. +*/ +exfat_chain_set (root_clu, sbi->root_dir,0 ,ALLOC_FAT_CHAIN ); + ret =exfat_count_num_clusters (sb, root_clu, &root_clu->size); +if (ret) { +exfat_err (sb,"failed to count the number of clusters in root" ); + goto free_bh; + } + ret =exfat_create_upcase_table (sb);if (ret) {exfat_err (sb,"failed to load upcase table" );
@@ -627,6 +636,7 @@ static int exfat_fill_super(struct super_block *sb, struct fs_context *fc)struct exfat_sb_info *sbi = sb->s_fs_info;struct exfat_mount_options *opts = &sbi->options;struct inode *root_inode; +struct exfat_chain root_clu;int err;if (opts->allow_utime == (unsigned short )-1 )
@@ -645,7 +655,7 @@ static int exfat_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_time_min =EXFAT_MIN_TIMESTAMP_SECS ; sb->s_time_max =EXFAT_MAX_TIMESTAMP_SECS ; - err =__exfat_fill_super (sb); + err =__exfat_fill_super (sb, &root_clu);if (err) {exfat_err (sb,"failed to recognize exfat type" ); goto check_nls_io;
@@ -680,7 +690,7 @@ static int exfat_fill_super(struct super_block *sb, struct fs_context *fc) root_inode->i_ino =EXFAT_ROOT_INO ;inode_set_iversion (root_inode,1 ); - err =exfat_read_root (root_inode); + err =exfat_read_root (root_inode, &root_clu);if (err) {exfat_err (sb,"failed to initialize root inode" ); goto put_inode;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 403/515 f2fs: check the generic conditions first
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jaegeuk Kim <[email protected]>
[ Upstream commit e23ab8028de0d92df5921a570f5212c0370db3b5 ]
Let's return errors caught by the generic checks. This fixes generic/494 where it expects to see EBUSY by setattr_prepare instead of EINVAL by f2fs for active swapfile.
--- fs/f2fs/file.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
fs/f2fs/file.c +12 -12
@@ -1044,6 +1044,18 @@ int f2fs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,if (unlikely (f2fs_cp_error (F2FS_I_SB (inode))))return -EIO ; + err =setattr_prepare (idmap, dentry, attr); +if (err) +return err; + + err =fscrypt_prepare_setattr (dentry, attr); +if (err) +return err; + + err =fsverity_prepare_setattr (dentry, attr); +if (err) +return err; +if (unlikely (IS_IMMUTABLE (inode)))return -EPERM ;
@@ -1062,18 +1074,6 @@ int f2fs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,return -EINVAL ; } - err =setattr_prepare (idmap, dentry, attr); -if (err) -return err; - - err =fscrypt_prepare_setattr (dentry, attr); -if (err) -return err; - - err =fsverity_prepare_setattr (dentry, attr); -if (err) -return err; -if (is_quota_modification (idmap, inode, attr)) { err =f2fs_dquot_initialize (inode);if (err)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 404/515 printk: nbcon: Allow reacquire during panic
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Ogness <[email protected]>
[ Upstream commit 571c1ea91a73db56bd94054fabecd0f070dc90db ]
If a console printer is interrupted during panic, it will never be able to reacquire ownership in order to perform and cleanup. That in itself is not a problem, since the non-panic CPU will simply quiesce in an endless loop within nbcon_reacquire_nobuf().
However, in this state, platforms that do not support a true NMI to interrupt the quiesced CPU will not be able to shutdown that CPU from within panic(). This then causes problems for such as being unable to load and run a kdump kernel.
Fix this by allowing non-panic CPUs to reacquire ownership using a direct acquire. Then the non-panic CPUs can successfullyl exit the nbcon_reacquire_nobuf() loop and the console driver can perform any necessary cleanup. But more importantly, the CPU is no longer quiesced and is free to process any interrupts necessary for panic() to shutdown the CPU.
All other forms of acquire are still not allowed for non-panic CPUs since it is safer to have them avoid gaining console ownership that is not strictly necessary.
--- kernel/printk/nbcon.c | 63 ++++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 22 deletions(-)
kernel/printk/nbcon.c +41 -22
@@ -214,8 +214,9 @@ static void nbcon_seq_try_update(struct nbcon_context *ctxt, u64 new_seq)/** * nbcon_context_try_acquire_direct - Try to acquire directly -* @ctxt: The context of the caller -* @cur: The current console state +* @ctxt: The context of the caller +* @cur: The current console state +* @is_reacquire: This acquire is a reacquire * * Acquire the console when it is released. Also acquire the console when * the current owner has a lower priority and the console is in a safe state.
@@ -225,17 +226,17 @@ static void nbcon_seq_try_update(struct nbcon_context *ctxt, u64 new_seq)* * Errors: * -* -EPERM: A panic is in progress and this is not the panic CPU. -* Or the current owner or waiter has the same or higher -* priority. No acquire method can be successful in -* this case. +* -EPERM: A panic is in progress and this is neither the panic +* CPU nor is this a reacquire. Or the current owner or +* waiter has the same or higher priority. No acquire +* method can be successful in these cases. * * -EBUSY: The current owner has a lower priority but the console * in an unsafe state. The caller should try using * the handover acquire method. */ static int nbcon_context_try_acquire_direct (struct nbcon_context *ctxt, -struct nbcon_state *cur) +struct nbcon_state *cur,bool is_reacquire) {unsigned int cpu =smp_processor_id ();struct console *con = ctxt->console;
@@ -243,14 +244,20 @@ static int nbcon_context_try_acquire_direct(struct nbcon_context *ctxt, do { /* - * Panic does not imply that the console is owned. However, it - * is critical that non-panic CPUs during panic are unable to - * acquire ownership in order to satisfy the assumptions of - * nbcon_waiter_matches(). In particular, the assumption that - * lower priorities are ignored during panic. + * Panic does not imply that the console is owned. However, + * since all non-panic CPUs are stopped during panic(), it + * is safer to have them avoid gaining console ownership. + * + * If this acquire is a reacquire (and an unsafe takeover + * has not previously occurred) then it is allowed to attempt + * a direct acquire in panic. This gives console drivers an + * opportunity to perform any necessary cleanup if they were + * interrupted by the panic CPU while printing. */ - if (other_cpu_in_panic()) + if (other_cpu_in_panic() && + (!is_reacquire || cur->unsafe_takeover)) { return -EPERM; + } if (ctxt->prio <= cur->prio || ctxt->prio <= cur->req_prio) return -EPERM;
@@ -301,8 +308,9 @@ static bool nbcon_waiter_matches(struct nbcon_state *cur, int expected_prio)* Event #1 implies this context is EMERGENCY. * Event #2 implies the new context is PANIC. * Event #3 occurs when panic() has flushed the console. -* Events #4 and #5 are not possible due to the other_cpu_in_panic() -* check in nbcon_context_try_acquire_direct(). +* Event #4 occurs when a non-panic CPU reacquires. +* Event #5 is not possible due to the other_cpu_in_panic() check +* in nbcon_context_try_acquire_handover(). */ return (cur->req_prio == expected_prio);
@@ -431,6 +439,16 @@ static int nbcon_context_try_acquire_handover(struct nbcon_context *ctxt,WARN_ON_ONCE (ctxt->prio <= cur->prio || ctxt->prio <= cur->req_prio);WARN_ON_ONCE (!cur->unsafe); +/* +* Panic does not imply that the console is owned. However, it +* is critical that non-panic CPUs during panic are unable to +* wait for a handover in order to satisfy the assumptions of +* nbcon_waiter_matches(). In particular, the assumption that +* lower priorities are ignored during panic. +*/ +if (other_cpu_in_panic ()) +return -EPERM ; +/* Handover is not possible on the same CPU. */ if (cur->cpu == cpu)return -EBUSY ;
@@ -558,7 +576,8 @@ static struct printk_buffers panic_nbcon_pbufs;/** * nbcon_context_try_acquire - Try to acquire nbcon console -* @ctxt: The context of the caller +* @ctxt: The context of the caller +* @is_reacquire: This acquire is a reacquire * * Context: Under @ctxt->con->device_lock() or local_irq_save(). * Return: True if the console was acquired. False otherwise.
@@ -568,7 +587,7 @@ static struct printk_buffers panic_nbcon_pbufs;* in an unsafe state. Otherwise, on success the caller may assume * the console is not in an unsafe state. */ -static bool nbcon_context_try_acquire (struct nbcon_context *ctxt) +static bool nbcon_context_try_acquire (struct nbcon_context *ctxt,bool is_reacquire) {unsigned int cpu =smp_processor_id ();struct console *con = ctxt->console;
@@ -577,7 +596,7 @@ static bool nbcon_context_try_acquire(struct nbcon_context *ctxt)nbcon_state_read (con, &cur); try_again: - err =nbcon_context_try_acquire_direct (ctxt, &cur); + err =nbcon_context_try_acquire_direct (ctxt, &cur, is_reacquire);if (err != -EBUSY ) goto out;
@@ -913,7 +932,7 @@ void nbcon_reacquire_nobuf(struct nbcon_write_context *wctxt) {struct nbcon_context *ctxt = &ACCESS_PRIVATE (wctxt, ctxt); -while (!nbcon_context_try_acquire (ctxt)) +while (!nbcon_context_try_acquire (ctxt, true))cpu_relax ();nbcon_write_context_set_buf (wctxt,NULL ,0 );
@@ -1101,7 +1120,7 @@ static bool nbcon_emit_one(struct nbcon_write_context *wctxt, bool use_atomic)cant_migrate (); } -if (!nbcon_context_try_acquire (ctxt)) +if (!nbcon_context_try_acquire (ctxt, false)) goto out;/*
@@ -1486,7 +1505,7 @@ static int __nbcon_atomic_flush_pending_con(struct console *con, u64 stop_seq, ctxt->prio =nbcon_get_default_prio (); ctxt->allow_unsafe_takeover = allow_unsafe_takeover; -if (!nbcon_context_try_acquire (ctxt)) +if (!nbcon_context_try_acquire (ctxt, false))return -EPERM ;while (nbcon_seq_read (con) < stop_seq) {
@@ -1762,7 +1781,7 @@ bool nbcon_device_try_acquire(struct console *con) ctxt->console = con; ctxt->prio =NBCON_PRIO_NORMAL ; -if (!nbcon_context_try_acquire (ctxt)) +if (!nbcon_context_try_acquire (ctxt, false))return false;if (!nbcon_context_enter_unsafe (ctxt))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 405/515 kconfig: lxdialog: replace strcpy() with strncpy() in inputbox.c
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suchit Karunakaran <[email protected]>
[ Upstream commit 5ac726653a1029a2eccba93bbe59e01fc9725828 ]
strcpy() performs no bounds checking and can lead to buffer overflows if the input string exceeds the destination buffer size. This patch replaces it with strncpy(), and null terminates the input string.
--- scripts/kconfig/lxdialog/inputbox.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
scripts/kconfig/lxdialog/inputbox.c +4 -2
@@ -39,8 +39,10 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int widthif (!init) instr[0 ] ='\0' ; -else -strcpy (instr, init); +else { +strncpy (instr, init,sizeof (dialog_input_result) -1 ); + instr[sizeof (dialog_input_result) -1 ] ='\0' ; + } do_resize:if (getmaxy (stdscr) <= (height -INPUTBOX_HEIGHT_MIN ))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 406/515 vfio/type1: conditional rescheduling while pinning
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keith Busch <[email protected]>
[ Upstream commit b1779e4f209c7ff7e32f3c79d69bca4e3a3a68b6 ]
A large DMA mapping request can loop through dma address pinning for many pages. In cases where THP can not be used, the repeated vmf_insert_pfn can be costly, so let the task reschedule as need to prevent CPU stalls. Failure to do so has potential harmful side effects, like increased memory pressure as unrelated rcu tasks are unable to make their reclaim callbacks and result in OOM conditions.
rcu: INFO: rcu_sched self-detected stall on CPU rcu: 36-....: (20999 ticks this GP) idle=b01c/1/0x4000000000000000 softirq=35839/35839 fqs=3538 rcu: hardirqs softirqs csw/system rcu: number: 0 107 0 rcu: cputime: 50 0 10446 ==> 10556(ms) rcu: (t=21075 jiffies g=377761 q=204059 ncpus=384) ... <TASK> ? asm_sysvec_apic_timer_interrupt+0x16/0x20 ? walk_system_ram_range+0x63/0x120 ? walk_system_ram_range+0x46/0x120 ? pgprot_writethrough+0x20/0x20 lookup_memtype+0x67/0xf0 track_pfn_insert+0x20/0x40 vmf_insert_pfn_prot+0x88/0x140 vfio_pci_mmap_huge_fault+0xf9/0x1b0 [vfio_pci_core] __do_fault+0x28/0x1b0 handle_mm_fault+0xef1/0x2560 fixup_user_fault+0xf5/0x270 vaddr_get_pfns+0x169/0x2f0 [vfio_iommu_type1] vfio_pin_pages_remote+0x162/0x8e0 [vfio_iommu_type1] vfio_iommu_type1_ioctl+0x1121/0x1810 [vfio_iommu_type1] ? futex_wake+0x1c1/0x260 x64_sys_call+0x234/0x17a0 do_syscall_64+0x63/0x130 ? exc_page_fault+0x63/0x130 entry_SYSCALL_64_after_hwframe+0x4b/0x53
--- drivers/vfio/vfio_iommu_type1.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/vfio/vfio_iommu_type1.c +7 -0
@@ -648,6 +648,13 @@ static long vfio_pin_pages_remote(struct vfio_dma *dma, unsigned long vaddr,while (npage) {if (!batch->size) { +/* +* Large mappings may take a while to repeatedly refill +* the batch, so conditionally relinquish the CPU when +* needed to avoid stalls. +*/ +cond_resched (); +/* Empty batch, so refill it. */ ret =vaddr_get_pfns (mm, vaddr, npage, dma->prot, &pfn, batch);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 407/515 kconfig: nconf: Ensure null termination where strncpy is used
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shankari Anand <[email protected]>
[ Upstream commit f468992936894c9ce3b1659cf38c230d33b77a16 ]
strncpy() does not guarantee null-termination if the source string is longer than the destination buffer.
Ensure the buffer is explicitly null-terminated to prevent potential string overflows or undefined behavior.
--- scripts/kconfig/nconf.c | 2 ++ scripts/kconfig/nconf.gui.c | 1 + 2 files changed, 3 insertions(+)
scripts/kconfig/nconf.c +2 -0
@@ -593,6 +593,8 @@ static void item_add_str(const char *fmt, ...) tmp_str, sizeof(k_menu_items[index].str)); + k_menu_items[index].str[sizeof (k_menu_items[index].str) -1 ] ='\0' ; +free_item (curses_menu_items[index]); curses_menu_items[index] = new_item( k_menu_items[index].str,
scripts/kconfig/nconf.gui.c +1 -0
@@ -359,6 +359,7 @@ int dialog_inputbox(WINDOW *main_window, x = (columns-win_cols)/2 ;strncpy (result, init, *result_len); + result[*result_len -1 ] ='\0' ;/* create the windows */ win =newwin (win_lines, win_cols, y, x);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 408/515 scsi: Fix sas_user_scan() to handle wildcard and multi-channel scans
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ranjan Kumar <[email protected]>
[ Upstream commit 37c4e72b0651e7697eb338cd1fb09feef472cc1a ]
sas_user_scan() did not fully process wildcard channel scans (SCAN_WILD_CARD) when a transport-specific user_scan() callback was present. Only channel 0 would be scanned via user_scan(), while the remaining channels were skipped, potentially missing devices.
user_scan() invokes updated sas_user_scan() for channel 0, and if successful, iteratively scans remaining channels (1 to shost->max_channel) via scsi_scan_host_selected(). This ensures complete wildcard scanning without affecting transport-specific scanning behavior.
--- drivers/scsi/scsi_scan.c | 2 +- drivers/scsi/scsi_transport_sas.c | 60 ++++++++++++++++++++++++------- 2 files changed, 49 insertions(+), 13 deletions(-)
drivers/scsi/scsi_scan.c +1 -1
@@ -1899,7 +1899,7 @@ int scsi_scan_host_selected(struct Scsi_Host *shost, unsigned int channel,return 0 ; } - +EXPORT_SYMBOL (scsi_scan_host_selected);static void scsi_sysfs_add_devices (struct Scsi_Host *shost) {struct scsi_device *sdev;
drivers/scsi/scsi_transport_sas.c +48 -12
86 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 409/515 scsi: target: core: Generate correct identifiers for PR OUT transport IDs
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maurizio Lombardi <[email protected]>
[ Upstream commit 6e0f6aa44b68335df404a2df955055f416b5f2aa ]
Fix target_parse_pr_out_transport_id() to return a string representing the transport ID in a human-readable format (e.g., naa.xxxxxxxx...) for various SCSI protocol types (SAS, FCP, SRP, SBP).
Previously, the function returned a pointer to the raw binary buffer, which was incorrectly compared against human-readable strings, causing comparisons to fail. Now, the function writes a properly formatted string into a buffer provided by the caller. The output format depends on the transport protocol:
* SAS: 64-bit identifier, "naa." prefix.
* FCP: 64-bit identifier, colon separated values.
* SBP: 64-bit identifier, no prefix.
* SRP: 128-bit identifier, "0x" prefix.
* iSCSI: IQN string.
--- drivers/target/target_core_fabric_lib.c | 63 +++++++++++++++++++------ drivers/target/target_core_internal.h | 4 +- drivers/target/target_core_pr.c | 18 +++---- 3 files changed, 60 insertions(+), 25 deletions(-)
drivers/target/target_core_fabric_lib.c +48 -15
@@ -257,11 +257,41 @@ static int iscsi_get_pr_transport_id_len(return len; } -static char *iscsi_parse_pr_out_transport_id ( +static void sas_parse_pr_out_transport_id (char *buf,char *i_str) +{ +char hex[17 ] = {}; + +bin2hex (hex, buf +4 ,8 ); +snprintf (i_str,TRANSPORT_IQN_LEN ,"naa.%s" , hex); +} + +static void srp_parse_pr_out_transport_id (char *buf,char *i_str) +{ +char hex[33 ] = {}; + +bin2hex (hex, buf +8 ,16 ); +snprintf (i_str,TRANSPORT_IQN_LEN ,"0x%s" , hex); +} + +static void fcp_parse_pr_out_transport_id (char *buf,char *i_str) +{ +snprintf (i_str,TRANSPORT_IQN_LEN ,"%8phC" , buf +8 ); +} + +static void sbp_parse_pr_out_transport_id (char *buf,char *i_str) +{ +char hex[17 ] = {}; + +bin2hex (hex, buf +8 ,8 ); +snprintf (i_str,TRANSPORT_IQN_LEN ,"%s" , hex); +} + +static bool iscsi_parse_pr_out_transport_id (struct se_portal_group *se_tpg,char *buf,u32 *out_tid_len, -char **port_nexus_ptr) +char **port_nexus_ptr, +char *i_str) {char *p;int i;
@@ -282,7 +312,7 @@ static char *iscsi_parse_pr_out_transport_id(if ((format_code !=0x00 ) && (format_code !=0x40 )) {pr_err ("Illegal format code: 0x%02x for iSCSI" " Initiator Transport ID\n" , format_code); -return NULL ; +return false; }/* * If the caller wants the TransportID Length, we set that value for the
@@ -306,7 +336,7 @@ static char *iscsi_parse_pr_out_transport_id(pr_err ("Unable to locate \",i,0x\" separator" " for Initiator port identifier: %s\n" , &buf[4 ]); -return NULL ; +return false; } *p ='\0' ;/* Terminate iSCSI Name */ p +=5 ;/* Skip over ",i,0x" separator */
@@ -339,7 +369,8 @@ static char *iscsi_parse_pr_out_transport_id( }else *port_nexus_ptr =NULL ; -return &buf[4 ]; +strscpy (i_str, &buf[4 ],TRANSPORT_IQN_LEN ); +return true; } int target_get_pr_transport_id_len(struct se_node_acl *nacl,
@@ -387,33 +418,35 @@ int target_get_pr_transport_id(struct se_node_acl *nacl, } } -const char *target_parse_pr_out_transport_id (struct se_portal_group *tpg, -char *buf,u32 *out_tid_len,char **port_nexus_ptr) +bool target_parse_pr_out_transport_id (struct se_portal_group *tpg, +char *buf,u32 *out_tid_len,char **port_nexus_ptr,char *i_str) { -u32 offset; -switch (tpg->proto_id) {case SCSI_PROTOCOL_SAS :/* * Assume the FORMAT CODE 00b from spc4r17, 7.5.4.7 TransportID * for initiator ports using SCSI over SAS Serial SCSI Protocol. */ - offset =4 ; +sas_parse_pr_out_transport_id (buf, i_str);break ; -case SCSI_PROTOCOL_SBP :case SCSI_PROTOCOL_SRP : +srp_parse_pr_out_transport_id (buf, i_str); +break ;case SCSI_PROTOCOL_FCP : - offset =8 ; +fcp_parse_pr_out_transport_id (buf, i_str); +break ; +case SCSI_PROTOCOL_SBP : +sbp_parse_pr_out_transport_id (buf, i_str);break ;case SCSI_PROTOCOL_ISCSI :return iscsi_parse_pr_out_transport_id (tpg, buf, out_tid_len, - port_nexus_ptr); + port_nexus_ptr, i_str);default :pr_err ("Unknown proto_id: 0x%02x\n" , tpg->proto_id); -return NULL ; +return false; } *port_nexus_ptr =NULL ; *out_tid_len =24 ; -return buf + offset; +return true; }
drivers/target/target_core_internal.h +2 -2
@@ -103,8 +103,8 @@ int target_get_pr_transport_id_len(struct se_node_acl *nacl,int target_get_pr_transport_id (struct se_node_acl *nacl,struct t10_pr_registration *pr_reg,int *format_code,unsigned char *buf); -const char *target_parse_pr_out_transport_id (struct se_portal_group *tpg, -char *buf,u32 *out_tid_len,char **port_nexus_ptr); +bool target_parse_pr_out_transport_id (struct se_portal_group *tpg, +char *buf,u32 *out_tid_len,char **port_nexus_ptr,char *i_str);/* target_core_hba.c */ struct se_hba *core_alloc_hba (const char *,u32 ,u32 );
drivers/target/target_core_pr.c +10 -8
@@ -1478,11 +1478,12 @@ core_scsi3_decode_spec_i_port(LIST_HEAD (tid_dest_list);struct pr_transport_id_holder *tidh_new, *tidh, *tidh_tmp;unsigned char *buf, *ptr, proto_ident; -const unsigned char *i_str =NULL ; +unsigned char i_str[TRANSPORT_IQN_LEN ];char *iport_ptr =NULL , i_buf[PR_REG_ISID_ID_LEN ];sense_reason_t ret;u32 tpdl, tid_len =0 ;u32 dest_rtpi =0 ; +bool tid_found;/* * Allocate a struct pr_transport_id_holder and setup the
@@ -1571,9 +1572,9 @@ core_scsi3_decode_spec_i_port( dest_rtpi = tmp_lun->lun_tpg->tpg_rtpi; iport_ptr =NULL ; - i_str =target_parse_pr_out_transport_id (tmp_tpg, - ptr, &tid_len, &iport_ptr); -if (!i_str) + tid_found =target_parse_pr_out_transport_id (tmp_tpg, + ptr, &tid_len, &iport_ptr, i_str); +if (!tid_found)continue ;/* * Determine if this SCSI device server requires that
@@ -3153,13 +3154,14 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,struct t10_pr_registration *pr_reg, *pr_res_holder, *dest_pr_reg;struct t10_reservation *pr_tmpl = &dev->t10_pr;unsigned char *buf; -const unsigned char *initiator_str; +unsigned char initiator_str[TRANSPORT_IQN_LEN ];char *iport_ptr =NULL , i_buf[PR_REG_ISID_ID_LEN ] = { };u32 tid_len, tmp_tid_len;int new_reg =0 , type, scope, matching_iname;sense_reason_t ret;unsigned short rtpi;unsigned char proto_ident; +bool tid_found;if (!se_sess || !se_lun) {pr_err ("SPC-3 PR: se_sess || struct se_lun is NULL!\n" );
@@ -3278,9 +3280,9 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key, ret =TCM_INVALID_PARAMETER_LIST ; goto out; } - initiator_str =target_parse_pr_out_transport_id (dest_se_tpg, - &buf[24 ], &tmp_tid_len, &iport_ptr); -if (!initiator_str) { + tid_found =target_parse_pr_out_transport_id (dest_se_tpg, + &buf[24 ], &tmp_tid_len, &iport_ptr, initiator_str); +if (!tid_found) {pr_err ("SPC-3 PR REGISTER_AND_MOVE: Unable to locate" " initiator_str from Transport ID\n" ); ret =TCM_INVALID_PARAMETER_LIST ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 410/515 scsi: aacraid: Stop using PCI_IRQ_AFFINITY
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Garry <[email protected]>
[ Upstream commit dafeaf2c03e71255438ffe5a341d94d180e6c88e ]
When PCI_IRQ_AFFINITY is set for calling pci_alloc_irq_vectors(), it means interrupts are spread around the available CPUs. It also means that the interrupts become managed, which means that an interrupt is shutdown when all the CPUs in the interrupt affinity mask go offline.
Using managed interrupts in this way means that we should ensure that completions should not occur on HW queues where the associated interrupt is shutdown. This is typically achieved by ensuring only CPUs which are online can generate IO completion traffic to the HW queue which they are mapped to (so that they can also serve completion interrupts for that HW queue).
The problem in the driver is that a CPU can generate completions to a HW queue whose interrupt may be shutdown, as the CPUs in the HW queue interrupt affinity mask may be offline. This can cause IOs to never complete and hang the system. The driver maintains its own CPU <-> HW queue mapping for submissions, see aac_fib_vector_assign(), but this does not reflect the CPU <-> HW queue interrupt affinity mapping.
Commit 9dc704dcc09e ("scsi: aacraid: Reply queue mapping to CPUs based on IRQ affinity") tried to remedy this issue may mapping CPUs properly to HW queue interrupts. However this was later reverted in commit c5becf57dd56 ("Revert "scsi: aacraid: Reply queue mapping to CPUs based on IRQ affinity") - it seems that there were other reports of hangs. I guess that this was due to some implementation issue in the original commit or maybe a HW issue.
Fix the very original hang by just not using managed interrupts by not setting PCI_IRQ_AFFINITY. In this way, all CPUs will be in each HW queue affinity mask, so should not create completion problems if any CPUs go offline.
--- drivers/scsi/aacraid/comminit.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/aacraid/comminit.c +1 -2
@@ -481,8 +481,7 @@ void aac_define_int_mode(struct aac_dev *dev) pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) { min_msix =2 ; i =pci_alloc_irq_vectors (dev->pdev, - min_msix, msi_count, -PCI_IRQ_MSIX |PCI_IRQ_AFFINITY ); + min_msix, msi_count,PCI_IRQ_MSIX );if (i >0 ) { dev->msi_enabled =1 ; msi_count = i;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 411/515 vfio/mlx5: fix possible overflow in tracking max message size
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artem Sadovnikov <[email protected]>
[ Upstream commit b3060198483bac43ec113c62ae3837076f61f5de ]
MLX cap pg_track_log_max_msg_size consists of 5 bits, value of which is used as power of 2 for max_msg_size. This can lead to multiplication overflow between max_msg_size (u32) and integer constant, and afterwards incorrect value is being written to rq_size.
Fix this issue by extending integer constant to u64 type.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/vfio/pci/mlx5/cmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vfio/pci/mlx5/cmd.c +2 -2
@@ -1538,8 +1538,8 @@ int mlx5vf_start_page_tracker(struct vfio_device *vdev, log_max_msg_size =MLX5_CAP_ADV_VIRTUALIZATION (mdev, pg_track_log_max_msg_size); max_msg_size = (1ULL << log_max_msg_size);/* The RQ must hold at least 4 WQEs/messages for successful QP creation */ -if (rq_size <4 * max_msg_size) - rq_size =4 * max_msg_size; +if (rq_size <4ULL * max_msg_size) + rq_size =4ULL * max_msg_size;memset (tracker,0 ,sizeof (*tracker)); tracker->uar =mlx5_get_uars_page (mdev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 412/515 ipmi: Use dev_warn_ratelimited() for incorrect message warnings
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit ec50ec378e3fd83bde9b3d622ceac3509a60b6b5 ]
During BMC firmware upgrades on live systems, the ipmi_msghandler generates excessive "BMC returned incorrect response" warnings while the BMC is temporarily offline. This can flood system logs in large deployments.
Replace dev_warn() with dev_warn_ratelimited() to throttle these warnings and prevent log spam during BMC maintenance operations.
Message-ID: <[email protected]>
--- drivers/char/ipmi/ipmi_msghandler.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/char/ipmi/ipmi_msghandler.c +4 -4
@@ -4615,10 +4615,10 @@ static int handle_one_recv_msg(struct ipmi_smi *intf,* The NetFN and Command in the response is not even * marginally correct. */ -dev_warn (intf->si_dev, -"BMC returned incorrect response, expected netfn %x cmd %x, got netfn %x cmd %x\n" , - (msg->data[0 ] >>2 ) |1 , msg->data[1 ], - msg->rsp[0 ] >>2 , msg->rsp[1 ]); +dev_warn_ratelimited (intf->si_dev, +"BMC returned incorrect response, expected netfn %x cmd %x, got netfn %x cmd %x\n" , + (msg->data[0 ] >>2 ) |1 , msg->data[1 ], + msg->rsp[0 ] >>2 , msg->rsp[1 ]); goto return_unspecified; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 413/515 kconfig: gconf: avoid hardcoding model2 in on_treeview2_cursor_changed()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit cae9cdbcd9af044810bcceeb43a87accca47c71d ]
The on_treeview2_cursor_changed() handler is connected to both the left and right tree views, but it hardcodes model2 (the GtkTreeModel of the right tree view). This is incorrect. Get the associated model from the view.
--- scripts/kconfig/gconf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
scripts/kconfig/gconf.c +3 -2
@@ -942,13 +942,14 @@ on_treeview2_key_press_event(GtkWidget * widget,void on_treeview2_cursor_changed (GtkTreeView * treeview,gpointer user_data) { +GtkTreeModel *model =gtk_tree_view_get_model (treeview);GtkTreeSelection *selection;GtkTreeIter iter;struct menu *menu; selection =gtk_tree_view_get_selection (treeview); -if (gtk_tree_selection_get_selected (selection, &model2, &iter)) { -gtk_tree_model_get (model2, &iter,COL_MENU , &menu,-1 ); +if (gtk_tree_selection_get_selected (selection, &model, &iter)) { +gtk_tree_model_get (model, &iter,COL_MENU , &menu,-1 );text_insert_help (menu); } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 414/515 kconfig: gconf: fix potential memory leak in renderer_edited()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit f72ed4c6a375e52a3f4b75615e4a89d29d8acea7 ]
If gtk_tree_model_get_iter() fails, gtk_tree_path_free() is not called.
--- scripts/kconfig/gconf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/kconfig/gconf.c +2 -1
@@ -748,7 +748,7 @@ static void renderer_edited(GtkCellRendererText * cell,struct symbol *sym;if (!gtk_tree_model_get_iter (model2, &iter, path)) -return ; + goto free;gtk_tree_model_get (model2, &iter,COL_MENU , &menu,-1 ); sym = menu->sym;
@@ -760,6 +760,7 @@ static void renderer_edited(GtkCellRendererText * cell,update_tree (&rootmenu,NULL ); +free:gtk_tree_path_free (path); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 415/515 kheaders: rebuild kheaders_data.tar.xz when a file is modified within a minute
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit 626c54af35764b0b8a4ed5c446458ba6ddfe9cc8 ]
When a header file is changed, kernel/gen_kheaders.sh may fail to update kernel/kheaders_data.tar.xz.
[steps to reproduce]
[1] Build kernel/kheaders_data.tar.xz
$ make -j$(nproc) kernel/kheaders.o
DESCEND objtool
INSTALL libsubcmd_headers
CALL scripts/checksyscalls.sh
CHK kernel/kheaders_data.tar.xz
GEN kernel/kheaders_data.tar.xz
CC kernel/kheaders.o[2] Modify a header without changing the file size
$ sed -i s/0xdeadbeef/0xfeedbeef/ include/linux/elfnote.h
[3] Rebuild kernel/kheaders_data.tar.xz
$ make -j$(nproc) kernel/kheaders.o
DESCEND objtool
INSTALL libsubcmd_headers
CALL scripts/checksyscalls.sh
CHK kernel/kheaders_data.tar.xzkernel/kheaders_data.tar.xz is not updated if steps [1] - [3] are run within the same minute.
The headers_md5 variable stores the MD5 hash of the 'ls -l' output for all header files. This hash value is used to determine whether kheaders_data.tar.xz needs to be rebuilt. However, 'ls -l' prints the modification times with minute-level granularity. If a file is modified within the same minute and its size remains the same, the MD5 hash does not change.
To reliably detect file modifications, this commit rewrites kernel/gen_kheaders.sh to output header dependencies to kernel/.kheaders_data.tar.xz.cmd. Then, Make compares the timestamps and reruns kernel/gen_kheaders.sh when necessary. This is the standard mechanism used by Make and Kbuild.
--- kernel/.gitignore | 2 + kernel/Makefile | 47 ++++++++++++++++++--- kernel/gen_kheaders.sh | 94 ++++++++++-------------------------------- 3 files changed, 66 insertions(+), 77 deletions(-)
kernel/.gitignore +2 -0
@@ -1,3 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only /config_data /kheaders.md5 +/kheaders-objlist +/kheaders-srclist
kernel/Makefile +42 -5
53 lines not on this page · raw message
kernel/gen_kheaders.sh +22 -72
109 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 416/515 kconfig: lxdialog: fix space to (de)select options
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yann E. MORIN <[email protected]>
[ Upstream commit 694174f94ebeeb5ec5cc0e9de9b40c82057e1d95 ]
In case a menu has comment without letters/numbers (eg. characters matching the regexp '^[^[:alpha:][:digit:]]+$', for example - or *), hitting space will cycle through those comments, rather than selecting/deselecting the currently-highlighted option.
This is the behaviour of hitting any letter/digit: jump to the next option which prompt starts with that letter. The only letters that do not behave as such are 'y' 'm' and 'n'. Prompts that start with one of those three letters are instead matched on the first letter that is not 'y', 'm' or 'n'.
Fix that by treating 'space' as we treat y/m/n, ie. as an action key, not as shortcut to jump to prompt.
--- scripts/kconfig/lxdialog/menubox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/lxdialog/menubox.c +1 -1
@@ -264,7 +264,7 @@ int dialog_menu(const char *title, const char *prompt,if (key <256 &&isalpha (key)) key =tolower (key); -if (strchr ("ynmh" , key)) +if (strchr ("ynmh " , key)) i = max_choice;else {for (i = choice +1 ; i < max_choice; i++) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 417/515 ipmi: Fix strcpy source and destination the same
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Corey Minyard <[email protected]>
[ Upstream commit 8ffcb7560b4a15faf821df95e3ab532b2b020f8c ]
The source and destination of some strcpy operations was the same. Split out the part of the operations that needed to be done for those particular calls so the unnecessary copy wasn't done.
--- drivers/char/ipmi/ipmi_watchdog.c | 59 ++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 17 deletions(-)
drivers/char/ipmi/ipmi_watchdog.c +42 -17
@@ -1186,14 +1186,8 @@ static struct ipmi_smi_watcher smi_watcher = { .smi_gone = ipmi_smi_gone }; -static int action_op (const char *inval,char *outval) +static int action_op_set_val (const char *inval) { -if (outval) -strcpy (outval, action); - -if (!inval) -return 0 ; -if (strcmp (inval,"reset" ) ==0 ) action_val =WDOG_TIMEOUT_RESET ;else if (strcmp (inval,"none" ) ==0 )
@@ -1204,18 +1198,26 @@ static int action_op(const char *inval, char *outval) action_val =WDOG_TIMEOUT_POWER_DOWN ; else return -EINVAL; -strcpy (action, inval);return 0 ; } -static int preaction_op (const char *inval,char *outval) +static int action_op (const char *inval,char *outval) { +int rv; +if (outval) -strcpy (outval, preaction); +strcpy (outval, action);if (!inval)return 0 ; + rv =action_op_set_val (inval); +if (!rv) +strcpy (action, inval); +return rv; +} +static int preaction_op_set_val (const char *inval) +{if (strcmp (inval,"pre_none" ) ==0 ) preaction_val =WDOG_PRETIMEOUT_NONE ;else if (strcmp (inval,"pre_smi" ) ==0 )
@@ -1228,18 +1230,26 @@ static int preaction_op(const char *inval, char *outval) preaction_val =WDOG_PRETIMEOUT_MSG_INT ; else return -EINVAL; -strcpy (preaction, inval);return 0 ; } -static int preop_op (const char *inval,char *outval) +static int preaction_op (const char *inval,char *outval) { +int rv; +if (outval) -strcpy (outval, preop); +strcpy (outval, preaction);if (!inval)return 0 ; + rv =preaction_op_set_val (inval); +if (!rv) +strcpy (preaction, inval); +return 0 ; +} +static int preop_op_set_val (const char *inval) +{if (strcmp (inval,"preop_none" ) ==0 ) preop_val =WDOG_PREOP_NONE ;else if (strcmp (inval,"preop_panic" ) ==0 )
@@ -1248,7 +1258,22 @@ static int preop_op(const char *inval, char *outval) preop_val =WDOG_PREOP_GIVE_DATA ; else return -EINVAL; -strcpy (preop, inval); +return 0 ; +} + +static int preop_op (const char *inval,char *outval) +{ +int rv; + +if (outval) +strcpy (outval, preop); + +if (!inval) +return 0 ; + + rv =preop_op_set_val (inval); +if (!rv) +strcpy (preop, inval);return 0 ; }
@@ -1285,18 +1310,18 @@ static int __init ipmi_wdog_init(void) {int rv; -if (action_op (action,NULL )) { +if (action_op_set_val (action)) {action_op ("reset" ,NULL );pr_info ("Unknown action '%s', defaulting to reset\n" , action); } -if (preaction_op (preaction,NULL )) { +if (preaction_op_set_val (preaction)) {preaction_op ("pre_none" ,NULL );pr_info ("Unknown preaction '%s', defaulting to none\n" , preaction); } -if (preop_op (preop,NULL )) { +if (preop_op_set_val (preop)) {preop_op ("preop_none" ,NULL );pr_info ("Unknown preop '%s', defaulting to none\n" , preop); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 418/515 tools/power turbostat: Handle non-root legacy-uncore sysfs permissions
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Len Brown <[email protected]>
[ Upstream commit e60a13bcef206795d3ddf82f130fe8f570176d06 ]
/sys/devices/system/cpu/intel_uncore_frequency/package_X_die_Y/ may be readable by all, but /sys/devices/system/cpu/intel_uncore_frequency/package_X_die_Y/current_freq_khz may be readable only by root.
Non-root turbostat users see complaints in this scenario.
Fail probe of the interface if we can't read current_freq_khz.
--- tools/power/x86/turbostat/turbostat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/power/x86/turbostat/turbostat.c +2 -1
@@ -6690,7 +6690,8 @@ static void probe_intel_uncore_frequency_legacy(void)sprintf (path_base,"/sys/devices/system/cpu/intel_uncore_frequency/package_%02d_die_%02d" , i, j); -if (access (path_base,R_OK )) +sprintf (path,"%s/current_freq_khz" , path_base); +if (access (path,R_OK ))continue ;BIC_PRESENT (BIC_UNCORE_MHZ );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 419/515 tools/power turbostat: Fix build with musl
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Calvin Owens <[email protected]>
[ Upstream commit 6ea0ec1b958a84aff9f03fb0ae4613a4d5bed3ea ]
turbostat.c: In function 'parse_int_file':
turbostat.c:5567:19: error: 'PATH_MAX' undeclared (first use in this function)
5567 | char path[PATH_MAX];
| ^~~~~~~~
turbostat.c: In function 'probe_graphics':
turbostat.c:6787:19: error: 'PATH_MAX' undeclared (first use in this function)
6787 | char path[PATH_MAX];
| ^~~~~~~~--- tools/power/x86/turbostat/turbostat.c | 1 + 1 file changed, 1 insertion(+)
tools/power/x86/turbostat/turbostat.c +1 -0
@@ -67,6 +67,7 @@#include <stdbool.h> #include <assert.h> #include <linux/kernel.h> +#include <limits.h> #define UNUSED (x) (void)(x)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 420/515 tools/power turbostat: Handle cap_get_proc() ENOSYS
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Calvin Owens <[email protected]>
[ Upstream commit d34fe509f5f76d9dc36291242d67c6528027ebbd ]
Kernels configured with CONFIG_MULTIUSER=n have no cap_get_proc(). Check for ENOSYS to recognize this case, and continue on to attempt to access the requested MSRs (such as temperature).
--- tools/power/x86/turbostat/turbostat.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
tools/power/x86/turbostat/turbostat.c +9 -1
@@ -6527,8 +6527,16 @@ int check_for_cap_sys_rawio(void)int ret =0 ; caps =cap_get_proc (); -if (caps ==NULL ) +if (caps ==NULL ) { +/* +* CONFIG_MULTIUSER=n kernels have no cap_get_proc() +* Allow them to continue and attempt to access MSRs +*/ +if (errno ==ENOSYS ) +return 0 ; +return 1 ; + }if (cap_get_flag (caps,CAP_SYS_RAWIO ,CAP_EFFECTIVE , &cap_flag_value)) { ret =1 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 421/515 smb: client: dont call init_waitqueue_head(&info->conn_wait) twice in _smbd_get_connection
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Metzmacher <[email protected]>
[ Upstream commit 550a194c5998e4e77affc6235e80d3766dc2d27e ]
It is already called long before we may hit this cleanup code path.
--- fs/smb/client/smbdirect.c | 1 - 1 file changed, 1 deletion(-)
fs/smb/client/smbdirect.c +0 -1
@@ -1689,7 +1689,6 @@ static struct smbd_connection *_smbd_get_connection(cancel_delayed_work_sync (&info->idle_timer_work);destroy_caches_and_workqueue (info); sc->status =SMBDIRECT_SOCKET_NEGOTIATE_FAILED ; -init_waitqueue_head (&info->conn_wait);rdma_disconnect (sc->rdma.cm_id);wait_event (info->conn_wait, sc->status ==SMBDIRECT_SOCKET_DISCONNECTED );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 422/515 lib/sbitmap: convert shallow_depth from one word to the whole sbitmap
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 42e6c6ce03fd3e41e39a0f93f9b1a1d9fa664338 ]
Currently elevators will record internal 'async_depth' to throttle asynchronous requests, and they both calculate shallow_dpeth based on sb->shift, with the respect that sb->shift is the available tags in one word.
However, sb->shift is not the availbale tags in the last word, see __map_depth:
if (index == sb->map_nr - 1)
return sb->depth - (index << sb->shift);
For consequence, if the last word is used, more tags can be get than expected, for example, assume nr_requests=256 and there are four words, in the worst case if user set nr_requests=32, then the first word is the last word, and still use bits per word, which is 64, to calculate async_depth is wrong.
One the ohter hand, due to cgroup qos, bfq can allow only one request to be allocated, and set shallow_dpeth=1 will still allow the number of words request to be allocated.
Fix this problems by using shallow_depth to the whole sbitmap instead of per word, also change kyber, mq-deadline and bfq to follow this, a new helper __map_depth_with_shallow() is introduced to calculate available bits in each word.
--- block/bfq-iosched.c | 35 ++++++++++++-------------- block/bfq-iosched.h | 3 +-- block/kyber-iosched.c | 9 ++----- block/mq-deadline.c | 16 +----------- include/linux/sbitmap.h | 6 ++--- lib/sbitmap.c | 56 +++++++++++++++++++++-------------------- 6 files changed, 52 insertions(+), 73 deletions(-)
block/bfq-iosched.c +16 -19
@@ -701,17 +701,13 @@ static void bfq_limit_depth(blk_opf_t opf, struct blk_mq_alloc_data *data) {struct bfq_data *bfqd = data->q->elevator->elevator_data;struct bfq_io_cq *bic =bfq_bic_lookup (data->q); -int depth; -unsigned limit = data->q->nr_requests; -unsigned int act_idx; +unsigned int limit, act_idx;/* Sync reads have full depth available */ -if (op_is_sync (opf) && !op_is_write (opf)) { - depth =0 ; - }else { - depth = bfqd->word_depths[!!bfqd->wr_busy_queues][op_is_sync (opf)]; - limit = (limit * depth) >> bfqd->full_depth_shift; - } +if (op_is_sync (opf) && !op_is_write (opf)) + limit = data->q->nr_requests; +else + limit = bfqd->async_depths[!!bfqd->wr_busy_queues][op_is_sync (opf)];for (act_idx =0 ; bic && act_idx < bfqd->num_actuators; act_idx++) {/* Fast path to check if bfqq is already allocated. */
@@ -725,14 +721,16 @@ static void bfq_limit_depth(blk_opf_t opf, struct blk_mq_alloc_data *data)* available requests and thus starve other entities. */ if (bfqq_request_over_limit (bfqd, bic, opf, act_idx, limit)) { - depth =1 ; + limit =1 ;break ; } } +bfq_log (bfqd,"[%s] wr_busy %d sync %d depth %u" , - __func__, bfqd->wr_busy_queues,op_is_sync (opf), depth); -if (depth) - data->shallow_depth = depth; + __func__, bfqd->wr_busy_queues,op_is_sync (opf), limit); + +if (limit < data->q->nr_requests) + data->shallow_depth = limit; } static struct bfq_queue *
@@ -7128,9 +7126,8 @@ void bfq_put_async_queues(struct bfq_data *bfqd, struct bfq_group *bfqg)*/ static void bfq_update_depths (struct bfq_data *bfqd,struct sbitmap_queue *bt) { -unsigned int depth =1U << bt->sb.shift; +unsigned int nr_requests = bfqd->queue->nr_requests; - bfqd->full_depth_shift = bt->sb.shift;/* * In-word depths if no bfq_queue is being weight-raised: * leaving 25% of tags only for sync reads.
@@ -7142,13 +7139,13 @@ static void bfq_update_depths(struct bfq_data *bfqd, struct sbitmap_queue *bt)* limit 'something'. */ /* no more than 50% of tags for async I/O */ - bfqd->word_depths[0 ][0 ] =max (depth >>1 ,1U ); + bfqd->async_depths[0 ][0 ] =max (nr_requests >>1 ,1U );/* * no more than 75% of tags for sync writes (25% extra tags * w.r.t. async I/O, to prevent async I/O from starving sync * writes) */ - bfqd->word_depths[0 ][1 ] =max ((depth *3 ) >>2 ,1U ); + bfqd->async_depths[0 ][1 ] =max ((nr_requests *3 ) >>2 ,1U );/* * In-word depths in case some bfq_queue is being weight-
@@ -7158,9 +7155,9 @@ static void bfq_update_depths(struct bfq_data *bfqd, struct sbitmap_queue *bt)* shortage. */ /* no more than ~18% of tags for async I/O */ - bfqd->word_depths[1 ][0 ] =max ((depth *3 ) >>4 ,1U ); + bfqd->async_depths[1 ][0 ] =max ((nr_requests *3 ) >>4 ,1U );/* no more than ~37% of tags for sync writes (~20% extra tags) */ - bfqd->word_depths[1 ][1 ] =max ((depth *6 ) >>4 ,1U ); + bfqd->async_depths[1 ][1 ] =max ((nr_requests *6 ) >>4 ,1U ); }static void bfq_depth_updated (struct blk_mq_hw_ctx *hctx)
block/bfq-iosched.h +1 -2
@@ -813,8 +813,7 @@ struct bfq_data {* Depth limits used in bfq_limit_depth (see comments on the * function) */ -unsigned int word_depths[2 ][2 ]; -unsigned int full_depth_shift; +unsigned int async_depths[2 ][2 ];/* * Number of independent actuators. This is equal to 1 in
block/kyber-iosched.c +2 -7
@@ -157,10 +157,7 @@ struct kyber_queue_data {*/ struct sbitmap_queue domain_tokens[KYBER_NUM_DOMAINS ]; -/* -* Async request percentage, converted to per-word depth for -* sbitmap_get_shallow(). -*/ +/* Number of allowed async requests. */ unsigned int async_depth;struct kyber_cpu_latency __percpu *cpu_latency;
@@ -454,10 +451,8 @@ static void kyber_depth_updated(struct blk_mq_hw_ctx *hctx) {struct kyber_queue_data *kqd = hctx->queue->elevator->elevator_data;struct blk_mq_tags *tags = hctx->sched_tags; -unsigned int shift = tags->bitmap_tags.sb.shift; - - kqd->async_depth = (1U << shift) *KYBER_ASYNC_PERCENT /100U ; + kqd->async_depth = hctx->queue->nr_requests *KYBER_ASYNC_PERCENT /100U ;sbitmap_queue_min_shallow_depth (&tags->bitmap_tags, kqd->async_depth); }
block/mq-deadline.c +1 -15
@@ -487,20 +487,6 @@ static struct request *dd_dispatch_request(struct blk_mq_hw_ctx *hctx)return rq; } -/* -* 'depth' is a number in the range 1..INT_MAX representing a number of -* requests. Scale it with a factor (1 << bt->sb.shift) / q->nr_requests since -* 1..(1 << bt->sb.shift) is the range expected by sbitmap_get_shallow(). -* Values larger than q->nr_requests have the same effect as q->nr_requests. -*/ -static int dd_to_word_depth (struct blk_mq_hw_ctx *hctx,unsigned int qdepth) -{ -struct sbitmap_queue *bt = &hctx->sched_tags->bitmap_tags; -const unsigned int nrr = hctx->queue->nr_requests; - -return ((qdepth << bt->sb.shift) + nrr -1 ) / nrr; -} -/* * Called by __blk_mq_alloc_request(). The shallow_depth value set by this * function is used by __blk_mq_get_tag().
@@ -517,7 +503,7 @@ static void dd_limit_depth(blk_opf_t opf, struct blk_mq_alloc_data *data)* Throttle asynchronous requests and writes such that these requests * do not block the allocation of synchronous requests. */ - data->shallow_depth =dd_to_word_depth (data->hctx, dd->async_depth); + data->shallow_depth = dd->async_depth; }/* Called by blk_mq_update_nr_requests(). */
include/linux/sbitmap.h +3 -3
@@ -213,12 +213,12 @@ int sbitmap_get(struct sbitmap *sb);* sbitmap_get_shallow() - Try to allocate a free bit from a &struct sbitmap, * limiting the depth used from each word. * @sb: Bitmap to allocate from. -* @shallow_depth: The maximum number of bits to allocate from a single word. +* @shallow_depth: The maximum number of bits to allocate from the bitmap. * * This rather specific operation allows for having multiple users with * different allocation limits. E.g., there can be a high-priority class that * uses sbitmap_get() and a low-priority class that uses sbitmap_get_shallow() -* with a @shallow_depth of (1 << (@sb->shift - 1)). Then, the low-priority +* with a @shallow_depth of (sb->depth >> 1). Then, the low-priority * class can only allocate half of the total bits in the bitmap, preventing it * from starving out the high-priority class. *
@@ -478,7 +478,7 @@ unsigned long __sbitmap_queue_get_batch(struct sbitmap_queue *sbq, int nr_tags,* sbitmap_queue, limiting the depth used from each word, with preemption * already disabled. * @sbq: Bitmap queue to allocate from. -* @shallow_depth: The maximum number of bits to allocate from a single word. +* @shallow_depth: The maximum number of bits to allocate from the queue. * See sbitmap_get_shallow(). * * If you call this, make sure to call sbitmap_queue_min_shallow_depth() after
lib/sbitmap.c +29 -27
76 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 423/515 ALSA: hda/realtek: add LG gram 16Z90R-A to alc269 fixup table
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Croft <[email protected]>
[ Upstream commit dbe05428c4e54068a86e7e02405f3b30b1d2b3dd ]
Several months ago, Joshua Grisham submitted a patch [1] for several ALC298 based sound cards.
The entry for the LG gram 16 in the alc269_fixup_tbl only matches the Subsystem ID for the 16Z90R-Q and 16Z90R-K models [2]. My 16Z90R-A has a different Subsystem ID [3]. I'm not sure why these IDs differ, but I speculate it's due to the NVIDIA GPU included in the 16Z90R-A model that isn't present in the other models.
I applied the patch to the latest Arch Linux kernel and the card was initialized as expected.
[1]: https://lore.kernel.org/linux-sound/[email protected]/
[2]: https://linux-hardware.org/?id=pci:8086-51ca-1854-0488
[3]: https://linux-hardware.org/?id=pci:8086-51ca-1854-0489
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -11376,6 +11376,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1854 ,0x0440 ,"LG CQ6" ,ALC256_FIXUP_HEADPHONE_AMP_VOL ),SND_PCI_QUIRK (0x1854 ,0x0441 ,"LG CQ6 AIO" ,ALC256_FIXUP_HEADPHONE_AMP_VOL ),SND_PCI_QUIRK (0x1854 ,0x0488 ,"LG gram 16 (16Z90R)" ,ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS ), +SND_PCI_QUIRK (0x1854 ,0x0489 ,"LG gram 16 (16Z90R-A)" ,ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS ),SND_PCI_QUIRK (0x1854 ,0x048a ,"LG gram 17 (17ZD90R)" ,ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS ),SND_PCI_QUIRK (0x19e5 ,0x3204 ,"Huawei MACH-WX9" ,ALC256_FIXUP_HUAWEI_MACH_WX9_PINS ), SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 424/515 ASoC: Intel: sof_sdw: Add quirk for Alienware Area 51 (2025) 0CCC SKU
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Jakubek <[email protected]>
[ Upstream commit 1b03391d073dad748636a1ad9668b837cce58265 ]
Add DMI quirk entry for Alienware systems with SKU "0CCC" to enable proper speaker codec configuration (SOC_SDW_CODEC_SPKR).
This system requires the same audio configuration as some existing Dell systems. Without this patch, the laptop's speakers and microphone will not work.
--- sound/soc/intel/boards/sof_sdw.c | 8 ++++++++ 1 file changed, 8 insertions(+)
sound/soc/intel/boards/sof_sdw.c +8 -0
@@ -741,6 +741,14 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { }, .driver_data = (void *)(SOC_SDW_CODEC_SPKR), }, + { + .callback = sof_sdw_quirk_cb, + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Alienware" ), +DMI_EXACT_MATCH (DMI_PRODUCT_SKU ,"0CCC" ) + }, + .driver_data = (void *)(SOC_SDW_CODEC_SPKR), + }, /* Pantherlake devices*/ { .callback = sof_sdw_quirk_cb,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 425/515 net: phy: smsc: add proper reset flags for LAN8710A
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Buday Csaba <[email protected]>
[ Upstream commit 57ec5a8735dc5dccd1ee68afdb1114956a3fce0d ]
According to the LAN8710A datasheet (Rev. B, section 3.8.5.1), a hardware reset is required after power-on, and the reference clock (REF_CLK) must be established before asserting reset.
--- drivers/net/phy/smsc.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/phy/smsc.c +1 -0
@@ -785,6 +785,7 @@ static struct phy_driver smsc_phy_driver[] = {/* PHY_BASIC_FEATURES */ + .flags = PHY_RST_AFTER_CLK_EN, .probe = smsc_phy_probe,/* basic functions */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 426/515 ASoC: Intel: avs: Fix uninitialized pointer error in probe()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit 11f74f48c14c1f4fe16541900ea5944c42e30ccf ]
If pcim_request_all_regions() fails, error path operates on uninitialized 'bus' pointer. Found out by Coverity static analyzer.
--- sound/soc/intel/avs/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/intel/avs/core.c +2 -1
@@ -446,6 +446,8 @@ static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) adev =devm_kzalloc (dev,sizeof (*adev),GFP_KERNEL );if (!adev)return -ENOMEM ; + bus = &adev->base.core; + ret =avs_bus_init (adev, pci, id);if (ret <0 ) {dev_err (dev,"failed to init avs bus: %d\n" , ret);
@@ -456,7 +458,6 @@ static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)if (ret <0 )return ret; - bus = &adev->base.core; bus->addr =pci_resource_start (pci,0 ); bus->remap_addr =pci_ioremap_bar (pci,0 );if (!bus->remap_addr) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 427/515 block: avoid possible overflow for chunk_sectors check in blk_stack_limits()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Garry <[email protected]>
[ Upstream commit 448dfecc7ff807822ecd47a5c052acedca7d09e8 ]
In blk_stack_limits(), we check that the t->chunk_sectors value is a multiple of the t->physical_block_size value.
However, by finding the chunk_sectors value in bytes, we may overflow the unsigned int which holds chunk_sectors, so change the check to be based on sectors.
--- block/blk-settings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-settings.c +1 -1
@@ -797,7 +797,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, }/* chunk_sectors a multiple of the physical block size? */ -if ((t->chunk_sectors <<9 ) & (t->physical_block_size -1 )) { +if (t->chunk_sectors % (t->physical_block_size >>SECTOR_SHIFT )) { t->chunk_sectors =0 ; t->flags |=BLK_FLAG_MISALIGNED ; ret =-1 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 428/515 pNFS: Fix stripe mapping in block/scsi layout
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Bashirov <[email protected]>
[ Upstream commit 81438498a285759f31e843ac4800f82a5ce6521f ]
Because of integer division, we need to carefully calculate the disk offset. Consider the example below for a stripe of 6 volumes, a chunk size of 4096, and an offset of 70000.
chunk = div_u64(offset, dev->chunk_size) = 70000 / 4096 = 17 offset = chunk * dev->chunk_size = 17 * 4096 = 69632 disk_offset_wrong = div_u64(offset, dev->nr_children) = 69632 / 6 = 11605 disk_chunk = div_u64(chunk, dev->nr_children) = 17 / 6 = 2 disk_offset = disk_chunk * dev->chunk_size = 2 * 4096 = 8192
--- fs/nfs/blocklayout/dev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/nfs/blocklayout/dev.c +3 -2
@@ -257,10 +257,11 @@ static bool bl_map_stripe(struct pnfs_block_dev *dev, u64 offset,struct pnfs_block_dev *child;u64 chunk;u32 chunk_idx; +u64 disk_chunk;u64 disk_offset; chunk =div_u64 (offset, dev->chunk_size); -div_u64_rem (chunk, dev->nr_children, &chunk_idx); + disk_chunk =div_u64_rem (chunk, dev->nr_children, &chunk_idx);if (chunk_idx >= dev->nr_children) { dprintk("%s: invalid chunk idx %d (%lld/%lld)\n",
@@ -273,7 +274,7 @@ static bool bl_map_stripe(struct pnfs_block_dev *dev, u64 offset, offset = chunk * dev->chunk_size;/* disk offset of the stripe */ - disk_offset =div_u64 (offset, dev->nr_children); + disk_offset = disk_chunk * dev->chunk_size; child = &dev->children[chunk_idx]; child->map (child, disk_offset, map);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 429/515 pNFS: Fix disk addr range check in block/scsi layout
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Bashirov <[email protected]>
[ Upstream commit 7db6e66663681abda54f81d5916db3a3b8b1a13d ]
At the end of the isect translation, disc_addr represents the physical disk offset. Thus, end calculated from disk_addr is also a physical disk offset. Therefore, range checking should be done using map->disk_offset, not map->start.
--- fs/nfs/blocklayout/blocklayout.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/blocklayout/blocklayout.c +2 -2
@@ -149,8 +149,8 @@ do_add_page_to_bio(struct bio *bio, int npg, enum req_op op, sector_t isect,/* limit length to what the device mapping allows */ end = disk_addr + *len; -if (end >= map->start + map->len) - *len = map->start + map->len - disk_addr; +if (end >= map->disk_offset + map->len) + *len = map->disk_offset + map->len - disk_addr; retry:if (!bio) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 430/515 pNFS: Handle RPC size limit for layoutcommits
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Bashirov <[email protected]>
[ Upstream commit d897d81671bc4615c80f4f3bd5e6b218f59df50c ]
When there are too many block extents for a layoutcommit, they may not all fit into the maximum-sized RPC. This patch allows the generic pnfs code to properly handle -ENOSPC returned by the block/scsi layout driver and trigger additional layoutcommits if necessary.
--- fs/nfs/pnfs.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
fs/nfs/pnfs.c +8 -3
@@ -3340,6 +3340,7 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)struct nfs_inode *nfsi =NFS_I (inode);loff_t end_pos;int status; +bool mark_as_dirty = false;if (!pnfs_layoutcommit_outstanding (inode))return 0 ;
@@ -3391,19 +3392,23 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync)if (ld->prepare_layoutcommit) { status = ld->prepare_layoutcommit (&data->args);if (status) { -put_cred (data->cred); +if (status != -ENOSPC ) +put_cred (data->cred);spin_lock (&inode->i_lock);set_bit (NFS_INO_LAYOUTCOMMIT , &nfsi->flags);if (end_pos > nfsi->layout->plh_lwb) nfsi->layout->plh_lwb = end_pos; - goto out_unlock; +if (status != -ENOSPC ) + goto out_unlock; +spin_unlock (&inode->i_lock); + mark_as_dirty = true; } } status =nfs4_proc_layoutcommit (data, sync); out: -if (status) +if (status || mark_as_dirty)mark_inode_dirty_sync (inode);dprintk ("<-- %s status %d\n" , __func__, status);return status;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 431/515 pNFS: Fix uninited ptr deref in block/scsi layout
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Bashirov <[email protected]>
[ Upstream commit 9768797c219326699778fba9cd3b607b2f1e7950 ]
The error occurs on the third attempt to encode extents. When function ext_tree_prepare_commit() reallocates a larger buffer to retry encoding extents, the "layoutupdate_pages" page array is initialized only after the retry loop. But ext_tree_free_commitdata() is called on every iteration and tries to put pages in the array, thus dereferencing uninitialized pointers.
An additional problem is that there is no limit on the maximum possible buffer_size. When there are too many extents, the client may create a layoutcommit that is larger than the maximum possible RPC size accepted by the server.
During testing, we observed two typical scenarios. First, one memory page for extents is enough when we work with small files, append data to the end of the file, or preallocate extents before writing. But when we fill a new large file without preallocating, the number of extents can be huge, and counting the number of written extents in ext_tree_encode_commit() does not help much. Since this number increases even more between unlocking and locking of ext_tree, the reallocated buffer may not be large enough again and again.
--- fs/nfs/blocklayout/extent_tree.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
fs/nfs/blocklayout/extent_tree.c +15 -5
@@ -552,6 +552,15 @@ static int ext_tree_encode_commit(struct pnfs_block_layout *bl, __be32 *p,return ret; } +/** +* ext_tree_prepare_commit - encode extents that need to be committed +* @arg: layout commit data +* +* Return values: +* %0: Success, all required extents are encoded +* %-ENOSPC: Some extents are encoded, but not all, due to RPC size limit +* %-ENOMEM: Out of memory, extents not encoded +*/ int ext_tree_prepare_commit (struct nfs4_layoutcommit_args *arg) {
@@ -568,12 +577,12 @@ ext_tree_prepare_commit(struct nfs4_layoutcommit_args *arg) start_p =page_address (arg->layoutupdate_page); arg->layoutupdate_pages = &arg->layoutupdate_page; -retry: - ret =ext_tree_encode_commit (bl, start_p +1 , buffer_size, &count, &arg->lastbytewritten); + ret =ext_tree_encode_commit (bl, start_p +1 , buffer_size, + &count, &arg->lastbytewritten);if (unlikely (ret)) {ext_tree_free_commitdata (arg, buffer_size); - buffer_size =ext_tree_layoutupdate_size (bl, count); + buffer_size =NFS_SERVER (arg->inode)->wsize; count =0 ; arg->layoutupdate_pages =
@@ -588,7 +597,8 @@ ext_tree_prepare_commit(struct nfs4_layoutcommit_args *arg)return -ENOMEM ; } - goto retry; + ret =ext_tree_encode_commit (bl, start_p +1 , buffer_size, + &count, &arg->lastbytewritten); } *start_p =cpu_to_be32 (count);
@@ -608,7 +618,7 @@ ext_tree_prepare_commit(struct nfs4_layoutcommit_args *arg) }dprintk ("%s found %zu ranges\n" , __func__, count); -return 0 ; +return ret; }void
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 432/515 rtc: ds1307: remove clear of oscillator stop flag (OSF) in probe
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Meagan Lloyd <[email protected]>
[ Upstream commit 48458654659c9c2e149c211d86637f1592470da5 ]
In using CONFIG_RTC_HCTOSYS, rtc_hctosys() will sync the RTC time to the kernel time as long as rtc_read_time() succeeds. In some power loss situations, our supercapacitor-backed DS1342 RTC comes up with either an unpredictable future time or the default 01/01/00 from the datasheet. The oscillator stop flag (OSF) is set in these scenarios due to the power loss and can be used to determine the validity of the RTC data.
Some chip types in the ds1307 driver already have OSF handling to determine whether .read_time provides valid RTC data or returns -EINVAL.
This change removes the clear of the OSF in .probe as the OSF needs to be preserved to expand the OSF handling to the ds1341 chip type (note that DS1341 and DS1342 share a datasheet).
--- drivers/rtc/rtc-ds1307.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/rtc/rtc-ds1307.c +1 -3
@@ -1824,10 +1824,8 @@ static int ds1307_probe(struct i2c_client *client)regmap_write (ds1307->regmap,DS1337_REG_CONTROL , regs[0 ]); -/* oscillator fault? clear flag, and warn */ +/* oscillator fault? warn */ if (regs[1 ] &DS1337_BIT_OSF ) { -regmap_write (ds1307->regmap,DS1337_REG_STATUS , - regs[1 ] & ~DS1337_BIT_OSF );dev_warn (ds1307->dev,"SET TIME!\n" ); }break ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 433/515 scsi: lpfc: Remove redundant assignment to avoid memory leak
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
[ Upstream commit eea6cafb5890db488fce1c69d05464214616d800 ]
Remove the redundant assignment if kzalloc() succeeds to avoid memory leak.
--- drivers/scsi/lpfc/lpfc_debugfs.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/lpfc/lpfc_debugfs.c +0 -1
@@ -6289,7 +6289,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) } phba->nvmeio_trc_on =1 ; phba->nvmeio_trc_output_idx =0 ; - phba->nvmeio_trc =NULL ; }else { nvmeio_off: phba->nvmeio_trc_size =0 ;
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 434/515 ASoC: fsl_sai: replace regmap_write with regmap_update_bits
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shengjiu Wang <[email protected]>
[ Upstream commit 0e270f32975fd21874185ba53653630dd40bf560 ]
Use the regmap_write() for software reset in fsl_sai_config_disable would cause the FSL_SAI_CSR_BCE bit to be cleared. Refer to
commit 197c53c8ecb34 ("ASoC: fsl_sai: Don't disable bitclock for i.MX8MP") FSL_SAI_CSR_BCE should not be cleared. So need to use regmap_update_bits() instead of regmap_write() for these bit operations.
--- sound/soc/fsl/fsl_sai.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
sound/soc/fsl/fsl_sai.c +10 -10
@@ -777,9 +777,9 @@ static void fsl_sai_config_disable(struct fsl_sai *sai, int dir)* are running concurrently. */ /* Software Reset */ -regmap_write (sai->regmap,FSL_SAI_xCSR (tx, ofs),FSL_SAI_CSR_SR ); +regmap_update_bits (sai->regmap,FSL_SAI_xCSR (tx, ofs),FSL_SAI_CSR_SR ,FSL_SAI_CSR_SR );/* Clear SR bit to finish the reset */ -regmap_write (sai->regmap,FSL_SAI_xCSR (tx, ofs),0 ); +regmap_update_bits (sai->regmap,FSL_SAI_xCSR (tx, ofs),FSL_SAI_CSR_SR ,0 ); } static int fsl_sai_trigger(struct snd_pcm_substream *substream, int cmd,
@@ -898,11 +898,11 @@ static int fsl_sai_dai_probe(struct snd_soc_dai *cpu_dai)unsigned int ofs = sai->soc_data->reg_offset;/* Software Reset for both Tx and Rx */ -regmap_write (sai->regmap,FSL_SAI_TCSR (ofs),FSL_SAI_CSR_SR ); -regmap_write (sai->regmap,FSL_SAI_RCSR (ofs),FSL_SAI_CSR_SR ); +regmap_update_bits (sai->regmap,FSL_SAI_TCSR (ofs),FSL_SAI_CSR_SR ,FSL_SAI_CSR_SR ); +regmap_update_bits (sai->regmap,FSL_SAI_RCSR (ofs),FSL_SAI_CSR_SR ,FSL_SAI_CSR_SR );/* Clear SR bit to finish the reset */ -regmap_write (sai->regmap,FSL_SAI_TCSR (ofs),0 ); -regmap_write (sai->regmap,FSL_SAI_RCSR (ofs),0 ); +regmap_update_bits (sai->regmap,FSL_SAI_TCSR (ofs),FSL_SAI_CSR_SR ,0 ); +regmap_update_bits (sai->regmap,FSL_SAI_RCSR (ofs),FSL_SAI_CSR_SR ,0 ); regmap_update_bits(sai->regmap, FSL_SAI_TCR1(ofs), FSL_SAI_CR1_RFW_MASK(sai->soc_data->fifo_depth),
@@ -1790,11 +1790,11 @@ static int fsl_sai_runtime_resume(struct device *dev)regcache_cache_only (sai->regmap, false);regcache_mark_dirty (sai->regmap); -regmap_write (sai->regmap,FSL_SAI_TCSR (ofs),FSL_SAI_CSR_SR ); -regmap_write (sai->regmap,FSL_SAI_RCSR (ofs),FSL_SAI_CSR_SR ); +regmap_update_bits (sai->regmap,FSL_SAI_TCSR (ofs),FSL_SAI_CSR_SR ,FSL_SAI_CSR_SR ); +regmap_update_bits (sai->regmap,FSL_SAI_RCSR (ofs),FSL_SAI_CSR_SR ,FSL_SAI_CSR_SR );usleep_range (1000 ,2000 ); -regmap_write (sai->regmap,FSL_SAI_TCSR (ofs),0 ); -regmap_write (sai->regmap,FSL_SAI_RCSR (ofs),0 ); +regmap_update_bits (sai->regmap,FSL_SAI_TCSR (ofs),FSL_SAI_CSR_SR ,0 ); +regmap_update_bits (sai->regmap,FSL_SAI_RCSR (ofs),FSL_SAI_CSR_SR ,0 ); ret =regcache_sync (sai->regmap);if (ret)
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 435/515 cifs: Fix collect_sample() to handle any iterator type
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit b63335fb3d32579c5ff0b7038b9cc23688fff528 ]
collect_sample() is used to gather samples of the data in a Write op for analysis to try and determine if the compression algorithm is likely to achieve anything more quickly than actually running the compression algorithm.
However, collect_sample() assumes that the data it is going to be sampling is stored in an ITER_XARRAY-type iterator (which it now should never be) and doesn't actually check that it is before accessing the underlying xarray directly.
Fix this by replacing the code with a loop that just uses the standard iterator functions to sample every other 2KiB block, skipping the intervening ones. It's not quite the same as the previous algorithm as it doesn't necessarily align to the pages within an ordinary write from the pagecache.
Note that the btrfs code from which this was derived samples the inode's pagecache directly rather than the iterator - but that doesn't necessarily work for network filesystems if O_DIRECT is in operation.
--- fs/smb/client/compress.c | 71 ++++++++++++---------------------------- 1 file changed, 21 insertions(+), 50 deletions(-)
fs/smb/client/compress.c +21 -50
@@ -155,58 +155,29 @@ static int cmp_bkt(const void *_a, const void *_b) }/* -* TODO: -* Support other iter types, if required. -* Only ITER_XARRAY is supported for now. +* Collect some 2K samples with 2K gaps between. */ -static int collect_sample (const struct iov_iter *iter,ssize_t max,u8 *sample) +static int collect_sample (const struct iov_iter *source,ssize_t max,u8 *sample) { -struct folio *folios[16 ], *folio; -unsigned int nr, i, j, npages; -loff_t start = iter->xarray_start + iter->iov_offset; -pgoff_t last, index = start /PAGE_SIZE ; -size_t len, off, foff; -void *p; -int s =0 ; - - last = (start + max -1 ) /PAGE_SIZE ; -do { - nr =xa_extract (iter->xarray, (void **)folios, index, last,ARRAY_SIZE (folios), -XA_PRESENT ); -if (nr ==0 ) -return -EIO ; - -for (i =0 ; i < nr; i++) { - folio = folios[i]; - npages =folio_nr_pages (folio); - foff = start -folio_pos (folio); - off = foff %PAGE_SIZE ; - -for (j = foff /PAGE_SIZE ; j < npages; j++) { -size_t len2; - - len =min_t (size_t, max,PAGE_SIZE - off); - len2 =min_t (size_t, len,SZ_2K ); - - p =kmap_local_page (folio_page (folio, j)); -memcpy (&sample[s], p, len2); -kunmap_local (p); - - s += len2; - -if (len2 <SZ_2K || s >= max -SZ_2K ) -return s; - - max -= len; -if (max <=0 ) -return s; - - start += len; - off =0 ; - index++; - } - } - }while (nr ==ARRAY_SIZE (folios)); +struct iov_iter iter = *source; +size_t s =0 ; + +while (iov_iter_count (&iter) >=SZ_2K ) { +size_t part =umin (umin (iov_iter_count (&iter),SZ_2K ), max); +size_t n; + + n =copy_from_iter (sample + s, part, &iter); +if (n != part) +return -EFAULT ; + + s += n; + max -= n; + +if (iov_iter_count (&iter) <PAGE_SIZE -SZ_2K ) +break ; + +iov_iter_advance (&iter,SZ_2K ); + }return s; }
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 436/515 drm/i915/psr: Do not trigger Frame Change events from frontbuffer flush
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jouni Högander <[email protected]>
[ Upstream commit 184889dfe0568528fd6d14bba864dd57ed45bbf2 ]
We want to get rid of triggering "Frame Change" events from frontbuffer flush calls. We are about to move using TRANS_PUSH register for this on LunarLake and onwards. Touching TRANS_PUSH register from fronbuffer flush would be problematic as it's written by DSB as well.
Fix this by using intel_psr_exit when flush or invalidate is done on LunarLake and onwards. This is not possible on AlderLake and MeteorLake due to HW bug in PSR2 disable.
This patch is also fixing problems with cursor plane where cursor is disappearing or duplicate cursor is seen on the screen.
v2: Commit message updated
Bspec: 68927, 68934, 66624
--- drivers/gpu/drm/i915/display/intel_psr.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/display/intel_psr.c +9 -5
@@ -3171,7 +3171,9 @@ static void intel_psr_configure_full_frame_update(struct intel_dp *intel_dp)static void _psr_invalidate_handle (struct intel_dp *intel_dp) { -if (intel_dp->psr.psr2_sel_fetch_enabled) { +struct intel_display *display =to_intel_display (intel_dp); + +if (DISPLAY_VER (display) <20 && intel_dp->psr.psr2_sel_fetch_enabled) {if (!intel_dp->psr.psr2_sel_fetch_cff_enabled) { intel_dp->psr.psr2_sel_fetch_cff_enabled = true;intel_psr_configure_full_frame_update (intel_dp);
@@ -3259,7 +3261,7 @@ static void _psr_flush_handle(struct intel_dp *intel_dp)struct intel_display *display =to_intel_display (intel_dp);struct drm_i915_private *dev_priv =to_i915 (display->drm); -if (intel_dp->psr.psr2_sel_fetch_enabled) { +if (DISPLAY_VER (display) <20 && intel_dp->psr.psr2_sel_fetch_enabled) {if (intel_dp->psr.psr2_sel_fetch_cff_enabled) {/* can we turn CFF off? */ if (intel_dp->psr.busy_frontbuffer_bits ==0 )
@@ -3276,11 +3278,13 @@ static void _psr_flush_handle(struct intel_dp *intel_dp)* existing SU configuration */ intel_psr_configure_full_frame_update (intel_dp); - } -intel_psr_force_update (intel_dp); +intel_psr_force_update (intel_dp); + }else { +intel_psr_exit (intel_dp); + } -if (!intel_dp->psr.psr2_sel_fetch_enabled && !intel_dp->psr.active && +if ((!intel_dp->psr.psr2_sel_fetch_enabled ||DISPLAY_VER (display) >=20 ) && !intel_dp->psr.busy_frontbuffer_bits)queue_work (dev_priv->unordered_wq, &intel_dp->psr.work); }
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 437/515 drm/amdgpu: fix vram reservation issue
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: YiPeng Chai <[email protected]>
[ Upstream commit 10ef476aad1c848449934e7bec2ab2374333c7b6 ]
The vram block allocation flag must be cleared before making vram reservation, otherwise reserving addresses within the currently freed memory range will always fail.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +1 -2
@@ -648,9 +648,8 @@ static void amdgpu_vram_mgr_del(struct ttm_resource_manager *man,list_for_each_entry (block, &vres->blocks, link) vis_usage +=amdgpu_vram_mgr_vis_size (adev, block); -amdgpu_vram_mgr_do_reserve (man); -drm_buddy_free_list (mm, &vres->blocks, vres->flags); +amdgpu_vram_mgr_do_reserve (man);mutex_unlock (&mgr->lock);atomic64_sub (vis_usage, &mgr->vis_usage);
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 438/515 drm/amdgpu: fix incorrect vm flags to map bo
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Xiao <[email protected]>
[ Upstream commit 040bc6d0e0e9c814c9c663f6f1544ebaff6824a8 ]
It should use vm flags instead of pte flags
to specify bo vm attributes.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c +2 -2
@@ -88,8 +88,8 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm, } r =amdgpu_vm_bo_map (adev, *bo_va, csa_addr,0 , size, -AMDGPU_PTE_READABLE |AMDGPU_PTE_WRITEABLE | -AMDGPU_PTE_EXECUTABLE ); +AMDGPU_VM_PAGE_READABLE |AMDGPU_VM_PAGE_WRITEABLE | +AMDGPU_VM_PAGE_EXECUTABLE );if (r) {DRM_ERROR ("failed to do bo_map on static CSA, err=%d\n" , r);
Signature · 1 line
2.50.1
RE: [PATCH 6.15 438/515] drm/amdgpu: fix incorrect vm flags to map bo
[Public]
Quoted 13 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Monday, August 18, 2025 8:47 AM
To: [email protected]
Cc: Greg Kroah-Hartman <[email protected]>; [email protected]; Xiao, Jack <[email protected]>; Gao, Likun <[email protected]>; Deucher, Alexander <[email protected]>; Sasha Levin <[email protected]>
Subject: [PATCH 6.15 438/515] drm/amdgpu: fix incorrect vm flags to map bo6.15-stable review patch. If anyone has any objections, please let me know.
------------------
Quoted 7 lines
From: Jack Xiao <[email protected]>
[ Upstream commit
040bc6d0e0e9c814c9c663f6f1544ebaff6824a8]It should use vm flags instead of pte flags to specify bo vm attributes.
Fixes 7946340fa389 ("drm/amdgpu: Move csa related code to separate file")
I accidently tagged this with the wrong fixes tag. This patch should not go to anything other than 6.17. Sorry for the confusion. Please revert for older kernels.
Thanks,
Alex
Quoted 32 lines
Signed-off-by Jack Xiao <[email protected]>Reviewed-by Likun Gao <[email protected]>Signed-off-by Alex Deucher <[email protected]> (cherry picked fromcommit
b08425fa77ad2f305fe57a33dceb456be03b653f)Signed-off-by Sasha Levin <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c +0
-1@@ -88,8 +88,8 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev,struct amdgpu_vm *vm, } r = amdgpu_vm_bo_map(adev, *bo_va, csa_addr, 0, size, - AMDGPU_PTE_READABLE |
AMDGPU_PTE_WRITEABLE|drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c +1
-1- AMDGPU_PTE_EXECUTABLE); + AMDGPU_VM_PAGE_READABLE |
AMDGPU_VM_PAGE_WRITEABLE|
+AMDGPU_VM_PAGE_EXECUTABLE);if (r) { DRM_ERROR("failed to do bo_map on static CSA, err=%d\n", r);--
2.50.1
Greg Kroah-Hartman
maintainerRe: [PATCH 6.15 438/515] drm/amdgpu: fix incorrect vm flags to map bo
Quoted 17 lines · Alexander
[Public]
Quoted 15 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Monday, August 18, 2025 8:47 AM
To: [email protected]
Cc: Greg Kroah-Hartman <[email protected]>; [email protected]; Xiao, Jack <[email protected]>; Gao, Likun <[email protected]>; Deucher, Alexander <[email protected]>; Sasha Levin <[email protected]>
Subject: [PATCH 6.15 438/515] drm/amdgpu: fix incorrect vm flags to map bo6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Xiao <[email protected]>
Quoted 7 lines
Quoted 5 lines
[ Upstream commit
040bc6d0e0e9c814c9c663f6f1544ebaff6824a8]It should use vm flags instead of pte flags to specify bo vm attributes.
Fixes 7946340fa389 ("drm/amdgpu: Move csa related code to separate file")I accidently tagged this with the wrong fixes tag. This patch should not go to anything other than 6.17. Sorry for the confusion. Please revert for older kernels.
6.15 is end-of-life, sorry.
Greg Kroah-Hartman
maintainerPATCH 439/515 rust: kbuild: clean output before running `rustdoc`
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miguel Ojeda <[email protected]>
commit 252fea131e15aba2cd487119d1a8f546471199e2 upstream.
rustdoc can get confused when generating documentation into a folder that contains generated files from other rustdoc versions.
For instance, running something like:
rustup default 1.78.0
make LLVM=1 rustdoc
rustup default 1.88.0
make LLVM=1 rustdoc
may generate errors like:
error: couldn't generate documentation: invalid template: last line expected to start with a comment
|
= note: failed to create or modify "./Documentation/output/rust/rustdoc/src-files.js"
Thus just always clean the output folder before generating the documentation -- we are anyway regenerating it every time the rustdoc target gets called, at least for the time being.
--- rust/Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
rust/Makefile +7 -3
@@ -103,14 +103,14 @@ rustdoc: rustdoc-core rustdoc-macros rus rustdoc-macros: private rustdoc_host = yes rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \ --extern proc_macro -rustdoc-macros: $(src)/macros/lib.rs FORCE +rustdoc-macros: $(src)/macros/lib.rs rustdoc-clean FORCE +$(call if_changed,rustdoc) # Starting with Rust 1.82.0, skipping `-Wrustdoc::unescaped_backticks` should # not be needed -- see https://github.com/rust-lang/rust/pull/128307. rustdoc-core: private skip_flags = --edition=2021 -Wrustdoc::unescaped_backticks rustdoc-core: private rustc_target_flags = --edition=$(core-edition) $(core-cfgs) -rustdoc-core: $(RUST_LIB_SRC)/core/src/lib.rs FORCE +rustdoc-core: $(RUST_LIB_SRC)/core/src/lib.rs rustdoc-clean FORCE +$(call if_changed,rustdoc) rustdoc-compiler_builtins: $(src)/compiler_builtins.rs rustdoc-core FORCE
@@ -122,7 +122,8 @@ rustdoc-ffi: $(src)/ffi.rs rustdoc-core rustdoc-pin_init_internal: private rustdoc_host = yes rustdoc-pin_init_internal: private rustc_target_flags = --cfg kernel \ --extern proc_macro --crate-type proc-macro -rustdoc-pin_init_internal: $(src)/pin-init/internal/src/lib.rs FORCE +rustdoc-pin_init_internal: $(src)/pin-init/internal/src/lib.rs \ + rustdoc-clean FORCE +$(call if_changed,rustdoc) rustdoc-pin_init: private rustdoc_host = yes
@@ -140,6 +141,9 @@ rustdoc-kernel: $(src)/kernel/lib.rs rus $(obj)/bindings.o FORCE +$(call if_changed,rustdoc) +rustdoc-clean: FORCE + $(Q)rm -rf $(rustdoc_output) + quiet_cmd_rustc_test_library = $(RUSTC_OR_CLIPPY_QUIET) TL $< cmd_rustc_test_library = \ OBJTREE=$(abspath $(objtree)) \
Greg Kroah-Hartman
maintainerPATCH 440/515 rust: workaround `rustdoc` target modifiers bug
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miguel Ojeda <[email protected]>
commit abbf9a44944171ca99c150adad9361a2f517d3b6 upstream.
Starting with Rust 1.88.0 (released 2025-06-26), rustdoc complains about a target modifier mismatch in configurations where -Zfixed-x18 is passed:
error: mixing -Zfixed-x18 will cause an ABI mismatch in crate rust_out
|
= help: the -Zfixed-x18 flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely = note: unset -Zfixed-x18 in this crate is incompatible with -Zfixed-x18= in dependency core
= help: set -Zfixed-x18= in this crate or unset -Zfixed-x18 in core
= help: if you are sure this will not cause problems, you may use -Cunsafe-allow-abi-mismatch=fixed-x18 to silence this error
The reason is that rustdoc was not passing the target modifiers when configuring the session options, and thus it would report a mismatch that did not exist as soon as a target modifier is used in a dependency.
We did not notice it in the kernel until now because -Zfixed-x18 has been a target modifier only since 1.88.0 (and it is the only one we use so far).
The issue has been reported upstream [1] and a fix has been submitted [2], including a test similar to the kernel case.
[ This is now fixed upstream (thanks Guillaume for the quick review),
so it will be fixed in Rust 1.90.0 (expected 2025-09-18).
- Miguel ]
Meanwhile, conditionally pass -Cunsafe-allow-abi-mismatch=fixed-x18 to workaround the issue on our side.
--- rust/Makefile | 6 ++++++ 1 file changed, 6 insertions(+)
rust/Makefile +6 -0
@@ -62,6 +62,10 @@ core-cfgs = \ core-edition := $(if $(call rustc-min-version,108700),2024,2021) +# `rustdoc` did not save the target modifiers, thus workaround for +# the time being (https://github.com/rust-lang/rust/issues/144521). +rustdoc_modifiers_workaround := $(if $(call rustc-min-version,108800),-Cunsafe-allow-abi-mismatch=fixed-x18) + # `rustc` recognizes `--remap-path-prefix` since 1.26.0, but `rustdoc` only # since Rust 1.81.0. Moreover, `rustdoc` ICEs on out-of-tree builds since Rust # 1.82.0 (https://github.com/rust-lang/rust/issues/138520). Thus workaround both
@@ -74,6 +78,7 @@ quiet_cmd_rustdoc = RUSTDOC $(if $(rustd -Zunstable-options --generate-link-to-definition \ --output $(rustdoc_output) \ --crate-name $(subst rustdoc-,,$@) \ + $(rustdoc_modifiers_workaround) \ $(if $(rustdoc_host),,--sysroot=/dev/null) \ @$(objtree)/include/generated/rustc_cfg $<
@@ -216,6 +221,7 @@ quiet_cmd_rustdoc_test_kernel = RUSTDOC --extern bindings --extern uapi \ --no-run --crate-name kernel -Zunstable-options \ --sysroot=/dev/null \ + $(rustdoc_modifiers_workaround) \ --test-builder $(objtree)/scripts/rustdoc_test_builder \ $< $(rustdoc_test_kernel_quiet); \ $(objtree)/scripts/rustdoc_test_gen
Greg Kroah-Hartman
maintainerPATCH 441/515 samples/damon/wsse: fix boot time enable handling
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 0ed1165c37277822b519f519d0982d36efc30006 upstream.
Patch series "mm/damon: fix misc bugs in DAMON modules".
Quoted 1 line
From manual code review, I found below bugs in DAMON modules.
DAMON sample modules crash if those are enabled at boot time, via kernel command line. A similar issue was found and fixed on DAMON non-sample modules in the past, but we didn't check that for sample modules.
DAMON non-sample modules are not setting 'enabled' parameters accordingly when real enabling is failed. Honggyu found and fixed[1] this type of bugs in DAMON sample modules, and my inspection was motivated by the great work. Kudos to Honggyu.
Finally, DAMON_RECLIAM is mistakenly losing scheme internal status due to misuse of damon_commit_ctx(). DAMON_LRU_SORT has a similar misuse, but fortunately it is not causing real status loss.
Fix the bugs. Since these are similar patterns of bugs that were found in the past, it would be better to add tests or refactor the code, in future.
This patch (of 6):
If 'enable' parameter of the 'wsse' DAMON sample module is set at boot time via the kernel command line, memory allocation is tried before the slab is initialized. As a result kernel NULL pointer dereference BUG can happen. Fix it by checking the initialization status.
--- samples/damon/wsse.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
samples/damon/wsse.c +11 -1
@@ -89,6 +89,8 @@ static void damon_sample_wsse_stop(void)put_pid (target_pidp); } +static bool init_called; +static int damon_sample_wsse_enable_store (const char *val,const struct kernel_param *kp) {
@@ -114,7 +116,15 @@ static int damon_sample_wsse_enable_store(static int __init damon_sample_wsse_init (void ) { -return 0 ; +int err =0 ; + + init_called = true; +if (enable) { + err =damon_sample_wsse_start (); +if (err) + enable = false; + } +return err; }module_init (damon_sample_wsse_init);
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 442/515 mm/damon/core: commit damos->target_nid
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bijan Tabatabai <[email protected]>
commit 579bd5006fe7f4a7abb32da0160d376476cab67d upstream.
When committing new scheme parameters from the sysfs, the target_nid field of the damos struct would not be copied. This would result in the target_nid field to retain its original value, despite being updated in the sysfs interface.
This patch fixes this issue by copying target_nid in damos_commit().
--- mm/damon/core.c | 1 + 1 file changed, 1 insertion(+)
mm/damon/core.c +1 -0
@@ -978,6 +978,7 @@ static int damos_commit(struct damos *dsreturn err; dst->wmarks = src->wmarks; + dst->target_nid = src->target_nid; err =damos_commit_filters (dst, src);return err;
Greg Kroah-Hartman
maintainerPATCH 443/515 block: Introduce bio_needs_zone_write_plugging()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
commit f70291411ba20d50008db90a6f0731efac27872c upstream.
In preparation for fixing device mapper zone write handling, introduce the inline helper function bio_needs_zone_write_plugging() to test if a BIO requires handling through zone write plugging using the function blk_zone_plug_bio(). This function returns true for any write (op_is_write(bio) == true) operation directed at a zoned block device using zone write plugging, that is, a block device with a disk that has a zone write plug hash table.
This helper allows simplifying the check on entry to blk_zone_plug_bio() and used in to protect calls to it for blk-mq devices and DM devices.
--- block/blk-mq.c | 6 +++-- block/blk-zoned.c | 20 ----------------- drivers/md/dm.c | 4 ++- include/linux/blkdev.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 22 deletions(-)
block/blk-mq.c +4 -2
@@ -3117,8 +3117,10 @@ void blk_mq_submit_bio(struct bio *bio)if (blk_mq_attempt_bio_merge (q, bio, nr_segs)) goto queue_exit; -if (blk_queue_is_zoned (q) &&blk_zone_plug_bio (bio, nr_segs)) - goto queue_exit; +if (bio_needs_zone_write_plugging (bio)) { +if (blk_zone_plug_bio (bio, nr_segs)) + goto queue_exit; + } new_request:if (rq) {
block/blk-zoned.c +1 -19
@@ -1116,25 +1116,7 @@ bool blk_zone_plug_bio(struct bio *bio, {struct block_device *bdev = bio->bi_bdev; -if (!bdev->bd_disk->zone_wplugs_hash) -return false; - -/* -* If the BIO already has the plugging flag set, then it was already -* handled through this path and this is a submission from the zone -* plug bio submit work. -*/ -if (bio_flagged (bio,BIO_ZONE_WRITE_PLUGGING )) -return false; - -/* -* We do not need to do anything special for empty flush BIOs, e.g -* BIOs such as issued by blkdev_issue_flush(). The is because it is -* the responsibility of the user to first wait for the completion of -* write operations for flush to have any effect on the persistence of -* the written data. -*/ -if (op_is_flush (bio->bi_opf) && !bio_sectors (bio)) +if (WARN_ON_ONCE (!bdev->bd_disk->zone_wplugs_hash))return false;/*
drivers/md/dm.c +3 -1
@@ -1802,7 +1802,9 @@ static inline bool dm_zone_bio_needs_spl }static inline bool dm_zone_plug_bio (struct mapped_device *md,struct bio *bio) { -return dm_emulate_zone_append (md) &&blk_zone_plug_bio (bio,0 ); +if (!bio_needs_zone_write_plugging (bio)) +return false; +return blk_zone_plug_bio (bio,0 ); } static blk_status_t __send_zone_reset_all_emulated(struct clone_info *ci,
include/linux/blkdev.h +55 -0
67 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 444/515 dm: Always split write BIOs to zoned device limits
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
commit 2df7168717b7d2d32bcf017c68be16e4aae9dd13 upstream.
Any zoned DM target that requires zone append emulation will use the block layer zone write plugging. In such case, DM target drivers must not split BIOs using dm_accept_partial_bio() as doing so can potentially lead to deadlocks with queue freeze operations. Regular write operations used to emulate zone append operations also cannot be split by the target driver as that would result in an invalid writen sector value return using the BIO sector.
In order for zoned DM target drivers to avoid such incorrect BIO splitting, we must ensure that large BIOs are split before being passed to the map() function of the target, thus guaranteeing that the limits for the mapped device are not exceeded.
dm-crypt and dm-flakey are the only target drivers supporting zoned devices and using dm_accept_partial_bio().
In the case of dm-crypt, this function is used to split BIOs to the internal max_write_size limit (which will be suppressed in a different patch). However, since crypt_alloc_buffer() uses a bioset allowing only up to BIO_MAX_VECS (256) vectors in a BIO. The dm-crypt device max_segments limit, which is not set and so default to BLK_MAX_SEGMENTS (128), must thus be respected and write BIOs split accordingly.
In the case of dm-flakey, since zone append emulation is not required, the block layer zone write plugging is not used and no splitting of BIOs required.
Modify the function dm_zone_bio_needs_split() to use the block layer helper function bio_needs_zone_write_plugging() to force a call to bio_split_to_limits() in dm_split_and_process_bio(). This allows DM target drivers to avoid using dm_accept_partial_bio() for write operations on zoned DM devices.
--- drivers/md/dm.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-)
drivers/md/dm.c +22 -7
@@ -1794,12 +1794,29 @@ static inline bool dm_zone_bio_needs_spl struct bio *bio) {/* -* For mapped device that need zone append emulation, we must -* split any large BIO that straddles zone boundaries. +* Special case the zone operations that cannot or should not be split. */ -return dm_emulate_zone_append (md) &&bio_straddles_zones (bio) && - !bio_flagged (bio,BIO_ZONE_WRITE_PLUGGING ); +switch (bio_op (bio)) { +case REQ_OP_ZONE_APPEND : +case REQ_OP_ZONE_FINISH : +case REQ_OP_ZONE_RESET : +case REQ_OP_ZONE_RESET_ALL : +return false; +default : +break ; + } + +/* +* Mapped devices that require zone append emulation will use the block +* layer zone write plugging. In such case, we must split any large BIO +* to the mapped device limits to avoid potential deadlocks with queue +* freeze operations. +*/ +if (!dm_emulate_zone_append (md)) +return false; +return bio_needs_zone_write_plugging (bio) ||bio_straddles_zones (bio); } +static inline bool dm_zone_plug_bio (struct mapped_device *md,struct bio *bio) {if (!bio_needs_zone_write_plugging (bio))
@@ -1948,9 +1965,7 @@ static void dm_split_and_process_bio(str is_abnormal =is_abnormal_io (bio);if (static_branch_unlikely (&zoned_enabled)) { -/* Special case REQ_OP_ZONE_RESET_ALL as it cannot be split. */ - need_split = (bio_op (bio) !=REQ_OP_ZONE_RESET_ALL ) && - (is_abnormal ||dm_zone_bio_needs_split (md, bio)); + need_split = is_abnormal ||dm_zone_bio_needs_split (md, bio); }else { need_split = is_abnormal; }
Greg Kroah-Hartman
maintainerPATCH 445/515 clk: qcom: gcc-ipq8074: fix broken freq table for nss_port6_tx_clk_src
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Marangi <[email protected]>
commit 077ec7bcec9a8987d2a133afb7e13011878c7576 upstream.
With the conversion done by commit e88f03230dc0 ("clk: qcom: gcc-ipq8074:
rework nss_port5/6 clock to multiple conf") a Copy-Paste error was made for the nss_port6_tx_clk_src frequency table.
This was caused by the wrong setting of the parent in ftbl_nss_port6_tx_clk_src that was wrongly set to P_UNIPHY1_RX instead of P_UNIPHY2_TX.
This cause the UNIPHY2 port to malfunction when it needs to be scaled to higher clock. The malfunction was observed with the example scenario with an Aquantia 10G PHY connected and a speed higher than 1G (example 2.5G)
Fix the broken frequency table to restore original functionality.
--- drivers/clk/qcom/gcc-ipq8074.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/qcom/gcc-ipq8074.c +3 -3
@@ -1895,10 +1895,10 @@ static const struct freq_conf ftbl_nss_pstatic const struct freq_multi_tbl ftbl_nss_port6_tx_clk_src[] = {FMS (19200000 ,P_XO ,1 ,0 ,0 ),FM (25000000 , ftbl_nss_port6_tx_clk_src_25), -FMS (78125000 ,P_UNIPHY1_RX ,4 ,0 ,0 ), +FMS (78125000 ,P_UNIPHY2_TX ,4 ,0 ,0 ),FM (125000000 , ftbl_nss_port6_tx_clk_src_125), -FMS (156250000 ,P_UNIPHY1_RX ,2 ,0 ,0 ), -FMS (312500000 ,P_UNIPHY1_RX ,1 ,0 ,0 ), +FMS (156250000 ,P_UNIPHY2_TX ,2 ,0 ,0 ), +FMS (312500000 ,P_UNIPHY2_TX ,1 ,0 ,0 ), { } };
Greg Kroah-Hartman
maintainerPATCH 446/515 clk: qcom: dispcc-sm8750: Fix setting rate byte and pixel clocks
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 0acf9e65a47d1e489c8b24c45a64436e30bcccf4 upstream.
On SM8750 the setting rate of pixel and byte clocks, while the parent DSI PHY PLL, fails with:
disp_cc_mdss_byte0_clk_src: rcg didn't update its configuration.
DSI PHY PLL has to be unprepared and its "PLL Power Down" bits in CMN_CTRL_0 asserted.
Mark these clocks with CLK_OPS_PARENT_ENABLE to ensure the parent is enabled during rate changes.
--- drivers/clk/qcom/dispcc-sm8750.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/qcom/dispcc-sm8750.c +5 -5
@@ -393,7 +393,7 @@ static struct clk_rcg2 disp_cc_mdss_byte0_clk_src = { .name = "disp_cc_mdss_byte0_clk_src", .parent_data = disp_cc_parent_data_1, .num_parents = ARRAY_SIZE(disp_cc_parent_data_1), - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE, .ops = &clk_byte2_ops, }, };
@@ -408,7 +408,7 @@ static struct clk_rcg2 disp_cc_mdss_byte1_clk_src = { .name = "disp_cc_mdss_byte1_clk_src", .parent_data = disp_cc_parent_data_1, .num_parents = ARRAY_SIZE(disp_cc_parent_data_1), - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE, .ops = &clk_byte2_ops, }, };
@@ -712,7 +712,7 @@ static struct clk_rcg2 disp_cc_mdss_pclk0_clk_src = { .name = "disp_cc_mdss_pclk0_clk_src", .parent_data = disp_cc_parent_data_1, .num_parents = ARRAY_SIZE(disp_cc_parent_data_1), - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE, .ops = &clk_pixel_ops, }, };
@@ -727,7 +727,7 @@ static struct clk_rcg2 disp_cc_mdss_pclk1_clk_src = { .name = "disp_cc_mdss_pclk1_clk_src", .parent_data = disp_cc_parent_data_1, .num_parents = ARRAY_SIZE(disp_cc_parent_data_1), - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE, .ops = &clk_pixel_ops, }, };
@@ -742,7 +742,7 @@ static struct clk_rcg2 disp_cc_mdss_pclk2_clk_src = { .name = "disp_cc_mdss_pclk2_clk_src", .parent_data = disp_cc_parent_data_1, .num_parents = ARRAY_SIZE(disp_cc_parent_data_1), - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE, .ops = &clk_pixel_ops, }, };
Signature · 1 line
2.50.1
Greg Kroah-Hartman
maintainerPATCH 447/515 cifs: reset iface weights when we cannot find a candidate
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shyam Prasad N <[email protected]>
commit 9d5eff7821f6d70f7d1b4d8a60680fba4de868a7 upstream.
We now do a weighted selection of server interfaces when allocating new channels. The weights are decided based on the speed advertised. The fulfilled weight for an interface is a counter that is used to track the interface selection. It should be reset back to zero once all interfaces fulfilling their weight.
In cifs_chan_update_iface, this reset logic was missing. As a result when the server interface list changes, the client may not be able to find a new candidate for other channels after all interfaces have been fulfilled.
--- fs/smb/client/sess.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/smb/client/sess.c +9 -0
@@ -332,6 +332,7 @@ cifs_chan_update_iface(struct cifs_ses *struct cifs_server_iface *old_iface =NULL ;struct cifs_server_iface *last_iface =NULL ;struct sockaddr_storage ss; +int retry =0 ;spin_lock (&ses->chan_lock); chan_index =cifs_ses_get_chan_index (ses, server);
@@ -360,6 +361,7 @@ cifs_chan_update_iface(struct cifs_ses *return ; } +try_again: last_iface = list_last_entry(&ses->iface_list, struct cifs_server_iface, iface_head); iface_min_speed = last_iface->speed;
@@ -397,6 +399,13 @@ cifs_chan_update_iface(struct cifs_ses * }if (list_entry_is_head (iface, &ses->iface_list, iface_head)) { +list_for_each_entry (iface, &ses->iface_list, iface_head) + iface->weight_fulfilled =0 ; + +/* see if it can be satisfied in second attempt */ +if (!retry++) + goto try_again; + iface =NULL ;cifs_dbg (FYI ,"unable to find a suitable iface\n" ); }
Greg Kroah-Hartman
maintainerPATCH 448/515 iommu/vt-d: Optimize iotlb_sync_map for non-caching/non-RWBF modes
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lu Baolu <[email protected]>
commit 12724ce3fe1a3d8f30d56e48b4f272d8860d1970 upstream.
The iotlb_sync_map iommu ops allows drivers to perform necessary cache flushes when new mappings are established. For the Intel iommu driver, this callback specifically serves two purposes:
- To flush caches when a second-stage page table is attached to a device whose iommu is operating in caching mode (CAP_REG.CM==1).
- To explicitly flush internal write buffers to ensure updates to memory- resident remapping structures are visible to hardware (CAP_REG.RWBF==1).
However, in scenarios where neither caching mode nor the RWBF flag is active, the cache_tag_flush_range_np() helper, which is called in the iotlb_sync_map path, effectively becomes a no-op.
Despite being a no-op, cache_tag_flush_range_np() involves iterating through all cache tags of the iommu's attached to the domain, protected by a spinlock. This unnecessary execution path introduces overhead, leading to a measurable I/O performance regression. On systems with NVMes under the same bridge, performance was observed to drop from approximately ~6150 MiB/s down to ~4985 MiB/s.
Introduce a flag in the dmar_domain structure. This flag will only be set when iotlb_sync_map is required (i.e., when CM or RWBF is set). The cache_tag_flush_range_np() is called only for domains where this flag is set. This flag, once set, is immutable, given that there won't be mixed configurations in real-world scenarios where some IOMMUs in a system operate in caching mode while others do not. Theoretically, the immutability of this flag does not impact functionality.
--- drivers/iommu/intel/iommu.c | 19 ++++++++++++++++++- drivers/iommu/intel/iommu.h | 3 +++ 2 files changed, 21 insertions(+), 1 deletion(-)
drivers/iommu/intel/iommu.c +18 -1
@@ -1845,6 +1845,18 @@ static int domain_setup_first_level(stru (pgd_t *)pgd, flags, old); } +static bool domain_need_iotlb_sync_map (struct dmar_domain *domain, +struct intel_iommu *iommu) +{ +if (cap_caching_mode (iommu->cap) && !domain->use_first_level) +return true; + +if (rwbf_quirk ||cap_rwbf (iommu->cap)) +return true; + +return false; +} +static int dmar_domain_attach_device (struct dmar_domain *domain,struct device *dev) {
@@ -1882,6 +1894,8 @@ static int dmar_domain_attach_device(strif (ret) goto out_block_translation; + domain->iotlb_sync_map |=domain_need_iotlb_sync_map (domain, iommu); +return 0 ; out_block_translation:
@@ -4020,7 +4034,10 @@ static bool risky_device(struct pci_devstatic int intel_iommu_iotlb_sync_map (struct iommu_domain *domain,unsigned long iova,size_t size) { -cache_tag_flush_range_np (to_dmar_domain (domain), iova, iova + size -1 ); +struct dmar_domain *dmar_domain =to_dmar_domain (domain); + +if (dmar_domain->iotlb_sync_map) +cache_tag_flush_range_np (dmar_domain, iova, iova + size -1 );return 0 ; }
drivers/iommu/intel/iommu.h +3 -0
@@ -615,6 +615,9 @@ struct dmar_domain { u8 has_mappings:1; /* Has mappings configured through* iommu_map() interface. */ + u8 iotlb_sync_map:1; /* Need to flush IOTLB cache or write +* buffer when creating mappings. +*/ spinlock_t lock;/* Protect device tracking lists */ struct list_head devices;/* all devices' list */
Greg Kroah-Hartman
maintainerPATCH 449/515 iommu/arm-smmu-qcom: Add SM6115 MDSS compatible
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Klimov <[email protected]>
commit f7fa8520f30373ce99c436c4d57c76befdacbef3 upstream.
Add the SM6115 MDSS compatible to clients compatible list, as it also needs that workaround.
Without this workaround, for example, QRB4210 RB2 which is based on SM4250/SM6115 generates a lot of smmu unhandled context faults during boot:
arm_smmu_context_fault: 116854 callbacks suppressed arm-smmu c600000.iommu: Unhandled context fault: fsr=0x402, iova=0x5c0ec600, fsynr=0x320021, cbfrsynra=0x420, cb=5
arm-smmu c600000.iommu: FSR = 00000402 [Format=2 TF], SID=0x420
arm-smmu c600000.iommu: FSYNR0 = 00320021 [S1CBNDX=50 PNU PLVL=1] arm-smmu c600000.iommu: Unhandled context fault: fsr=0x402, iova=0x5c0d7800, fsynr=0x320021, cbfrsynra=0x420, cb=5
arm-smmu c600000.iommu: FSR = 00000402 [Format=2 TF], SID=0x420
and also failed initialisation of lontium lt9611uxc, gpu and dpu is observed:
(binding MDSS components triggered by lt9611uxc have failed)
------------[ cut here ]------------ !aspace WARNING: CPU: 6 PID: 324 at drivers/gpu/drm/msm/msm_gem_vma.c:130 msm_gem_vma_init+0x150/0x18c [msm] Modules linked in: ... (long list of modules) CPU: 6 UID: 0 PID: 324 Comm: (udev-worker) Not tainted 6.15.0-03037-gaacc73ceeb8b #4 PREEMPT Hardware name: Qualcomm Technologies, Inc. QRB4210 RB2 (DT) pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : msm_gem_vma_init+0x150/0x18c [msm] lr : msm_gem_vma_init+0x150/0x18c [msm] sp : ffff80008144b280 ... Call trace: msm_gem_vma_init+0x150/0x18c [msm] (P) get_vma_locked+0xc0/0x194 [msm] msm_gem_get_and_pin_iova_range+0x4c/0xdc [msm] msm_gem_kernel_new+0x48/0x160 [msm] msm_gpu_init+0x34c/0x53c [msm] adreno_gpu_init+0x1b0/0x2d8 [msm] a6xx_gpu_init+0x1e8/0x9e0 [msm] adreno_bind+0x2b8/0x348 [msm] component_bind_all+0x100/0x230 msm_drm_bind+0x13c/0x3d0 [msm] try_to_bring_up_aggregate_device+0x164/0x1d0 __component_add+0xa4/0x174 component_add+0x14/0x20 dsi_dev_attach+0x20/0x34 [msm] dsi_host_attach+0x58/0x98 [msm] devm_mipi_dsi_attach+0x34/0x90 lt9611uxc_attach_dsi.isra.0+0x94/0x124 [lontium_lt9611uxc] lt9611uxc_probe+0x540/0x5fc [lontium_lt9611uxc] i2c_device_probe+0x148/0x2a8 really_probe+0xbc/0x2c0 __driver_probe_device+0x78/0x120 driver_probe_device+0x3c/0x154 __driver_attach+0x90/0x1a0 bus_for_each_dev+0x68/0xb8 driver_attach+0x24/0x30 bus_add_driver+0xe4/0x208 driver_register+0x68/0x124 i2c_register_driver+0x48/0xcc lt9611uxc_driver_init+0x20/0x1000 [lontium_lt9611uxc] do_one_initcall+0x60/0x1d4 do_init_module+0x54/0x1fc load_module+0x1748/0x1c8c init_module_from_file+0x74/0xa0 __arm64_sys_finit_module+0x130/0x2f8 invoke_syscall+0x48/0x104 el0_svc_common.constprop.0+0xc0/0xe0 do_el0_svc+0x1c/0x28 el0_svc+0x2c/0x80 el0t_64_sync_handler+0x10c/0x138 el0t_64_sync+0x198/0x19c ---[ end trace 0000000000000000 ]--- msm_dpu 5e01000.display-controller: [drm:msm_gpu_init [msm]] *ERROR* could not allocate memptrs: -22 msm_dpu 5e01000.display-controller: failed to load adreno gpu platform a400000.remoteproc:glink-edge:apr:service@7:dais: Adding to iommu group 19 msm_dpu 5e01000.display-controller: failed to bind 5900000.gpu (ops a3xx_ops [msm]): -22 msm_dpu 5e01000.display-controller: adev bind failed: -22 lt9611uxc 0-002b: failed to attach dsi to host lt9611uxc 0-002b: probe with driver lt9611uxc failed with error -22
--- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 1 + 1 file changed, 1 insertion(+)
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +1 -0
@@ -366,6 +366,7 @@ static const struct of_device_id qcom_sm { .compatible = "qcom,sdm670-mdss" }, { .compatible = "qcom,sdm845-mdss" }, { .compatible = "qcom,sdm845-mss-pil" }, + { .compatible = "qcom,sm6115-mdss" }, { .compatible = "qcom,sm6350-mdss" }, { .compatible = "qcom,sm6375-mdss" }, { .compatible = "qcom,sm8150-mdss" },
Greg Kroah-Hartman
maintainerPATCH 450/515 iommufd: Report unmapped bytes in the error path of iopt_unmap_iova_range
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolin Chen <[email protected]>
commit b23e09f9997771b4b739c1c694fa832b5fa2de02 upstream.
There are callers that read the unmapped bytes even when rc != 0. Thus, do not forget to report it in the error path too.
--- drivers/iommu/iommufd/io_pagetable.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/iommu/iommufd/io_pagetable.c +5 -2
@@ -743,8 +743,10 @@ again:iommufd_access_notify_unmap (iopt, area_first, length);/* Something is not responding to unmap requests. */ tries++; -if (WARN_ON (tries >100 )) -return -EDEADLOCK ; +if (WARN_ON (tries >100 )) { + rc = -EDEADLOCK ; + goto out_unmapped; + } goto again; }
@@ -766,6 +768,7 @@ again: out_unlock_iova:up_write (&iopt->iova_rwsem);up_read (&iopt->domains_rwsem); +out_unmapped:if (unmapped) *unmapped = unmapped_bytes;return rc;
Greg Kroah-Hartman
maintainerPATCH 451/515 iommufd: Prevent ALIGN() overflow
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
commit b42497e3c0e74db061eafad41c0cd7243c46436b upstream.
When allocating IOVA the candidate range gets aligned to the target alignment. If the range is close to ULONG_MAX then the ALIGN() can wrap resulting in a corrupted iova.
Open code the ALIGN() using get_add_overflow() to prevent this. This simplifies the checks as we don't need to check for length earlier either.
Consolidate the two copies of this code under a single helper.
This bug would allow userspace to create a mapping that overlaps with some other mapping or a reserved range.
--- drivers/iommu/iommufd/io_pagetable.c | 41 +++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 16 deletions(-)
drivers/iommu/iommufd/io_pagetable.c +25 -16
@@ -70,36 +70,45 @@ struct iopt_area *iopt_area_contig_next(return iter->area; } -static bool __alloc_iova_check_hole (struct interval_tree_double_span_iter *span, -unsigned long length, -unsigned long iova_alignment, -unsigned long page_offset) +static bool __alloc_iova_check_range (unsigned long *start,unsigned long last, +unsigned long length, +unsigned long iova_alignment, +unsigned long page_offset) { -if (span->is_used || span->last_hole - span->start_hole < length -1 ) +unsigned long aligned_start; + +/* ALIGN_UP() */ +if (check_add_overflow (*start, iova_alignment -1 , &aligned_start))return false; + aligned_start &= ~(iova_alignment -1 ); + aligned_start |= page_offset; - span->start_hole =ALIGN (span->start_hole, iova_alignment) | - page_offset; -if (span->start_hole > span->last_hole || - span->last_hole - span->start_hole < length -1 ) +if (aligned_start >= last || last - aligned_start < length -1 )return false; + *start = aligned_start;return true; } -static bool __alloc_iova_check_used (struct interval_tree_span_iter *span, +static bool __alloc_iova_check_hole (struct interval_tree_double_span_iter *span,unsigned long length,unsigned long iova_alignment,unsigned long page_offset) { -if (span->is_hole || span->last_used - span->start_used < length -1 ) +if (span->is_used)return false; +return __alloc_iova_check_range (&span->start_hole, span->last_hole, + length, iova_alignment, page_offset); +} - span->start_used =ALIGN (span->start_used, iova_alignment) | - page_offset; -if (span->start_used > span->last_used || - span->last_used - span->start_used < length -1 ) +static bool __alloc_iova_check_used (struct interval_tree_span_iter *span, +unsigned long length, +unsigned long iova_alignment, +unsigned long page_offset) +{ +if (span->is_hole)return false; -return true; +return __alloc_iova_check_range (&span->start_used, span->last_used, + length, iova_alignment, page_offset); }/*
Greg Kroah-Hartman
maintainerPATCH 452/515 ext4: fix zombie groups in average fragment size lists
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
commit 1c320d8e92925bb7615f83a7b6e3f402a5c2ca63 upstream.
Groups with no free blocks shouldn't be in any average fragment size list. However, when all blocks in a group are allocated(i.e., bb_fragments or bb_free is 0), we currently skip updating the average fragment size, which means the group isn't removed from its previous s_mb_avg_fragment_size[old] list.
This created "zombie" groups that were always skipped during traversal as they couldn't satisfy any block allocation requests, negatively impacting traversal efficiency.
Therefore, when a group becomes completely full, bb_avg_fragment_size_order is now set to -1. If the old order was not -1, a removal operation is performed; if the new order is not -1, an insertion is performed.
--- fs/ext4/mballoc.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
fs/ext4/mballoc.c +17 -17
@@ -841,30 +841,30 @@ static void mb_update_avg_fragment_size(struct super_block *sb, struct ext4_group_info *grp) { struct ext4_sb_info *sbi = EXT4_SB(sb); -int new_order; +int new, old; -if (!test_opt2 (sb,MB_OPTIMIZE_SCAN ) || grp->bb_fragments ==0 ) +if (!test_opt2 (sb,MB_OPTIMIZE_SCAN ))return ; - new_order =mb_avg_fragment_size_order (sb, - grp->bb_free / grp->bb_fragments); -if (new_order == grp->bb_avg_fragment_size_order) + old = grp->bb_avg_fragment_size_order; + new = grp->bb_fragments ==0 ?-1 : +mb_avg_fragment_size_order (sb, grp->bb_free / grp->bb_fragments); +if (new == old)return ; -if (grp->bb_avg_fragment_size_order !=-1 ) { -write_lock (&sbi->s_mb_avg_fragment_size_locks[ - grp->bb_avg_fragment_size_order]); +if (old >=0 ) { +write_lock (&sbi->s_mb_avg_fragment_size_locks[old]);list_del (&grp->bb_avg_fragment_size_node); -write_unlock (&sbi->s_mb_avg_fragment_size_locks[ - grp->bb_avg_fragment_size_order]); +write_unlock (&sbi->s_mb_avg_fragment_size_locks[old]); + } + + grp->bb_avg_fragment_size_order = new; +if (new >=0 ) { +write_lock (&sbi->s_mb_avg_fragment_size_locks[new]); +list_add_tail (&grp->bb_avg_fragment_size_node, + &sbi->s_mb_avg_fragment_size[new]); +write_unlock (&sbi->s_mb_avg_fragment_size_locks[new]); } - grp->bb_avg_fragment_size_order = new_order; -write_lock (&sbi->s_mb_avg_fragment_size_locks[ - grp->bb_avg_fragment_size_order]); -list_add_tail (&grp->bb_avg_fragment_size_node, - &sbi->s_mb_avg_fragment_size[grp->bb_avg_fragment_size_order]); -write_unlock (&sbi->s_mb_avg_fragment_size_locks[ - grp->bb_avg_fragment_size_order]); }/*
Greg Kroah-Hartman
maintainerPATCH 453/515 ext4: fix largest free orders lists corruption on mb_optimize_scan switch
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
commit 7d345aa1fac4c2ec9584fbd6f389f2c2368671d5 upstream.
The grp->bb_largest_free_order is updated regardless of whether mb_optimize_scan is enabled. This can lead to inconsistencies between grp->bb_largest_free_order and the actual s_mb_largest_free_orders list index when mb_optimize_scan is repeatedly enabled and disabled via remount.
For example, if mb_optimize_scan is initially enabled, largest free order is 3, and the group is in s_mb_largest_free_orders[3]. Then, mb_optimize_scan is disabled via remount, block allocations occur, updating largest free order to 2. Finally, mb_optimize_scan is re-enabled via remount, more block allocations update largest free order to 1.
At this point, the group would be removed from s_mb_largest_free_orders[3] under the protection of s_mb_largest_free_orders_locks[2]. This lock mismatch can lead to list corruption.
To fix this, whenever grp->bb_largest_free_order changes, we now always attempt to remove the group from its old order list. However, we only insert the group into the new order list if mb_optimize_scan is enabled. This approach helps prevent lock inconsistencies and ensures the data in the order lists remains reliable.
--- fs/ext4/mballoc.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-)
fs/ext4/mballoc.c +14 -19
@@ -1150,33 +1150,28 @@ static void mb_set_largest_free_order(struct super_block *sb, struct ext4_group_info *grp) { struct ext4_sb_info *sbi = EXT4_SB(sb); -int i; +int new, old = grp->bb_largest_free_order; -for (i =MB_NUM_ORDERS (sb) -1 ; i >=0 ; i--) -if (grp->bb_counters[i] >0 ) +for (new =MB_NUM_ORDERS (sb) -1 ; new >=0 ; new--) +if (grp->bb_counters[new] >0 )break ; +/* No need to move between order lists? */ -if (!test_opt2 (sb,MB_OPTIMIZE_SCAN ) || - i == grp->bb_largest_free_order) { - grp->bb_largest_free_order = i; +if (new == old)return ; - } -if (grp->bb_largest_free_order >=0 ) { -write_lock (&sbi->s_mb_largest_free_orders_locks[ - grp->bb_largest_free_order]); +if (old >=0 && !list_empty (&grp->bb_largest_free_order_node)) { +write_lock (&sbi->s_mb_largest_free_orders_locks[old]);list_del_init (&grp->bb_largest_free_order_node); -write_unlock (&sbi->s_mb_largest_free_orders_locks[ - grp->bb_largest_free_order]); +write_unlock (&sbi->s_mb_largest_free_orders_locks[old]); } - grp->bb_largest_free_order = i; -if (grp->bb_largest_free_order >=0 && grp->bb_free) { -write_lock (&sbi->s_mb_largest_free_orders_locks[ - grp->bb_largest_free_order]); + + grp->bb_largest_free_order = new; +if (test_opt2 (sb,MB_OPTIMIZE_SCAN ) && new >=0 && grp->bb_free) { +write_lock (&sbi->s_mb_largest_free_orders_locks[new]);list_add_tail (&grp->bb_largest_free_order_node, - &sbi->s_mb_largest_free_orders[grp->bb_largest_free_order]); -write_unlock (&sbi->s_mb_largest_free_orders_locks[ - grp->bb_largest_free_order]); + &sbi->s_mb_largest_free_orders[new]); +write_unlock (&sbi->s_mb_largest_free_orders_locks[new]); } }
Greg Kroah-Hartman
maintainerPATCH 454/515 ext4: initialize superblock fields in the kballoc-test.c kunit tests
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Yi <[email protected]>
commit 82e6381e23f1ea7a14f418215068aaa2ca046c84 upstream.
Various changes in the "ext4: better scalability for ext4 block allocation" patch series have resulted in kunit test failures, most notably in the test_new_blocks_simple and the test_mb_mark_used tests. The root cause of these failures is that various in-memory ext4 data structures were not getting initialized, and while previous versions of the functions exercised by the unit tests didn't use these structure members, this was arguably a test bug.
Since one of the patches in the block allocation scalability patches is a fix which is has a cc:stable tag, this commit also has a cc:stable tag.
--- fs/ext4/mballoc-test.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/ext4/mballoc-test.c +9 -0
@@ -155,6 +155,7 @@ static struct super_block *mbt_ext4_allobgl_lock_init (sbi->s_blockgroup_lock); sbi->s_es = &fsb->es; + sbi->s_sb = sb; sb->s_fs_info = sbi;up_write (&sb->s_umount);
@@ -802,6 +803,10 @@ static void test_mb_mark_used(struct kunKUNIT_ASSERT_EQ (test, ret,0 ); grp->bb_free =EXT4_CLUSTERS_PER_GROUP (sb); + grp->bb_largest_free_order =-1 ; + grp->bb_avg_fragment_size_order =-1 ; +INIT_LIST_HEAD (&grp->bb_largest_free_order_node); +INIT_LIST_HEAD (&grp->bb_avg_fragment_size_node);mbt_generate_test_ranges (sb, ranges,TEST_RANGE_COUNT );for (i =0 ; i <TEST_RANGE_COUNT ; i++) test_mb_mark_used_range(test, &e4b, ranges[i].start,
@@ -875,6 +880,10 @@ static void test_mb_free_blocks(struct kext4_unlock_group (sb,TEST_GOAL_GROUP ); grp->bb_free =0 ; + grp->bb_largest_free_order =-1 ; + grp->bb_avg_fragment_size_order =-1 ; +INIT_LIST_HEAD (&grp->bb_largest_free_order_node); +INIT_LIST_HEAD (&grp->bb_avg_fragment_size_node);memset (bitmap,0xff , sb->s_blocksize);mbt_generate_test_ranges (sb, ranges,TEST_RANGE_COUNT );
Greg Kroah-Hartman
maintainerPATCH 455/515 usb: core: config: Prevent OOB read in SS endpoint companion parsing
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xinyu Liu <[email protected]>
commit cf16f408364efd8a68f39011a3b073c83a03612d upstream.
usb_parse_ss_endpoint_companion() checks descriptor type before length, enabling a potentially odd read outside of the buffer size.
Fix this up by checking the size first before looking at any of the fields in the descriptor.
--- drivers/usb/core/config.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/usb/core/config.c +8 -2
@@ -107,8 +107,14 @@ static void usb_parse_ss_endpoint_compan*/ desc = (struct usb_ss_ep_comp_descriptor *) buffer; -if (desc->bDescriptorType !=USB_DT_SS_ENDPOINT_COMP || - size <USB_DT_SS_EP_COMP_SIZE ) { +if (size <USB_DT_SS_EP_COMP_SIZE ) { +dev_notice (ddev, +"invalid SuperSpeed endpoint companion descriptor " +"of length %d, skipping\n" , size); +return ; + } + +if (desc->bDescriptorType !=USB_DT_SS_ENDPOINT_COMP ) { dev_notice(ddev, "No SuperSpeed endpoint companion for config %d " " interface %d altsetting %d ep %d: " "using minimum values\n",
Greg Kroah-Hartman
maintainerPATCH 456/515 misc: rtsx: usb: Ensure mmc child device is active when card is present
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricky Wu <[email protected]>
commit 966c5cd72be8989c8a559ddef8e8ff07a37c5eb0 upstream.
When a card is present in the reader, the driver currently defers autosuspend by returning -EAGAIN during the suspend callback to trigger USB remote wakeup signaling. However, this does not guarantee that the mmc child device has been resumed, which may cause issues if it remains suspended while the card is accessible.
This patch ensures that all child devices, including the mmc host controller, are explicitly resumed before returning -EAGAIN. This fixes a corner case introduced by earlier remote wakeup handling, improving reliability of runtime PM when a card is inserted.
--- drivers/misc/cardreader/rtsx_usb.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/misc/cardreader/rtsx_usb.c +9 -7
@@ -698,6 +698,12 @@ static void rtsx_usb_disconnect(struct u }#ifdef CONFIG_PM +static int rtsx_usb_resume_child (struct device *dev,void *data) +{ +pm_request_resume (dev); +return 0 ; +} +static int rtsx_usb_suspend (struct usb_interface *intf,pm_message_t message) { struct rtsx_ucr *ucr =
@@ -713,8 +719,10 @@ static int rtsx_usb_suspend(struct usb_imutex_unlock (&ucr->dev_mutex);/* Defer the autosuspend if card exists */ -if (val & (SD_CD |MS_CD )) +if (val & (SD_CD |MS_CD )) { +device_for_each_child (&intf->dev,NULL , rtsx_usb_resume_child);return -EAGAIN ; + } }else {/* There is an ongoing operation*/ return -EAGAIN ;
@@ -724,12 +732,6 @@ static int rtsx_usb_suspend(struct usb_ireturn 0 ; } -static int rtsx_usb_resume_child (struct device *dev,void *data) -{ -pm_request_resume (dev); -return 0 ; -} -static int rtsx_usb_resume (struct usb_interface *intf) {device_for_each_child (&intf->dev,NULL , rtsx_usb_resume_child);
Greg Kroah-Hartman
maintainerPATCH 457/515 usb: typec: ucsi: Update power_supply on power role change
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myrrh Periwinkle <[email protected]>
commit 7616f006db07017ef5d4ae410fca99279aaca7aa upstream.
The current power direction of an USB-C port also influences the power_supply's online status, so a power role change should also update the power_supply.
Fixes an issue on some systems where plugging in a normal USB device in for the first time after a reboot will cause upower to erroneously consider the system to be connected to AC power.
--- drivers/usb/typec/ucsi/ucsi.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/typec/ucsi/ucsi.c +1 -0
@@ -1246,6 +1246,7 @@ static void ucsi_handle_connector_changeif (change &UCSI_CONSTAT_POWER_DIR_CHANGE ) {typec_set_pwr_role (con->port, role); +ucsi_port_psy_changed (con);/* Complete pending power role swap */ if (!completion_done (&con->complete))