5.10.195-rc1 review
Subsystems (12)
Greg Kroah-Hartman
maintainerPATCH 145/406 ARM: dts: BCM53573: Fix Ethernet info for Luxul devices
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafał Miłecki <[email protected]>
[ Upstream commit 44ad8207806973f4e4f7d870fff36cc01f494250 ]
Both Luxul's XAP devices (XAP-810 and XAP-1440) are access points that use a non-default design. They don't include switch but have a single Ethernet port and BCM54210E PHY connected to the Ethernet controller's MDIO bus.
Support for those devices regressed due to two changes:
1. Describing MDIO bus with switch
After commit 9fb90ae6cae7 ("ARM: dts: BCM53573: Describe on-SoC BCM53125 rev 4 switch") Linux stopped probing for MDIO devices.
2. Dropping hardcoded BCM54210E delays
In commit fea7fda7f50a ("net: phy: broadcom: Fix RGMII delays configuration for BCM54210E") support for other PHY modes was added but that requires a proper "phy-mode" value in DT.
Both above changes are correct (they don't need to be reverted or anything) but they need this fix for DT data to be correct and for Linux to work properly.
--- arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts | 13 +++++++++++++ arch/arm/boot/dts/bcm47189-luxul-xap-810.dts | 13 +++++++++++++ 2 files changed, 26 insertions(+)
arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts +13 -0
@@ -46,3 +46,16 @@ restart { }; }; }; + +&gmac0 { + phy-mode = "rgmii"; + phy-handle = <&bcm54210e>; + + mdio { + /delete-node/ switch@1e; + + bcm54210e: ethernet-phy@0 { + reg = <0>; + }; + }; +};
arch/arm/boot/dts/bcm47189-luxul-xap-810.dts +13 -0
@@ -83,3 +83,16 @@ pcie0_chipcommon: chipcommon@0 { }; }; }; + +&gmac0 { + phy-mode = "rgmii"; + phy-handle = <&bcm54210e>; + + mdio { + /delete-node/ switch@1e; + + bcm54210e: ethernet-phy@0 { + reg = <0>; + }; + }; +};
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 146/406 arm64: dts: qcom: sdm845: Add missing RPMh power domain to GCC
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 4b6ea15c0a1122422b44bf6c47a3c22fc8d46777 ]
GCC and it's GDSCs are under the RPMh CX power domain. So let's add the missing RPMh power domain to the GCC node.
--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/sdm845.dtsi +1 -0
@@ -1064,6 +1064,7 @@ gcc: clock-controller@100000 { #clock-cells = <1>; #reset-cells = <1>; #power-domain-cells = <1>; + power-domains = <&rpmhpd SDM845_CX>; }; qfprom@784000 {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 147/406 arm64: dts: qcom: sdm845: Fix the min frequency of "ice_core_clk"
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit bbbef6e24bc4493602df68b052f6f48d48e3184a ]
Minimum frequency of the "ice_core_clk" should be 75MHz as specified in the downstream vendor devicetree. So fix it!
--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sdm845.dtsi +1 -1
@@ -2109,7 +2109,7 @@ ufs_mem_hc: ufshc@1d84000 { <0 0>, <0 0>, <0 0>, - <0 300000000>; + <75000000 300000000>; status = "disabled"; };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 148/406 drm/amdgpu: Update min() to min_t() in amdgpu_info_ioctl
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivasan Shanmugam <[email protected]>
[ Upstream commit a0cc8e1512ad72c9f97cdcb76d42715730adaf62 ]
Fixes the following:
WARNING: min() should probably be min_t(size_t, size, sizeof(ip))
+ ret = copy_to_user(out, &ip, min((size_t)size, sizeof(ip)));
And other style fixes:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
WARNING: Missing a blank line after declarations
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +8 -6
@@ -505,6 +505,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file crtc = (struct drm_crtc *)minfo->crtcs[i];if (crtc && crtc->base.id == info->mode_crtc.id) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc); + ui32 = amdgpu_crtc->crtc_id; found =1 ;break ;
@@ -523,7 +524,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_fileif (ret)return ret; - ret =copy_to_user (out, &ip,min ((size_t )size,sizeof (ip))); + ret =copy_to_user (out, &ip,min_t (size_t, size,sizeof (ip)));return ret ? -EFAULT :0 ; }case AMDGPU_INFO_HW_IP_COUNT : {
@@ -671,17 +672,18 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file ? -EFAULT :0 ; }case AMDGPU_INFO_READ_MMR_REG : { -unsigned n, alloc_size; +unsigned int n, alloc_size;uint32_t *regs; -unsigned se_num = (info->read_mmr_reg.instance >> +unsigned int se_num = (info->read_mmr_reg.instance >>AMDGPU_INFO_MMR_SE_INDEX_SHIFT ) &AMDGPU_INFO_MMR_SE_INDEX_MASK ; -unsigned sh_num = (info->read_mmr_reg.instance >> +unsigned int sh_num = (info->read_mmr_reg.instance >>AMDGPU_INFO_MMR_SH_INDEX_SHIFT ) &AMDGPU_INFO_MMR_SH_INDEX_MASK ;/* set full masks if the userspace set all bits -* in the bitfields */ +* in the bitfields +*/ if (se_num ==AMDGPU_INFO_MMR_SE_INDEX_MASK ) se_num =0xffffffff ;else if (se_num >=AMDGPU_GFX_MAX_SE )
@@ -799,7 +801,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file min((size_t)size, sizeof(dev_info))) ? -EFAULT : 0; }case AMDGPU_INFO_VCE_CLOCK_TABLE : { -unsigned i; +unsigned int i;struct drm_amdgpu_info_vce_clock_table vce_clk_table = {};struct amd_vce_state *vce_state;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 149/406 md/bitmap: dont set max_write_behind if there is no write mostly device
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guoqing Jiang <[email protected]>
[ Upstream commit 8c13ab115b577bd09097b9d77916732e97e31b7b ]
We shouldn't set it since write behind IO should only happen to write mostly device.
Stable-dep-of: 44abfa6a95df ("md/md-bitmap: hold 'reconfig_mutex' in backlog_store()")
--- drivers/md/md-bitmap.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/md/md-bitmap.c +19 -0
@@ -2476,11 +2476,30 @@ backlog_store(struct mddev *mddev, const char *buf, size_t len) {unsigned long backlog;unsigned long old_mwb = mddev->bitmap_info.max_write_behind; +struct md_rdev *rdev; +bool has_write_mostly = false;int rv =kstrtoul (buf,10 , &backlog);if (rv)return rv;if (backlog >COUNTER_MAX )return -EINVAL ; + +/* +* Without write mostly device, it doesn't make sense to set +* backlog for max_write_behind. +*/ +rdev_for_each (rdev, mddev) { +if (test_bit (WriteMostly, &rdev->flags)) { + has_write_mostly = true; +break ; + } + } +if (!has_write_mostly) { +pr_warn_ratelimited ("%s: can't set backlog, no write mostly device available\n" , +mdname (mddev)); +return -EINVAL ; + } + mddev->bitmap_info.max_write_behind = backlog;if (!backlog && mddev->serial_info_pool) {/* serial_info_pool is not needed if backlog is zero */
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 150/406 md/md-bitmap: hold reconfig_mutex in backlog_store()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 44abfa6a95df425c0660d56043020b67e6d93ab8 ]
Several reasons why 'reconfig_mutex' should be held:
1) rdev_for_each() is not safe to be called without the lock, because rdev can be removed concurrently.
2) mddev_destroy_serial_pool() and mddev_create_serial_pool() should not be called concurrently.
3) mddev_suspend() from mddev_destroy/create_serial_pool() should be protected by the lock.
--- drivers/md/md-bitmap.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/md/md-bitmap.c +7 -0
@@ -2484,6 +2484,10 @@ backlog_store(struct mddev *mddev, const char *buf, size_t len)if (backlog >COUNTER_MAX )return -EINVAL ; + rv =mddev_lock (mddev); +if (rv) +return rv; +/* * Without write mostly device, it doesn't make sense to set * backlog for max_write_behind.
@@ -2497,6 +2501,7 @@ backlog_store(struct mddev *mddev, const char *buf, size_t len)if (!has_write_mostly) {pr_warn_ratelimited ("%s: can't set backlog, no write mostly device available\n" ,mdname (mddev)); +mddev_unlock (mddev);return -EINVAL ; }
@@ -2514,6 +2519,8 @@ backlog_store(struct mddev *mddev, const char *buf, size_t len) }if (old_mwb != backlog)md_bitmap_update_sb (mddev->bitmap); + +mddev_unlock (mddev);return len; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 151/406 drm/tegra: Remove superfluous error messages around platform_get_irq()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tan Zhongjun <[email protected]>
[ Upstream commit d12919bb5da571ec50588ef97683d37e36dc2de5 ]
The platform_get_irq() prints error message telling that interrupt is missing,hence there is no need to duplicated that message in the drivers.
Stable-dep-of: 2a1ca44b6543 ("drm/tegra: dpaux: Fix incorrect return value of platform_get_irq")
--- drivers/gpu/drm/tegra/dpaux.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/tegra/dpaux.c +1 -3
@@ -467,10 +467,8 @@ static int tegra_dpaux_probe(struct platform_device *pdev)return PTR_ERR (dpaux->regs); dpaux->irq =platform_get_irq (pdev,0 ); -if (dpaux->irq <0 ) { -dev_err (&pdev->dev,"failed to get IRQ\n" ); +if (dpaux->irq <0 )return -ENXIO ; - }if (!pdev->dev.pm_domain) { dpaux->rst =devm_reset_control_get (&pdev->dev,"dpaux" );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 152/406 drm/tegra: dpaux: Fix incorrect return value of platform_get_irq
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yangtao Li <[email protected]>
[ Upstream commit 2a1ca44b654346cadfc538c4fb32eecd8daf3140 ]
When platform_get_irq fails, we should return dpaux->irq instead of -ENXIO.
--- drivers/gpu/drm/tegra/dpaux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tegra/dpaux.c +1 -1
@@ -468,7 +468,7 @@ static int tegra_dpaux_probe(struct platform_device *pdev) dpaux->irq =platform_get_irq (pdev,0 );if (dpaux->irq <0 ) -return -ENXIO ; +return dpaux->irq;if (!pdev->dev.pm_domain) { dpaux->rst =devm_reset_control_get (&pdev->dev,"dpaux" );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 153/406 of: unittest: fix null pointer dereferencing in of_unittest_find_node_by_name()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruan Jinjie <[email protected]>
[ Upstream commit d6ce4f0ea19c32f10867ed93d8386924326ab474 ]
when kmalloc() fail to allocate memory in kasprintf(), name or full_name will be NULL, strcmp() will cause null pointer dereference.
--- drivers/of/unittest.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/of/unittest.c +6 -4
@@ -69,7 +69,7 @@ static void __init of_unittest_find_node_by_name(void) np =of_find_node_by_path ("/testcase-data" ); name =kasprintf (GFP_KERNEL ,"%pOF" , np); -unittest (np && !strcmp ("/testcase-data" , name), +unittest (np && name && !strcmp ("/testcase-data" , name),"find /testcase-data failed\n" );of_node_put (np);kfree (name);
@@ -80,14 +80,14 @@ static void __init of_unittest_find_node_by_name(void) np =of_find_node_by_path ("/testcase-data/phandle-tests/consumer-a" ); name =kasprintf (GFP_KERNEL ,"%pOF" , np); -unittest (np && !strcmp ("/testcase-data/phandle-tests/consumer-a" , name), +unittest (np && name && !strcmp ("/testcase-data/phandle-tests/consumer-a" , name),"find /testcase-data/phandle-tests/consumer-a failed\n" );of_node_put (np);kfree (name); np =of_find_node_by_path ("testcase-alias" ); name =kasprintf (GFP_KERNEL ,"%pOF" , np); -unittest (np && !strcmp ("/testcase-data" , name), +unittest (np && name && !strcmp ("/testcase-data" , name),"find testcase-alias failed\n" );of_node_put (np);kfree (name);
@@ -98,7 +98,7 @@ static void __init of_unittest_find_node_by_name(void) np =of_find_node_by_path ("testcase-alias/phandle-tests/consumer-a" ); name =kasprintf (GFP_KERNEL ,"%pOF" , np); -unittest (np && !strcmp ("/testcase-data/phandle-tests/consumer-a" , name), +unittest (np && name && !strcmp ("/testcase-data/phandle-tests/consumer-a" , name),"find testcase-alias/phandle-tests/consumer-a failed\n" );of_node_put (np);kfree (name);
@@ -1376,6 +1376,8 @@ static void attach_node_and_children(struct device_node *np)const char *full_name; full_name =kasprintf (GFP_KERNEL ,"%pOF" , np); +if (!full_name) +return ;if (!strcmp (full_name,"/__local_fixups__" ) || !strcmp (full_name,"/__fixups__" )) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 154/406 drm/armada: Fix off-by-one error in armada_overlay_get_property()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 5f0d984053f74983a287100a9519b2fabb785fb5 ]
As ffs() returns one more than the index of the first bit set (zero means no bits set), the color key mode value is shifted one position too much.
Fix this by using FIELD_GET() instead.
--- drivers/gpu/drm/armada/armada_overlay.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/armada/armada_overlay.c +4 -2
@@ -4,6 +4,8 @@* Rewritten from the dovefb driver, and Armada510 manuals. */ +#include <linux/bitfield.h> +#include <drm/armada_drm.h> #include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h>
@@ -446,8 +448,8 @@ static int armada_overlay_get_property(struct drm_plane *plane,drm_to_overlay_state (state)->colorkey_ug, drm_to_overlay_state(state)->colorkey_vb, 0); }else if (property == priv->colorkey_mode_prop) { - *val = (drm_to_overlay_state (state)->colorkey_mode & -CFG_CKMODE_MASK ) >>ffs (CFG_CKMODE_MASK ); + *val =FIELD_GET (CFG_CKMODE_MASK , +drm_to_overlay_state (state)->colorkey_mode); }else if (property == priv->brightness_prop) { *val =drm_to_overlay_state (state)->brightness +256 ; }else if (property == priv->contrast_prop) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 155/406 drm/panel: simple: Add missing connector type and pixel format for AUO T215HVN01
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit 7a675a8fa598edb29a664a91adb80f0340649f6f ]
The connector type and pixel format are missing for this panel, add them to prevent various drivers from failing to determine either of those parameters.
--- drivers/gpu/drm/panel/panel-simple.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-simple.c +3 -1
@@ -1200,7 +1200,9 @@ static const struct panel_desc auo_t215hvn01 = { .delay = { .disable = 5, .unprepare = 1000, - } + }, + .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, + .connector_type = DRM_MODE_CONNECTOR_LVDS, };static const struct drm_display_mode avic_tm070ddh03_mode = {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 156/406 ima: Remove deprecated IMA_TRUSTED_KEYRING Kconfig
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nayna Jain <[email protected]>
[ Upstream commit 5087fd9e80e539d2163accd045b73da64de7de95 ]
Time to remove "IMA_TRUSTED_KEYRING".
--- security/integrity/ima/Kconfig | 12 ------------ 1 file changed, 12 deletions(-)
security/integrity/ima/Kconfig +0 -12
@@ -248,18 +248,6 @@ config IMA_APPRAISE_MODSIG The modsig keyword can be used in the IMA policy to allow a hook to accept such signatures. -config IMA_TRUSTED_KEYRING - bool "Require all keys on the .ima keyring be signed (deprecated)" - depends on IMA_APPRAISE && SYSTEM_TRUSTED_KEYRING - depends on INTEGRITY_ASYMMETRIC_KEYS - select INTEGRITY_TRUSTED_KEYRING - default y - help - This option requires that all keys added to the .ima - keyring be signed by a key on the system trusted keyring. - - This option is deprecated in favor of INTEGRITY_TRUSTED_KEYRING - config IMA_KEYRINGS_PERMIT_SIGNED_BY_BUILTIN_OR_SECONDARY bool "Permit keys validly signed by a built-in or secondary CA cert (EXPERIMENTAL)" depends on SYSTEM_TRUSTED_KEYRING
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 157/406 drm: xlnx: zynqmp_dpsub: Add missing check for dma_set_mask
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
[ Upstream commit 1832fba7f9780aff67c96ad30f397c2d76141833 ]
Add check for dma_set_mask() and return the error if it fails.
--- drivers/gpu/drm/xlnx/zynqmp_dpsub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/xlnx/zynqmp_dpsub.c +3 -1
@@ -214,7 +214,9 @@ static int zynqmp_dpsub_probe(struct platform_device *pdev) dpsub->dev = &pdev->dev;platform_set_drvdata (pdev, dpsub); -dma_set_mask (dpsub->dev,DMA_BIT_MASK (ZYNQMP_DISP_MAX_DMA_BIT )); + ret =dma_set_mask (dpsub->dev,DMA_BIT_MASK (ZYNQMP_DISP_MAX_DMA_BIT )); +if (ret) +return ret;/* Try the reserved memory. Proceed if there's none. */ of_reserved_mem_device_init (&pdev->dev);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 158/406 drm/msm/mdp5: Dont leak some plane state
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
[ Upstream commit fd0ad3b2365c1c58aa5a761c18efc4817193beb6 ]
Apparently no one noticed that mdp5 plane states leak like a sieve ever since we introduced plane_state->commit refcount a few years ago in 21a01abbe32a ("drm/atomic: Fix freeing connector/plane state too early by tracking commits, v3.")
Fix it by using the right helpers.
Patchwork: https://patchwork.freedesktop.org/patch/551236/
--- drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c +1 -2
@@ -221,8 +221,7 @@ static void mdp5_plane_destroy_state(struct drm_plane *plane, {struct mdp5_plane_state *pstate =to_mdp5_plane_state (state); -if (state->fb) -drm_framebuffer_put (state->fb); +__drm_atomic_helper_plane_destroy_state (state);kfree (pstate); }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 159/406 firmware: meson_sm: fix to avoid potential NULL pointer dereference
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Shurong <[email protected]>
[ Upstream commit f2ed165619c16577c02b703a114a1f6b52026df4 ]
of_match_device() may fail and returns a NULL pointer.
Fix this by checking the return value of of_match_device.
--- drivers/firmware/meson/meson_sm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/firmware/meson/meson_sm.c +2 -0
@@ -292,6 +292,8 @@ static int __init meson_sm_probe(struct platform_device *pdev)return -ENOMEM ; chip =of_match_device (meson_sm_ids, dev)->data; +if (!chip) +return -EINVAL ;if (chip->cmd_shmem_in_base) { fw->sm_shmem_in_base = meson_sm_map_shmem(chip->cmd_shmem_in_base,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 160/406 smackfs: Prevent underflow in smk_set_cipso()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 3ad49d37cf5759c3b8b68d02e3563f633d9c1aee ]
There is a upper bound to "catlen" but no lower bound to prevent negatives. I don't see that this necessarily causes a problem but we may as well be safe.
--- security/smack/smackfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/smack/smackfs.c +1 -1
@@ -895,7 +895,7 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf, } ret =sscanf (rule,"%d" , &catlen); -if (ret !=1 || catlen >SMACK_CIPSO_MAXCATNUM ) +if (ret !=1 || catlen <0 || catlen >SMACK_CIPSO_MAXCATNUM ) goto out; if (format == SMK_FIXED24_FMT &&
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 161/406 drm/amd/pm: fix variable dereferenced issue in amdgpu_device_attr_create()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Wang <[email protected]>
[ Upstream commit 25e6373a5b8efc623443f2699d2b929bf3067d76 ]
- fix variable ('attr') dereferenced issue.
- using condition check instead of BUG_ON().
--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +7 -3
@@ -2115,15 +2115,19 @@ static int amdgpu_device_attr_create(struct amdgpu_device *adev, uint32_t mask, struct list_head *attr_list) { int ret = 0; -struct device_attribute *dev_attr = &attr->dev_attr; -const char *name = dev_attr->attr.name;enum amdgpu_device_attr_states attr_states =ATTR_STATE_SUPPORTED ;struct amdgpu_device_attr_entry *attr_entry; +struct device_attribute *dev_attr; +const char *name;int (*attr_update)(struct amdgpu_device *adev,struct amdgpu_device_attr *attr,uint32_t mask,enum amdgpu_device_attr_states *states) = default_attr_update; -BUG_ON (!attr); +if (!attr) +return -EINVAL ; + + dev_attr = &attr->dev_attr; + name = dev_attr->attr.name; attr_update = attr->attr_update ? attr_update : default_attr_update;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 162/406 drm/msm/a2xx: Call adreno_gpu_init() earlier
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
[ Upstream commit db07ce5da8b26bfeaf437a676ae49bd3bb1eace6 ]
The adreno_is_a20x() and adreno_is_a225() functions rely on the GPU revision, but such information is retrieved inside adreno_gpu_init(), which is called afterwards.
Fix this problem by caling adreno_gpu_init() earlier, so that the GPU information revision is available when adreno_is_a20x() and adreno_is_a225() run.
Tested on a imx53-qsb board.
Patchwork: https://patchwork.freedesktop.org/patch/543456/
--- drivers/gpu/drm/msm/adreno/a2xx_gpu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/a2xx_gpu.c +4 -4
@@ -521,6 +521,10 @@ struct msm_gpu *a2xx_gpu_init(struct drm_device *dev) gpu->perfcntrs = perfcntrs; gpu->num_perfcntrs =ARRAY_SIZE (perfcntrs); + ret =adreno_gpu_init (dev, pdev, adreno_gpu, &funcs,1 ); +if (ret) + goto fail; +if (adreno_is_a20x (adreno_gpu)) adreno_gpu->registers = a200_registers;else if (adreno_is_a225 (adreno_gpu))
@@ -528,10 +532,6 @@ struct msm_gpu *a2xx_gpu_init(struct drm_device *dev)else adreno_gpu->registers = a220_registers; - ret =adreno_gpu_init (dev, pdev, adreno_gpu, &funcs,1 ); -if (ret) - goto fail; -if (!gpu->aspace) {dev_err (dev->dev,"No memory protection without MMU\n" ); ret = -ENXIO ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 163/406 audit: fix possible soft lockup in __audit_inode_child()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gaosheng Cui <[email protected]>
[ Upstream commit b59bc6e37237e37eadf50cd5de369e913f524463 ]
Tracefs or debugfs maybe cause hundreds to thousands of PATH records, too many PATH records maybe cause soft lockup.
For example:
1. CONFIG_KASAN=y && CONFIG_PREEMPTION=n
2. auditctl -a exit,always -S open -k key
3. sysctl -w kernel.watchdog_thresh=5
4. mkdir /sys/kernel/debug/tracing/instances/test
There may be a soft lockup as follows:
watchdog: BUG: soft lockup - CPU#45 stuck for 7s! [mkdir:15498] Kernel panic - not syncing: softlockup: hung tasks Call trace: dump_backtrace+0x0/0x30c show_stack+0x20/0x30 dump_stack+0x11c/0x174 panic+0x27c/0x494 watchdog_timer_fn+0x2bc/0x390 __run_hrtimer+0x148/0x4fc __hrtimer_run_queues+0x154/0x210 hrtimer_interrupt+0x2c4/0x760 arch_timer_handler_phys+0x48/0x60 handle_percpu_devid_irq+0xe0/0x340 __handle_domain_irq+0xbc/0x130 gic_handle_irq+0x78/0x460 el1_irq+0xb8/0x140 __audit_inode_child+0x240/0x7bc tracefs_create_file+0x1b8/0x2a0 trace_create_file+0x18/0x50 event_create_dir+0x204/0x30c __trace_add_new_event+0xac/0x100 event_trace_add_tracer+0xa0/0x130 trace_array_create_dir+0x60/0x140 trace_array_create+0x1e0/0x370 instance_mkdir+0x90/0xd0 tracefs_syscall_mkdir+0x68/0xa0 vfs_mkdir+0x21c/0x34c do_mkdirat+0x1b4/0x1d4 __arm64_sys_mkdirat+0x4c/0x60 el0_svc_common.constprop.0+0xa8/0x240 do_el0_svc+0x8c/0xc0 el0_svc+0x20/0x30 el0_sync_handler+0xb0/0xb4 el0_sync+0x160/0x180
Therefore, we add cond_resched() to __audit_inode_child() to fix it.
--- kernel/auditsc.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/auditsc.c +2 -0
@@ -2203,6 +2203,8 @@ void __audit_inode_child(struct inode *parent, } } +cond_resched (); +/* is there a matching child entry? */ list_for_each_entry (n, &context->names_list, list) {/* can only match entries that have a name */
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 164/406 bus: ti-sysc: Fix build warning for 64-bit build
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Lindgren <[email protected]>
[ Upstream commit e1e1e9bb9d943ec690670a609a5f660ca10eaf85 ]
Fix "warning: cast from pointer to integer of different size" on 64-bit builds.
Note that this is a cosmetic fix at this point as the driver is not yet used for 64-bit systems.
--- drivers/bus/ti-sysc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/ti-sysc.c +1 -1
@@ -3041,7 +3041,7 @@ static int sysc_init_static_data(struct sysc *ddata) match =soc_device_match (sysc_soc_match);if (match && match->data) - sysc_soc->soc = (int )match->data; + sysc_soc->soc = (enum sysc_soc )match->data;/* Ignore devices that are not available on HS and EMU SoCs */ if (!sysc_soc->general_purpose) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 165/406 drm/mediatek: Fix potential memory leak if vmap() fail
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sui Jingfeng <[email protected]>
[ Upstream commit 379091e0f6d179d1a084c65de90fa44583b14a70 ]
Also return -ENOMEM if such a failure happens, the implement should take responsibility for the error handling.
--- drivers/gpu/drm/mediatek/mtk_drm_gem.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_drm_gem.c +5 -1
@@ -249,7 +249,11 @@ void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj) mtk_gem->kvaddr =vmap (mtk_gem->pages, npages,VM_MAP ,pgprot_writecombine (PAGE_KERNEL )); - +if (!mtk_gem->kvaddr) { +kfree (sgt); +kfree (mtk_gem->pages); +return -ENOMEM ; + } out:kfree (sgt);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 166/406 bus: ti-sysc: Fix cast to enum warning
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Lindgren <[email protected]>
[ Upstream commit de44bf2f7683347f75690ef6cf61a1d5ba8f0891 ]
Fix warning for "cast to smaller integer type 'enum sysc_soc' from 'const void *'".
--- drivers/bus/ti-sysc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/ti-sysc.c +1 -1
@@ -3041,7 +3041,7 @@ static int sysc_init_static_data(struct sysc *ddata) match =soc_device_match (sysc_soc_match);if (match && match->data) - sysc_soc->soc = (enum sysc_soc )match->data; + sysc_soc->soc = (enum sysc_soc )(uintptr_t )match->data;/* Ignore devices that are not available on HS and EMU SoCs */ if (!sysc_soc->general_purpose) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 167/406 of: unittest: Fix overlay type in apply/revert check
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 6becf8f845ae1f0b1cfed395bbeccbd23654162d ]
The removal check in of_unittest_apply_revert_overlay_check() always uses the platform device overlay type, while it should use the actual overlay type, as passed as a parameter to the function.
This has no impact on any current test, as all tests calling of_unittest_apply_revert_overlay_check() use the platform device overlay type.
--- drivers/of/unittest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/unittest.c +1 -1
@@ -2067,7 +2067,7 @@ static int __init of_unittest_apply_revert_overlay_check(int overlay_nr,of_unittest_untrack_overlay (save_id);/* unittest device must be again in before state */ -if (of_unittest_device_exists (unittest_nr,PDEV_OVERLAY ) != before) { +if (of_unittest_device_exists (unittest_nr, ovtype) != before) { unittest(0, "%s with device @\"%s\" %s\n", overlay_name_from_nr(overlay_nr), unittest_path(unittest_nr, ovtype),
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 168/406 ALSA: ac97: Fix possible error value of *rac97
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Hui <[email protected]>
[ Upstream commit 67de40c9df94037769967ba28c7d951afb45b7fb ]
Before committing 79597c8bf64c, *rac97 always be NULL if there is an error. When error happens, make sure *rac97 is NULL is safer.
For examble, in snd_vortex_mixer():
err = snd_ac97_mixer(pbus, &ac97, &vortex->codec); vortex->isquad = ((vortex->codec == NULL) ? 0 : (vortex->codec->ext_id&0x80));
If error happened but vortex->codec isn't NULL, this may cause some problems.
Move the judgement order to be clearer and better.
--- sound/pci/ac97/ac97_codec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
sound/pci/ac97/ac97_codec.c +2 -3
@@ -2007,10 +2007,9 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, .dev_disconnect = snd_ac97_dev_disconnect, }; -if (!rac97) -return -EINVAL ; -if (snd_BUG_ON (!bus || !template)) +if (snd_BUG_ON (!bus || !template || !rac97))return -EINVAL ; + *rac97 =NULL ;if (snd_BUG_ON (template->num >=4 ))return -EINVAL ;if (bus->codec[template->num])
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 169/406 ipmi:ssif: Add check for kstrdup
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
[ Upstream commit c5586d0f711e9744d0cade39b0c4a2d116a333ca ]
Add check for the return value of kstrdup() and return the error if it fails in order to avoid NULL pointer dereference.
Message-Id: <[email protected]>
--- drivers/char/ipmi/ipmi_ssif.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/char/ipmi/ipmi_ssif.c +5 -0
@@ -1614,6 +1614,11 @@ static int ssif_add_infos(struct i2c_client *client) info->addr_src =SI_ACPI ; info->client = client; info->adapter_name =kstrdup (client->adapter->name,GFP_KERNEL ); +if (!info->adapter_name) { +kfree (info); +return -ENOMEM ; + } + info->binfo.addr = client->addr;list_add_tail (&info->link, &ssif_infos);return 0 ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 170/406 ipmi:ssif: Fix a memory leak when scanning for an adapter
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Corey Minyard <[email protected]>
[ Upstream commit b8d72e32e1453d37ee5c8a219f24e7eeadc471ef ]
The adapter scan ssif_info_find() sets info->adapter_name if the adapter info came from SMBIOS, as it's not set in that case. However, this function can be called more than once, and it will leak the adapter name if it had already been set. So check for NULL before setting it.
--- drivers/char/ipmi/ipmi_ssif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/ipmi/ipmi_ssif.c +1 -1
@@ -1414,7 +1414,7 @@ static struct ssif_addr_info *ssif_info_find(unsigned short addr, restart:list_for_each_entry (info, &ssif_infos, link) {if (info->binfo.addr == addr) { -if (info->addr_src ==SI_SMBIOS ) +if (info->addr_src ==SI_SMBIOS && !info->adapter_name) info->adapter_name =kstrdup (adapter_name,GFP_KERNEL );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 171/406 drivers: clk: keystone: Fix parameter judgment in _of_pll_clk_init()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Minjie Du <[email protected]>
[ Upstream commit a995c50db887ef97f3160775aef7d772635a6f6e ]
The function clk_register_pll() may return NULL or an ERR_PTR. Don't treat an ERR_PTR as valid.
--- drivers/clk/keystone/pll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/keystone/pll.c +1 -1
@@ -209,7 +209,7 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl) } clk =clk_register_pll (NULL , node->name, parent_name, pll_data); -if (clk) { +if (!IS_ERR_OR_NULL (clk)) {of_clk_add_provider (node, of_clk_src_simple_get, clk);return ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 172/406 clk: sunxi-ng: Modify mismatched function name
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Jianhua <[email protected]>
[ Upstream commit 075d9ca5b4e17f84fd1c744a405e69ec743be7f0 ]
No functional modification involved.
drivers/clk/sunxi-ng/ccu_mmc_timing.c:54: warning: expecting prototype for sunxi_ccu_set_mmc_timing_mode(). Prototype was for sunxi_ccu_get_mmc_timing_mode() instead
--- drivers/clk/sunxi-ng/ccu_mmc_timing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/sunxi-ng/ccu_mmc_timing.c +1 -1
@@ -43,7 +43,7 @@ int sunxi_ccu_set_mmc_timing_mode(struct clk *clk, bool new_mode)EXPORT_SYMBOL_GPL (sunxi_ccu_set_mmc_timing_mode);/** -* sunxi_ccu_set_mmc_timing_mode: Get the current MMC clock timing mode +* sunxi_ccu_get_mmc_timing_mode: Get the current MMC clock timing mode * @clk: clock to query * * Returns 0 if the clock is in old timing mode, > 0 if it is in
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 173/406 clk: qcom: gcc-sc7180: use ARRAY_SIZE instead of specifying num_parents
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit e957ca2a930ad42e47bf5c9ea2a7afa0960ec1d8 ]
Use ARRAY_SIZE() instead of manually specifying num_parents. This makes adding/removing entries to/from parent_data easy and errorproof.
Stable-dep-of: fd0b5ba87ad5 ("clk: qcom: gcc-sc7180: Fix up gcc_sdcc2_apps_clk_src")
--- drivers/clk/qcom/gcc-sc7180.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/clk/qcom/gcc-sc7180.c +16 -16
@@ -285,7 +285,7 @@ static struct clk_rcg2 gcc_cpuss_ahb_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_cpuss_ahb_clk_src" , .parent_data = gcc_parent_data_0_ao, - .num_parents =4 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0_ao), .flags =CLK_SET_RATE_PARENT , .ops = &clk_rcg2_ops, },
@@ -309,7 +309,7 @@ static struct clk_rcg2 gcc_gp1_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_gp1_clk_src" , .parent_data = gcc_parent_data_4, - .num_parents =5 , + .num_parents =ARRAY_SIZE (gcc_parent_data_4), .ops = &clk_rcg2_ops, }, };
@@ -323,7 +323,7 @@ static struct clk_rcg2 gcc_gp2_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_gp2_clk_src" , .parent_data = gcc_parent_data_4, - .num_parents =5 , + .num_parents =ARRAY_SIZE (gcc_parent_data_4), .ops = &clk_rcg2_ops, }, };
@@ -337,7 +337,7 @@ static struct clk_rcg2 gcc_gp3_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_gp3_clk_src" , .parent_data = gcc_parent_data_4, - .num_parents =5 , + .num_parents =ARRAY_SIZE (gcc_parent_data_4), .ops = &clk_rcg2_ops, }, };
@@ -357,7 +357,7 @@ static struct clk_rcg2 gcc_pdm2_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_pdm2_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =4 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, }, };
@@ -378,7 +378,7 @@ static struct clk_rcg2 gcc_qspi_core_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_qspi_core_clk_src" , .parent_data = gcc_parent_data_2, - .num_parents =6 , + .num_parents =ARRAY_SIZE (gcc_parent_data_2), .ops = &clk_rcg2_ops, }, };
@@ -619,7 +619,7 @@ static struct clk_rcg2 gcc_sdcc1_apps_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_sdcc1_apps_clk_src" , .parent_data = gcc_parent_data_1, - .num_parents =5 , + .num_parents =ARRAY_SIZE (gcc_parent_data_1), .ops = &clk_rcg2_floor_ops, }, };
@@ -641,7 +641,7 @@ static struct clk_rcg2 gcc_sdcc1_ice_core_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_sdcc1_ice_core_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =4 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, }, };
@@ -665,7 +665,7 @@ static struct clk_rcg2 gcc_sdcc2_apps_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_sdcc2_apps_clk_src" , .parent_data = gcc_parent_data_5, - .num_parents =5 , + .num_parents =ARRAY_SIZE (gcc_parent_data_5), .ops = &clk_rcg2_floor_ops, }, };
@@ -688,7 +688,7 @@ static struct clk_rcg2 gcc_ufs_phy_axi_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_ufs_phy_axi_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =4 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, }, };
@@ -710,7 +710,7 @@ static struct clk_rcg2 gcc_ufs_phy_ice_core_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_ufs_phy_ice_core_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =4 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, }, };
@@ -730,7 +730,7 @@ static struct clk_rcg2 gcc_ufs_phy_phy_aux_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_ufs_phy_phy_aux_clk_src" , .parent_data = gcc_parent_data_3, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_3), .ops = &clk_rcg2_ops, }, };
@@ -751,7 +751,7 @@ static struct clk_rcg2 gcc_ufs_phy_unipro_core_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_ufs_phy_unipro_core_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =4 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, }, };
@@ -773,7 +773,7 @@ static struct clk_rcg2 gcc_usb30_prim_master_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_usb30_prim_master_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =4 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, }, };
@@ -793,7 +793,7 @@ static struct clk_rcg2 gcc_usb30_prim_mock_utmi_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_usb30_prim_mock_utmi_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =4 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, }, };
@@ -812,7 +812,7 @@ static struct clk_rcg2 gcc_usb3_prim_phy_aux_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_usb3_prim_phy_aux_clk_src" , .parent_data = gcc_parent_data_6, - .num_parents =4 , + .num_parents =ARRAY_SIZE (gcc_parent_data_6), .ops = &clk_rcg2_ops, }, };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 174/406 clk: qcom: gcc-sc7180: Fix up gcc_sdcc2_apps_clk_src
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Wronek <[email protected]>
[ Upstream commit fd0b5ba87ad5709f0fd3d2bc4b7870494a75f96a ]
Set .flags = CLK_OPS_PARENT_ENABLE to fix "gcc_sdcc2_apps_clk_src: rcg didn't update its configuration" error.
--- drivers/clk/qcom/gcc-sc7180.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/qcom/gcc-sc7180.c +1 -0
@@ -666,6 +666,7 @@ static struct clk_rcg2 gcc_sdcc2_apps_clk_src = { .name = "gcc_sdcc2_apps_clk_src", .parent_data = gcc_parent_data_5, .num_parents = ARRAY_SIZE(gcc_parent_data_5), + .flags = CLK_OPS_PARENT_ENABLE, .ops = &clk_rcg2_floor_ops, }, };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 175/406 ext4: correct grp validation in ext4_mb_good_group
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kemeng Shi <[email protected]>
[ Upstream commit a9ce5993a0f5c0887c8a1b4ffa3b8046fbcfdc93 ]
Group corruption check will access memory of grp and will trigger kernel crash if grp is NULL. So do NULL check before corruption check.
--- fs/ext4/mballoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/mballoc.c +1 -1
@@ -2103,7 +2103,7 @@ static bool ext4_mb_good_group(struct ext4_allocation_context *ac,BUG_ON (cr <0 || cr >=4 ); -if (unlikely (EXT4_MB_GRP_BBITMAP_CORRUPT (grp) || !grp)) +if (unlikely (!grp ||EXT4_MB_GRP_BBITMAP_CORRUPT (grp)))return false; free = grp->bb_free;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 176/406 clk: qcom: gcc-sm8250: use ARRAY_SIZE instead of specifying num_parents
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit c864cd5f506cf53b7f2290009fba6e933a34770d ]
Use ARRAY_SIZE() instead of manually specifying num_parents. This makes adding/removing entries to/from parent_data easy and errorproof.
Stable-dep-of: 783cb693828c ("clk: qcom: gcc-sm8250: Fix gcc_sdcc2_apps_clk_src")
--- drivers/clk/qcom/gcc-sm8250.c | 92 +++++++++++++++++------------------ 1 file changed, 46 insertions(+), 46 deletions(-)
drivers/clk/qcom/gcc-sm8250.c +46 -46
@@ -200,7 +200,7 @@ static struct clk_rcg2 gcc_cpuss_ahb_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_cpuss_ahb_clk_src" , .parent_data = gcc_parent_data_0_ao, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0_ao), .flags =CLK_SET_RATE_PARENT , .ops = &clk_rcg2_ops, },
@@ -224,7 +224,7 @@ static struct clk_rcg2 gcc_gp1_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_gp1_clk_src" , .parent_data = gcc_parent_data_1, - .num_parents =4 , + .num_parents =ARRAY_SIZE (gcc_parent_data_1), .ops = &clk_rcg2_ops, }, };
@@ -238,7 +238,7 @@ static struct clk_rcg2 gcc_gp2_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_gp2_clk_src" , .parent_data = gcc_parent_data_1, - .num_parents =4 , + .num_parents =ARRAY_SIZE (gcc_parent_data_1), .ops = &clk_rcg2_ops, }, };
@@ -252,7 +252,7 @@ static struct clk_rcg2 gcc_gp3_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_gp3_clk_src" , .parent_data = gcc_parent_data_1, - .num_parents =4 , + .num_parents =ARRAY_SIZE (gcc_parent_data_1), .ops = &clk_rcg2_ops, }, };
@@ -272,7 +272,7 @@ static struct clk_rcg2 gcc_pcie_0_aux_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_pcie_0_aux_clk_src" , .parent_data = gcc_parent_data_2, - .num_parents =2 , + .num_parents =ARRAY_SIZE (gcc_parent_data_2), .ops = &clk_rcg2_ops, }, };
@@ -286,7 +286,7 @@ static struct clk_rcg2 gcc_pcie_1_aux_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_pcie_1_aux_clk_src" , .parent_data = gcc_parent_data_2, - .num_parents =2 , + .num_parents =ARRAY_SIZE (gcc_parent_data_2), .ops = &clk_rcg2_ops, }, };
@@ -300,7 +300,7 @@ static struct clk_rcg2 gcc_pcie_2_aux_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_pcie_2_aux_clk_src" , .parent_data = gcc_parent_data_2, - .num_parents =2 , + .num_parents =ARRAY_SIZE (gcc_parent_data_2), .ops = &clk_rcg2_ops, }, };
@@ -320,7 +320,7 @@ static struct clk_rcg2 gcc_pcie_phy_refgen_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_pcie_phy_refgen_clk_src" , .parent_data = gcc_parent_data_0_ao, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0_ao), .ops = &clk_rcg2_ops, }, };
@@ -341,7 +341,7 @@ static struct clk_rcg2 gcc_pdm2_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_pdm2_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, }, };
@@ -369,7 +369,7 @@ static const struct freq_tbl ftbl_gcc_qupv3_wrap0_s0_clk_src[] = {static struct clk_init_data gcc_qupv3_wrap0_s0_clk_src_init = { .name ="gcc_qupv3_wrap0_s0_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -385,7 +385,7 @@ static struct clk_rcg2 gcc_qupv3_wrap0_s0_clk_src = {static struct clk_init_data gcc_qupv3_wrap0_s1_clk_src_init = { .name ="gcc_qupv3_wrap0_s1_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -417,7 +417,7 @@ static const struct freq_tbl ftbl_gcc_qupv3_wrap0_s2_clk_src[] = {static struct clk_init_data gcc_qupv3_wrap0_s2_clk_src_init = { .name ="gcc_qupv3_wrap0_s2_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -433,7 +433,7 @@ static struct clk_rcg2 gcc_qupv3_wrap0_s2_clk_src = {static struct clk_init_data gcc_qupv3_wrap0_s3_clk_src_init = { .name ="gcc_qupv3_wrap0_s3_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -449,7 +449,7 @@ static struct clk_rcg2 gcc_qupv3_wrap0_s3_clk_src = {static struct clk_init_data gcc_qupv3_wrap0_s4_clk_src_init = { .name ="gcc_qupv3_wrap0_s4_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -465,7 +465,7 @@ static struct clk_rcg2 gcc_qupv3_wrap0_s4_clk_src = {static struct clk_init_data gcc_qupv3_wrap0_s5_clk_src_init = { .name ="gcc_qupv3_wrap0_s5_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -481,7 +481,7 @@ static struct clk_rcg2 gcc_qupv3_wrap0_s5_clk_src = {static struct clk_init_data gcc_qupv3_wrap0_s6_clk_src_init = { .name ="gcc_qupv3_wrap0_s6_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -497,7 +497,7 @@ static struct clk_rcg2 gcc_qupv3_wrap0_s6_clk_src = {static struct clk_init_data gcc_qupv3_wrap0_s7_clk_src_init = { .name ="gcc_qupv3_wrap0_s7_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -513,7 +513,7 @@ static struct clk_rcg2 gcc_qupv3_wrap0_s7_clk_src = {static struct clk_init_data gcc_qupv3_wrap1_s0_clk_src_init = { .name ="gcc_qupv3_wrap1_s0_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -529,7 +529,7 @@ static struct clk_rcg2 gcc_qupv3_wrap1_s0_clk_src = {static struct clk_init_data gcc_qupv3_wrap1_s1_clk_src_init = { .name ="gcc_qupv3_wrap1_s1_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -545,7 +545,7 @@ static struct clk_rcg2 gcc_qupv3_wrap1_s1_clk_src = {static struct clk_init_data gcc_qupv3_wrap1_s2_clk_src_init = { .name ="gcc_qupv3_wrap1_s2_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -561,7 +561,7 @@ static struct clk_rcg2 gcc_qupv3_wrap1_s2_clk_src = {static struct clk_init_data gcc_qupv3_wrap1_s3_clk_src_init = { .name ="gcc_qupv3_wrap1_s3_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -577,7 +577,7 @@ static struct clk_rcg2 gcc_qupv3_wrap1_s3_clk_src = {static struct clk_init_data gcc_qupv3_wrap1_s4_clk_src_init = { .name ="gcc_qupv3_wrap1_s4_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -593,7 +593,7 @@ static struct clk_rcg2 gcc_qupv3_wrap1_s4_clk_src = {static struct clk_init_data gcc_qupv3_wrap1_s5_clk_src_init = { .name ="gcc_qupv3_wrap1_s5_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -609,7 +609,7 @@ static struct clk_rcg2 gcc_qupv3_wrap1_s5_clk_src = {static struct clk_init_data gcc_qupv3_wrap2_s0_clk_src_init = { .name ="gcc_qupv3_wrap2_s0_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -625,7 +625,7 @@ static struct clk_rcg2 gcc_qupv3_wrap2_s0_clk_src = {static struct clk_init_data gcc_qupv3_wrap2_s1_clk_src_init = { .name ="gcc_qupv3_wrap2_s1_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -641,7 +641,7 @@ static struct clk_rcg2 gcc_qupv3_wrap2_s1_clk_src = {static struct clk_init_data gcc_qupv3_wrap2_s2_clk_src_init = { .name ="gcc_qupv3_wrap2_s2_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -657,7 +657,7 @@ static struct clk_rcg2 gcc_qupv3_wrap2_s2_clk_src = {static struct clk_init_data gcc_qupv3_wrap2_s3_clk_src_init = { .name ="gcc_qupv3_wrap2_s3_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -673,7 +673,7 @@ static struct clk_rcg2 gcc_qupv3_wrap2_s3_clk_src = {static struct clk_init_data gcc_qupv3_wrap2_s4_clk_src_init = { .name ="gcc_qupv3_wrap2_s4_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -689,7 +689,7 @@ static struct clk_rcg2 gcc_qupv3_wrap2_s4_clk_src = {static struct clk_init_data gcc_qupv3_wrap2_s5_clk_src_init = { .name ="gcc_qupv3_wrap2_s5_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, };
@@ -721,7 +721,7 @@ static struct clk_rcg2 gcc_sdcc2_apps_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_sdcc2_apps_clk_src" , .parent_data = gcc_parent_data_4, - .num_parents =5 , + .num_parents =ARRAY_SIZE (gcc_parent_data_4), .ops = &clk_rcg2_floor_ops, }, };
@@ -744,7 +744,7 @@ static struct clk_rcg2 gcc_sdcc4_apps_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_sdcc4_apps_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_floor_ops, }, };
@@ -763,7 +763,7 @@ static struct clk_rcg2 gcc_tsif_ref_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_tsif_ref_clk_src" , .parent_data = gcc_parent_data_5, - .num_parents =4 , + .num_parents =ARRAY_SIZE (gcc_parent_data_5), .ops = &clk_rcg2_ops, }, };
@@ -785,7 +785,7 @@ static struct clk_rcg2 gcc_ufs_card_axi_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_ufs_card_axi_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, }, };
@@ -807,7 +807,7 @@ static struct clk_rcg2 gcc_ufs_card_ice_core_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_ufs_card_ice_core_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, }, };
@@ -826,7 +826,7 @@ static struct clk_rcg2 gcc_ufs_card_phy_aux_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_ufs_card_phy_aux_clk_src" , .parent_data = gcc_parent_data_3, - .num_parents =1 , + .num_parents =ARRAY_SIZE (gcc_parent_data_3), .ops = &clk_rcg2_ops, }, };
@@ -847,7 +847,7 @@ static struct clk_rcg2 gcc_ufs_card_unipro_core_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_ufs_card_unipro_core_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, }, };
@@ -870,7 +870,7 @@ static struct clk_rcg2 gcc_ufs_phy_axi_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_ufs_phy_axi_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, }, };
@@ -884,7 +884,7 @@ static struct clk_rcg2 gcc_ufs_phy_ice_core_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_ufs_phy_ice_core_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, }, };
@@ -898,7 +898,7 @@ static struct clk_rcg2 gcc_ufs_phy_phy_aux_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_ufs_phy_phy_aux_clk_src" , .parent_data = gcc_parent_data_3, - .num_parents =1 , + .num_parents =ARRAY_SIZE (gcc_parent_data_3), .ops = &clk_rcg2_ops, }, };
@@ -912,7 +912,7 @@ static struct clk_rcg2 gcc_ufs_phy_unipro_core_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_ufs_phy_unipro_core_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, }, };
@@ -935,7 +935,7 @@ static struct clk_rcg2 gcc_usb30_prim_master_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_usb30_prim_master_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, }, };
@@ -949,7 +949,7 @@ static struct clk_rcg2 gcc_usb30_prim_mock_utmi_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_usb30_prim_mock_utmi_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, }, };
@@ -963,7 +963,7 @@ static struct clk_rcg2 gcc_usb30_sec_master_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_usb30_sec_master_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, }, };
@@ -977,7 +977,7 @@ static struct clk_rcg2 gcc_usb30_sec_mock_utmi_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_usb30_sec_mock_utmi_clk_src" , .parent_data = gcc_parent_data_0, - .num_parents =3 , + .num_parents =ARRAY_SIZE (gcc_parent_data_0), .ops = &clk_rcg2_ops, }, };
@@ -991,7 +991,7 @@ static struct clk_rcg2 gcc_usb3_prim_phy_aux_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_usb3_prim_phy_aux_clk_src" , .parent_data = gcc_parent_data_2, - .num_parents =2 , + .num_parents =ARRAY_SIZE (gcc_parent_data_2), .ops = &clk_rcg2_ops, }, };
@@ -1005,7 +1005,7 @@ static struct clk_rcg2 gcc_usb3_sec_phy_aux_clk_src = { .clkr.hw.init = &(struct clk_init_data){ .name ="gcc_usb3_sec_phy_aux_clk_src" , .parent_data = gcc_parent_data_2, - .num_parents =2 , + .num_parents =ARRAY_SIZE (gcc_parent_data_2), .ops = &clk_rcg2_ops, }, };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 177/406 clk: qcom: gcc-sm8250: Fix gcc_sdcc2_apps_clk_src
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Patrick Whewell <[email protected]>
[ Upstream commit 783cb693828ce487cf0bc6ad16cbcf2caae6f8d9 ]
GPLL9 is not on by default, which causes a "gcc_sdcc2_apps_clk_src: rcg didn't update its configuration" error when booting. Set .flags = CLK_OPS_PARENT_ENABLE to fix the error.
--- drivers/clk/qcom/gcc-sm8250.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/qcom/gcc-sm8250.c +1 -0
@@ -722,6 +722,7 @@ static struct clk_rcg2 gcc_sdcc2_apps_clk_src = { .name = "gcc_sdcc2_apps_clk_src", .parent_data = gcc_parent_data_4, .num_parents = ARRAY_SIZE(gcc_parent_data_4), + .flags = CLK_OPS_PARENT_ENABLE, .ops = &clk_rcg2_floor_ops, }, };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 178/406 clk: qcom: reset: Use the correct type of sleep/delay based on length
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 181b66ee7cdd824797fc99b53bec29cf5630a04f ]
Use the fsleep() helper that (based on the length of the delay, see: [1]) chooses the correct sleep/delay functions.
[1] https://www.kernel.org/doc/Documentation/timers/timers-howto.txt
--- drivers/clk/qcom/reset.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/qcom/reset.c +2 -1
@@ -16,7 +16,8 @@ static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id)struct qcom_reset_controller *rst =to_qcom_reset_controller (rcdev); rcdev->ops->assert (rcdev, id); -udelay (rst->reset_map[id].udelay ?:1 );/* use 1 us as default */ +fsleep (rst->reset_map[id].udelay ?:1 );/* use 1 us as default */ + rcdev->ops->deassert (rcdev, id);return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 179/406 PCI: Mark NVIDIA T4 GPUs to avoid bus reset
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wu Zongyong <[email protected]>
[ Upstream commit d5af729dc2071273f14cbb94abbc60608142fd83 ]
NVIDIA T4 GPUs do not work with SBR. This problem is found when the T4 card is direct attached to a Root Port only. Avoid bus reset by marking T4 GPUs PCI_DEV_FLAGS_NO_BUS_RESET.
--- drivers/pci/quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/quirks.c +1 -1
@@ -3578,7 +3578,7 @@ static void quirk_no_bus_reset(struct pci_dev *dev)*/ static void quirk_nvidia_no_bus_reset (struct pci_dev *dev) { -if ((dev->device &0xffc0 ) ==0x2340 ) +if ((dev->device &0xffc0 ) ==0x2340 || dev->device ==0x1eb8 )quirk_no_bus_reset (dev); } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 180/406 pinctrl: mcp23s08: check return value of devm_kasprintf()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
[ Upstream commit f941714a7c7698eadb59bc27d34d6d6f38982705 ]
devm_kasprintf() returns a pointer to dynamically allocated memory. Pointer could be NULL in case allocation fails. Check pointer validity. Identified with coccinelle (kmerr.cocci script).
--- drivers/pinctrl/pinctrl-mcp23s08_spi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/pinctrl/pinctrl-mcp23s08_spi.c +10 -0
@@ -91,18 +91,28 @@ static int mcp23s08_spi_regmap_init(struct mcp23s08 *mcp, struct device *dev, mcp->reg_shift =0 ; mcp->chip.ngpio =8 ; mcp->chip.label =devm_kasprintf (dev,GFP_KERNEL ,"mcp23s08.%d" , addr); +if (!mcp->chip.label) +return -ENOMEM ; config = &mcp23x08_regmap; name =devm_kasprintf (dev,GFP_KERNEL ,"%d" , addr); +if (!name) +return -ENOMEM ; +break ;case MCP_TYPE_S17 : mcp->reg_shift =1 ; mcp->chip.ngpio =16 ; mcp->chip.label =devm_kasprintf (dev,GFP_KERNEL ,"mcp23s17.%d" , addr); +if (!mcp->chip.label) +return -ENOMEM ; config = &mcp23x17_regmap; name =devm_kasprintf (dev,GFP_KERNEL ,"%d" , addr); +if (!name) +return -ENOMEM ; +break ;case MCP_TYPE_S18 :
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 181/406 PCI: pciehp: Use RMW accessors for changing LNKCTL
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilpo Järvinen <[email protected]>
[ Upstream commit 5f75f96c61039151c193775d776fde42477eace1 ]
As hotplug is not the only driver touching LNKCTL, use the RMW capability accessor which handles concurrent changes correctly.
--- drivers/pci/hotplug/pciehp_hpc.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/pci/hotplug/pciehp_hpc.c +3 -9
@@ -332,17 +332,11 @@ int pciehp_check_link_status(struct controller *ctrl)static int __pciehp_link_set (struct controller *ctrl,bool enable) {struct pci_dev *pdev =ctrl_dev (ctrl); -u16 lnk_ctrl; -pcie_capability_read_word (pdev,PCI_EXP_LNKCTL , &lnk_ctrl); +pcie_capability_clear_and_set_word (pdev,PCI_EXP_LNKCTL , +PCI_EXP_LNKCTL_LD , + enable ?0 :PCI_EXP_LNKCTL_LD ); -if (enable) - lnk_ctrl &= ~PCI_EXP_LNKCTL_LD ; -else - lnk_ctrl |=PCI_EXP_LNKCTL_LD ; - -pcie_capability_write_word (pdev,PCI_EXP_LNKCTL , lnk_ctrl); -ctrl_dbg (ctrl,"%s: lnk_ctrl = %x\n" , __func__, lnk_ctrl);return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 182/406 PCI/ASPM: Use RMW accessors for changing LNKCTL
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilpo Järvinen <[email protected]>
[ Upstream commit e09060b3b6b4661278ff8e1b7b81a37d5ea86eae ]
Don't assume that the device is fully under the control of ASPM and use RMW capability accessors which do proper locking to avoid losing concurrent updates to the register values.
If configuration fails in pcie_aspm_configure_common_clock(), the function attempts to restore the old PCI_EXP_LNKCTL_CCC settings. Store only the old PCI_EXP_LNKCTL_CCC bit for the relevant devices rather than the content of the whole LNKCTL registers. It aligns better with how pcie_lnkctl_clear_and_set() expects its parameter and makes the code more obvious to understand.
--- drivers/pci/pcie/aspm.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)
drivers/pci/pcie/aspm.c +13 -17
@@ -249,7 +249,7 @@ static int pcie_retrain_link(struct pcie_link_state *link)static void pcie_aspm_configure_common_clock (struct pcie_link_state *link) {int same_clock =1 ; -u16 reg16, parent_reg, child_reg[8 ]; +u16 reg16, ccc, parent_old_ccc, child_old_ccc[8 ];struct pci_dev *child, *parent = link->pdev;struct pci_bus *linkbus = parent->subordinate;/*
@@ -271,6 +271,7 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link)/* Port might be already in common clock mode */ pcie_capability_read_word (parent,PCI_EXP_LNKCTL , ®16); + parent_old_ccc = reg16 &PCI_EXP_LNKCTL_CCC ;if (same_clock && (reg16 &PCI_EXP_LNKCTL_CCC )) {bool consistent = true;
@@ -287,34 +288,29 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link)pci_info (parent,"ASPM: current common clock configuration is inconsistent, reconfiguring\n" ); } + ccc = same_clock ?PCI_EXP_LNKCTL_CCC :0 ;/* Configure downstream component, all functions */ list_for_each_entry (child, &linkbus->devices, bus_list) {pcie_capability_read_word (child,PCI_EXP_LNKCTL , ®16); - child_reg[PCI_FUNC (child->devfn)] = reg16; -if (same_clock) - reg16 |=PCI_EXP_LNKCTL_CCC ; -else - reg16 &= ~PCI_EXP_LNKCTL_CCC ; -pcie_capability_write_word (child,PCI_EXP_LNKCTL , reg16); + child_old_ccc[PCI_FUNC (child->devfn)] = reg16 &PCI_EXP_LNKCTL_CCC ; +pcie_capability_clear_and_set_word (child,PCI_EXP_LNKCTL , +PCI_EXP_LNKCTL_CCC , ccc); }/* Configure upstream component */ -pcie_capability_read_word (parent,PCI_EXP_LNKCTL , ®16); - parent_reg = reg16; -if (same_clock) - reg16 |=PCI_EXP_LNKCTL_CCC ; -else - reg16 &= ~PCI_EXP_LNKCTL_CCC ; -pcie_capability_write_word (parent,PCI_EXP_LNKCTL , reg16); +pcie_capability_clear_and_set_word (parent,PCI_EXP_LNKCTL , +PCI_EXP_LNKCTL_CCC , ccc);if (pcie_retrain_link (link)) {/* Training failed. Restore common clock configurations */ pci_err (parent,"ASPM: Could not configure common clock\n" );list_for_each_entry (child, &linkbus->devices, bus_list) -pcie_capability_write_word (child,PCI_EXP_LNKCTL , - child_reg[PCI_FUNC (child->devfn)]); -pcie_capability_write_word (parent,PCI_EXP_LNKCTL , parent_reg); +pcie_capability_clear_and_set_word (child,PCI_EXP_LNKCTL , +PCI_EXP_LNKCTL_CCC , + child_old_ccc[PCI_FUNC (child->devfn)]); +pcie_capability_clear_and_set_word (parent,PCI_EXP_LNKCTL , +PCI_EXP_LNKCTL_CCC , parent_old_ccc); } }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 183/406 clk: imx8mp: fix sai4 clock
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Felsch <[email protected]>
[ Upstream commit c30f600f1f41dcf5ef0fb02e9a201f9b2e8f31bd ]
The reference manual don't mention a SAI4 hardware block. This would be clock slice 78 which is skipped (TRM, page 237). Remove any reference to this clock to align the driver with the reality.
--- drivers/clk/imx/clk-imx8mp.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/clk/imx/clk-imx8mp.c +0 -5
@@ -181,10 +181,6 @@ static const char * const imx8mp_sai3_sels[] = {"osc_24m", "audio_pll1_out", "au"video_pll1_out" ,"sys_pll1_133m" ,"osc_hdmi" , "clk_ext3", "clk_ext4", }; -static const char *const imx8mp_sai4_sels[] = {"osc_24m" ,"audio_pll1_out" ,"audio_pll2_out" , -"video_pll1_out" ,"sys_pll1_133m" ,"osc_hdmi" , -"clk_ext1" ,"clk_ext2" , }; -static const char *const imx8mp_sai5_sels[] = {"osc_24m" ,"audio_pll1_out" ,"audio_pll2_out" ,"video_pll1_out" ,"sys_pll1_133m" ,"osc_hdmi" ,"clk_ext2" ,"clk_ext3" , };
@@ -596,7 +592,6 @@ static int imx8mp_clocks_probe(struct platform_device *pdev) hws[IMX8MP_CLK_SAI1 ] =imx8m_clk_hw_composite ("sai1" , imx8mp_sai1_sels, ccm_base +0xa580 ); hws[IMX8MP_CLK_SAI2 ] =imx8m_clk_hw_composite ("sai2" , imx8mp_sai2_sels, ccm_base +0xa600 ); hws[IMX8MP_CLK_SAI3 ] =imx8m_clk_hw_composite ("sai3" , imx8mp_sai3_sels, ccm_base +0xa680 ); - hws[IMX8MP_CLK_SAI4 ] =imx8m_clk_hw_composite ("sai4" , imx8mp_sai4_sels, ccm_base +0xa700 ); hws[IMX8MP_CLK_SAI5 ] =imx8m_clk_hw_composite ("sai5" , imx8mp_sai5_sels, ccm_base +0xa780 ); hws[IMX8MP_CLK_SAI6 ] =imx8m_clk_hw_composite ("sai6" , imx8mp_sai6_sels, ccm_base +0xa800 ); hws[IMX8MP_CLK_ENET_QOS ] =imx8m_clk_hw_composite ("enet_qos" , imx8mp_enet_qos_sels, ccm_base +0xa880 );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 184/406 clk: imx: composite-8m: fix clock pauses when set_rate would be a no-op
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahmad Fatoum <[email protected]>
[ Upstream commit 4dd432d985ef258e3bc436e568fba4b987b59171 ]
Reconfiguring the clock divider to the exact same value is observed on an i.MX8MN to often cause a longer than usual clock pause, probably because the divider restarts counting whenever the register is rewritten.
This issue doesn't show up normally, because the clock framework will take care to not call set_rate when the clock rate is the same. However, when we reconfigure an upstream clock, the common code will call set_rate with the newly calculated rate on all children, e.g.:
- sai5 is running normally and divides Audio PLL out by 16.
- Audio PLL rate is increased by 32Hz (glitch-free kdiv change)
- rates for children are recalculated and rates are set recursively
- imx8m_clk_composite_divider_set_rate(sai5) is called with
32/16 = 2Hz more
- imx8m_clk_composite_divider_set_rate computes same divider as before
- divider register is written, so it restarts counting from zero and MCLK is briefly paused, so instead of e.g. 40ns, MCLK is low for 120ns.
Some external clock consumers can be upset by such unexpected clock pauses, so let's make sure we only rewrite the divider value when the value to be written is actually different.
--- drivers/clk/imx/clk-composite-8m.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/clk/imx/clk-composite-8m.c +7 -5
@@ -97,7 +97,7 @@ static int imx8m_clk_composite_divider_set_rate(struct clk_hw *hw,int prediv_value;int div_value;int ret; -u32 val; +u32 orig, val; ret =imx8m_clk_composite_compute_dividers (rate, parent_rate, &prediv_value, &div_value);
@@ -106,13 +106,15 @@ static int imx8m_clk_composite_divider_set_rate(struct clk_hw *hw,spin_lock_irqsave (divider->lock, flags); - val =readl (divider->reg); - val &= ~((clk_div_mask (divider->width) << divider->shift) | - (clk_div_mask (PCG_DIV_WIDTH ) <<PCG_DIV_SHIFT )); + orig =readl (divider->reg); + val = orig & ~((clk_div_mask (divider->width) << divider->shift) | + (clk_div_mask (PCG_DIV_WIDTH ) <<PCG_DIV_SHIFT )); val |= (u32)(prediv_value -1 ) << divider->shift; val |= (u32)(div_value -1 ) <<PCG_DIV_SHIFT ; -writel (val, divider->reg); + +if (val != orig) +writel (val, divider->reg);spin_unlock_irqrestore (divider->lock, flags);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 185/406 vfio/type1: fix cap_migration information leak
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Hajnoczi <[email protected]>
[ Upstream commit cd24e2a60af633f157d7e59c0a6dba64f131c0b1 ]
Fix an information leak where an uninitialized hole in struct vfio_iommu_type1_info_cap_migration on the stack is exposed to userspace.
The definition of struct vfio_iommu_type1_info_cap_migration contains a hole as shown in this pahole(1) output:
struct vfio_iommu_type1_info_cap_migration {
struct vfio_info_cap_header header; /* 0 8 */
__u32 flags; /* 8 4 */ /* XXX 4 bytes hole, try to pack */
__u64 pgsize_bitmap; /* 16 8 */
__u64 max_dirty_bitmap_size; /* 24 8 */
/* size: 32, cachelines: 1, members: 4 */
/* sum members: 28, holes: 1, sum holes: 4 */
/* last cacheline: 32 bytes */};
The cap_mig variable is filled in without initializing the hole:
static int vfio_iommu_migration_build_caps(struct vfio_iommu *iommu,
struct vfio_info_cap *caps)
{
struct vfio_iommu_type1_info_cap_migration cap_mig;
cap_mig.header.id = VFIO_IOMMU_TYPE1_INFO_CAP_MIGRATION;
cap_mig.header.version = 1;
cap_mig.flags = 0;
/* support minimum pgsize */
cap_mig.pgsize_bitmap = (size_t)1 << __ffs(iommu->pgsize_bitmap);
cap_mig.max_dirty_bitmap_size = DIRTY_BITMAP_SIZE_MAX;
return vfio_info_add_capability(caps, &cap_mig.header, sizeof(cap_mig));}
The structure is then copied to a temporary location on the heap. At this point it's already too late and ioctl(VFIO_IOMMU_GET_INFO) copies it to userspace later:
int vfio_info_add_capability(struct vfio_info_cap *caps,
struct vfio_info_cap_header *cap, size_t size)
{
struct vfio_info_cap_header *header;
header = vfio_info_cap_add(caps, size, cap->id, cap->version);
if (IS_ERR(header))
return PTR_ERR(header);
memcpy(header + 1, cap + 1, size - sizeof(*header));
return 0;}
This issue was found by code inspection.
--- drivers/vfio/vfio_iommu_type1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vfio/vfio_iommu_type1.c +1 -1
@@ -2659,7 +2659,7 @@ static int vfio_iommu_iova_build_caps(struct vfio_iommu *iommu,static int vfio_iommu_migration_build_caps (struct vfio_iommu *iommu,struct vfio_info_cap *caps) { -struct vfio_iommu_type1_info_cap_migration cap_mig; +struct vfio_iommu_type1_info_cap_migration cap_mig = {}; cap_mig.header.id =VFIO_IOMMU_TYPE1_INFO_CAP_MIGRATION ; cap_mig.header.version =1 ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 186/406 powerpc/fadump: reset dump area size if fadump memory reserve fails
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sourabh Jain <[email protected]>
[ Upstream commit d1eb75e0dfed80d2d85b664e28a39f65b290ab55 ]
In case fadump_reserve_mem() fails to reserve memory, the reserve_dump_area_size variable will retain the reserve area size. This will lead to /sys/kernel/fadump/mem_reserved node displaying an incorrect memory reserved by fadump.
To fix this problem, reserve dump area size variable is set to 0 if fadump failed to reserve memory.
--- arch/powerpc/kernel/fadump.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/kernel/fadump.c +1 -0
@@ -642,6 +642,7 @@ int __init fadump_reserve_mem(void)return ret; error_out: fw_dump.fadump_enabled =0 ; + fw_dump.reserve_dump_area_size =0 ;return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 187/406 powerpc/perf: Convert fsl_emb notifier to state machine callbacks
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
[ Upstream commit 34daf445f82bd3a4df852bb5f1dffd792ac830a0 ]
CC arch/powerpc/perf/core-fsl-emb.oarch/powerpc/perf/core-fsl-emb.c:675:6: error: no previous prototype for 'hw_perf_event_setup' [-Werror=missing-prototypes]
675 | void hw_perf_event_setup(int cpu)
| ^~~~~~~~~~~~~~~~~~~
Looks like fsl_emb was completely missed by commit 3f6da3905398 ("perf:
Rework and fix the arch CPU-hotplug hooks")
So, apply same changes as commit 3f6da3905398 ("perf: Rework and fix the arch CPU-hotplug hooks") then commit 57ecde42cc74 ("powerpc/perf:
Convert book3s notifier to state machine callbacks")
While at it, also fix following error:
arch/powerpc/perf/core-fsl-emb.c: In function 'perf_event_interrupt':arch/powerpc/perf/core-fsl-emb.c:648:13: error: variable 'found' set but not used [-Werror=unused-but-set-variable]
648 | int found = 0;
| ^~~~~--- arch/powerpc/perf/core-fsl-emb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/powerpc/perf/core-fsl-emb.c +5 -3
@@ -645,7 +645,6 @@ static void perf_event_interrupt(struct pt_regs *regs)struct cpu_hw_events *cpuhw =this_cpu_ptr (&cpu_hw_events);struct perf_event *event;unsigned long val; -int found =0 ;for (i =0 ; i < ppmu->n_counter; ++i) { event = cpuhw->event[i];
@@ -654,7 +653,6 @@ static void perf_event_interrupt(struct pt_regs *regs)if ((int )val <0 ) {if (event) {/* event has overflowed */ - found =1 ;record_and_restart (event, val, regs); }else {/*
@@ -672,11 +670,13 @@ static void perf_event_interrupt(struct pt_regs *regs)isync (); } -void hw_perf_event_setup (int cpu) +static int fsl_emb_pmu_prepare_cpu (unsigned int cpu) {struct cpu_hw_events *cpuhw = &per_cpu (cpu_hw_events, cpu);memset (cpuhw,0 ,sizeof (*cpuhw)); + +return 0 ; }int register_fsl_emb_pmu (struct fsl_emb_pmu *pmu)
@@ -689,6 +689,8 @@ int register_fsl_emb_pmu(struct fsl_emb_pmu *pmu) pmu->name);perf_pmu_register (&fsl_emb_pmu,"cpu" ,PERF_TYPE_RAW ); +cpuhp_setup_state (CPUHP_PERF_POWER ,"perf/powerpc:prepare" , + fsl_emb_pmu_prepare_cpu,NULL );return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 188/406 drm/amdgpu: Use RMW accessors for changing LNKCTL
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilpo Järvinen <[email protected]>
[ Upstream commit ce7d88110b9ed5f33fe79ea6d4ed049fb0e57bce ]
Don't assume that only the driver would be accessing LNKCTL. ASPM policy changes can trigger write to LNKCTL outside of driver's control. And in the case of upstream bridge, the driver does not even own the device it's changing the registers for.
Use RMW capability accessors which do proper locking to avoid losing concurrent updates to the register value.
--- drivers/gpu/drm/amd/amdgpu/cik.c | 36 +++++++++----------------------- drivers/gpu/drm/amd/amdgpu/si.c | 36 +++++++++----------------------- 2 files changed, 20 insertions(+), 52 deletions(-)
drivers/gpu/drm/amd/amdgpu/cik.c +10 -26
@@ -1509,17 +1509,8 @@ static void cik_pcie_gen3_enable(struct amdgpu_device *adev)u16 bridge_cfg2, gpu_cfg2;u32 max_lw, current_lw, tmp; -pcie_capability_read_word (root,PCI_EXP_LNKCTL , - &bridge_cfg); -pcie_capability_read_word (adev->pdev,PCI_EXP_LNKCTL , - &gpu_cfg); - - tmp16 = bridge_cfg |PCI_EXP_LNKCTL_HAWD ; -pcie_capability_write_word (root,PCI_EXP_LNKCTL , tmp16); - - tmp16 = gpu_cfg |PCI_EXP_LNKCTL_HAWD ; -pcie_capability_write_word (adev->pdev,PCI_EXP_LNKCTL , - tmp16); +pcie_capability_set_word (root,PCI_EXP_LNKCTL ,PCI_EXP_LNKCTL_HAWD ); +pcie_capability_set_word (adev->pdev,PCI_EXP_LNKCTL ,PCI_EXP_LNKCTL_HAWD ); tmp =RREG32_PCIE (ixPCIE_LC_STATUS1); max_lw = (tmp & PCIE_LC_STATUS1__LC_DETECTED_LINK_WIDTH_MASK) >>
@@ -1572,21 +1563,14 @@ static void cik_pcie_gen3_enable(struct amdgpu_device *adev)msleep (100 );/* linkctl */ -pcie_capability_read_word (root,PCI_EXP_LNKCTL , - &tmp16); - tmp16 &= ~PCI_EXP_LNKCTL_HAWD ; - tmp16 |= (bridge_cfg &PCI_EXP_LNKCTL_HAWD ); -pcie_capability_write_word (root,PCI_EXP_LNKCTL , - tmp16); - -pcie_capability_read_word (adev->pdev, -PCI_EXP_LNKCTL , - &tmp16); - tmp16 &= ~PCI_EXP_LNKCTL_HAWD ; - tmp16 |= (gpu_cfg &PCI_EXP_LNKCTL_HAWD ); -pcie_capability_write_word (adev->pdev, -PCI_EXP_LNKCTL , - tmp16); +pcie_capability_clear_and_set_word (root,PCI_EXP_LNKCTL , +PCI_EXP_LNKCTL_HAWD , + bridge_cfg & +PCI_EXP_LNKCTL_HAWD ); +pcie_capability_clear_and_set_word (adev->pdev,PCI_EXP_LNKCTL , +PCI_EXP_LNKCTL_HAWD , + gpu_cfg & +PCI_EXP_LNKCTL_HAWD );/* linkctl2 */ pcie_capability_read_word(root, PCI_EXP_LNKCTL2,
drivers/gpu/drm/amd/amdgpu/si.c +10 -26
@@ -2159,17 +2159,8 @@ static void si_pcie_gen3_enable(struct amdgpu_device *adev)u16 bridge_cfg2, gpu_cfg2;u32 max_lw, current_lw, tmp; -pcie_capability_read_word (root,PCI_EXP_LNKCTL , - &bridge_cfg); -pcie_capability_read_word (adev->pdev,PCI_EXP_LNKCTL , - &gpu_cfg); - - tmp16 = bridge_cfg |PCI_EXP_LNKCTL_HAWD ; -pcie_capability_write_word (root,PCI_EXP_LNKCTL , tmp16); - - tmp16 = gpu_cfg |PCI_EXP_LNKCTL_HAWD ; -pcie_capability_write_word (adev->pdev,PCI_EXP_LNKCTL , - tmp16); +pcie_capability_set_word (root,PCI_EXP_LNKCTL ,PCI_EXP_LNKCTL_HAWD ); +pcie_capability_set_word (adev->pdev,PCI_EXP_LNKCTL ,PCI_EXP_LNKCTL_HAWD ); tmp =RREG32_PCIE (PCIE_LC_STATUS1 ); max_lw = (tmp &LC_DETECTED_LINK_WIDTH_MASK ) >>LC_DETECTED_LINK_WIDTH_SHIFT ;
@@ -2214,21 +2205,14 @@ static void si_pcie_gen3_enable(struct amdgpu_device *adev)mdelay (100 ); -pcie_capability_read_word (root,PCI_EXP_LNKCTL , - &tmp16); - tmp16 &= ~PCI_EXP_LNKCTL_HAWD ; - tmp16 |= (bridge_cfg &PCI_EXP_LNKCTL_HAWD ); -pcie_capability_write_word (root,PCI_EXP_LNKCTL , - tmp16); - -pcie_capability_read_word (adev->pdev, -PCI_EXP_LNKCTL , - &tmp16); - tmp16 &= ~PCI_EXP_LNKCTL_HAWD ; - tmp16 |= (gpu_cfg &PCI_EXP_LNKCTL_HAWD ); -pcie_capability_write_word (adev->pdev, -PCI_EXP_LNKCTL , - tmp16); +pcie_capability_clear_and_set_word (root,PCI_EXP_LNKCTL , +PCI_EXP_LNKCTL_HAWD , + bridge_cfg & +PCI_EXP_LNKCTL_HAWD ); +pcie_capability_clear_and_set_word (adev->pdev,PCI_EXP_LNKCTL , +PCI_EXP_LNKCTL_HAWD , + gpu_cfg & +PCI_EXP_LNKCTL_HAWD );pcie_capability_read_word (root,PCI_EXP_LNKCTL2 , &tmp16);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 189/406 drm/radeon: Use RMW accessors for changing LNKCTL
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilpo Järvinen <[email protected]>
[ Upstream commit 7189576e8a829130192b33c5b64e8a475369c776 ]
Don't assume that only the driver would be accessing LNKCTL. ASPM policy changes can trigger write to LNKCTL outside of driver's control. And in the case of upstream bridge, the driver does not even own the device it's changing the registers for.
Use RMW capability accessors which do proper locking to avoid losing concurrent updates to the register value.
--- drivers/gpu/drm/radeon/cik.c | 36 ++++++++++------------------------- drivers/gpu/drm/radeon/si.c | 37 ++++++++++-------------------------- 2 files changed, 20 insertions(+), 53 deletions(-)
drivers/gpu/drm/radeon/cik.c +10 -26
@@ -9551,17 +9551,8 @@ static void cik_pcie_gen3_enable(struct radeon_device *rdev)u16 bridge_cfg2, gpu_cfg2;u32 max_lw, current_lw, tmp; -pcie_capability_read_word (root,PCI_EXP_LNKCTL , - &bridge_cfg); -pcie_capability_read_word (rdev->pdev,PCI_EXP_LNKCTL , - &gpu_cfg); - - tmp16 = bridge_cfg |PCI_EXP_LNKCTL_HAWD ; -pcie_capability_write_word (root,PCI_EXP_LNKCTL , tmp16); - - tmp16 = gpu_cfg |PCI_EXP_LNKCTL_HAWD ; -pcie_capability_write_word (rdev->pdev,PCI_EXP_LNKCTL , - tmp16); +pcie_capability_set_word (root,PCI_EXP_LNKCTL ,PCI_EXP_LNKCTL_HAWD ); +pcie_capability_set_word (rdev->pdev,PCI_EXP_LNKCTL ,PCI_EXP_LNKCTL_HAWD ); tmp =RREG32_PCIE_PORT (PCIE_LC_STATUS1 ); max_lw = (tmp &LC_DETECTED_LINK_WIDTH_MASK ) >>LC_DETECTED_LINK_WIDTH_SHIFT ;
@@ -9608,21 +9599,14 @@ static void cik_pcie_gen3_enable(struct radeon_device *rdev)msleep (100 );/* linkctl */ -pcie_capability_read_word (root,PCI_EXP_LNKCTL , - &tmp16); - tmp16 &= ~PCI_EXP_LNKCTL_HAWD ; - tmp16 |= (bridge_cfg &PCI_EXP_LNKCTL_HAWD ); -pcie_capability_write_word (root,PCI_EXP_LNKCTL , - tmp16); - -pcie_capability_read_word (rdev->pdev, -PCI_EXP_LNKCTL , - &tmp16); - tmp16 &= ~PCI_EXP_LNKCTL_HAWD ; - tmp16 |= (gpu_cfg &PCI_EXP_LNKCTL_HAWD ); -pcie_capability_write_word (rdev->pdev, -PCI_EXP_LNKCTL , - tmp16); +pcie_capability_clear_and_set_word (root,PCI_EXP_LNKCTL , +PCI_EXP_LNKCTL_HAWD , + bridge_cfg & +PCI_EXP_LNKCTL_HAWD ); +pcie_capability_clear_and_set_word (rdev->pdev,PCI_EXP_LNKCTL , +PCI_EXP_LNKCTL_HAWD , + gpu_cfg & +PCI_EXP_LNKCTL_HAWD );/* linkctl2 */ pcie_capability_read_word(root, PCI_EXP_LNKCTL2,
drivers/gpu/drm/radeon/si.c +10 -27
@@ -7138,17 +7138,8 @@ static void si_pcie_gen3_enable(struct radeon_device *rdev)u16 bridge_cfg2, gpu_cfg2;u32 max_lw, current_lw, tmp; -pcie_capability_read_word (root,PCI_EXP_LNKCTL , - &bridge_cfg); -pcie_capability_read_word (rdev->pdev,PCI_EXP_LNKCTL , - &gpu_cfg); - - tmp16 = bridge_cfg |PCI_EXP_LNKCTL_HAWD ; -pcie_capability_write_word (root,PCI_EXP_LNKCTL , tmp16); - - tmp16 = gpu_cfg |PCI_EXP_LNKCTL_HAWD ; -pcie_capability_write_word (rdev->pdev,PCI_EXP_LNKCTL , - tmp16); +pcie_capability_set_word (root,PCI_EXP_LNKCTL ,PCI_EXP_LNKCTL_HAWD ); +pcie_capability_set_word (rdev->pdev,PCI_EXP_LNKCTL ,PCI_EXP_LNKCTL_HAWD ); tmp =RREG32_PCIE (PCIE_LC_STATUS1 ); max_lw = (tmp &LC_DETECTED_LINK_WIDTH_MASK ) >>LC_DETECTED_LINK_WIDTH_SHIFT ;
@@ -7195,22 +7186,14 @@ static void si_pcie_gen3_enable(struct radeon_device *rdev)msleep (100 );/* linkctl */ -pcie_capability_read_word (root,PCI_EXP_LNKCTL , - &tmp16); - tmp16 &= ~PCI_EXP_LNKCTL_HAWD ; - tmp16 |= (bridge_cfg &PCI_EXP_LNKCTL_HAWD ); -pcie_capability_write_word (root, -PCI_EXP_LNKCTL , - tmp16); - -pcie_capability_read_word (rdev->pdev, -PCI_EXP_LNKCTL , - &tmp16); - tmp16 &= ~PCI_EXP_LNKCTL_HAWD ; - tmp16 |= (gpu_cfg &PCI_EXP_LNKCTL_HAWD ); -pcie_capability_write_word (rdev->pdev, -PCI_EXP_LNKCTL , - tmp16); +pcie_capability_clear_and_set_word (root,PCI_EXP_LNKCTL , +PCI_EXP_LNKCTL_HAWD , + bridge_cfg & +PCI_EXP_LNKCTL_HAWD ); +pcie_capability_clear_and_set_word (rdev->pdev,PCI_EXP_LNKCTL , +PCI_EXP_LNKCTL_HAWD , + gpu_cfg & +PCI_EXP_LNKCTL_HAWD );/* linkctl2 */ pcie_capability_read_word(root, PCI_EXP_LNKCTL2,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 190/406 net/mlx5: Use RMW accessors for changing LNKCTL
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilpo Järvinen <[email protected]>
[ Upstream commit 30de872537bda526664d7a20b646adfb3e7ce6e6 ]
Don't assume that only the driver would be accessing LNKCTL of the upstream bridge. ASPM policy changes can trigger write to LNKCTL outside of driver's control.
Use RMW capability accessors which do proper locking to avoid losing concurrent updates to the register value.
--- drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +2 -7
@@ -279,16 +279,11 @@ static int mlx5_pci_link_toggle(struct mlx5_core_dev *dev)pci_cfg_access_lock (sdev); }/* PCI link toggle */ - err =pci_read_config_word (bridge, cap +PCI_EXP_LNKCTL , ®16); -if (err) -return err; - reg16 |=PCI_EXP_LNKCTL_LD ; - err =pci_write_config_word (bridge, cap +PCI_EXP_LNKCTL , reg16); + err =pcie_capability_set_word (bridge,PCI_EXP_LNKCTL ,PCI_EXP_LNKCTL_LD );if (err)return err;msleep (500 ); - reg16 &= ~PCI_EXP_LNKCTL_LD ; - err =pci_write_config_word (bridge, cap +PCI_EXP_LNKCTL , reg16); + err =pcie_capability_clear_word (bridge,PCI_EXP_LNKCTL ,PCI_EXP_LNKCTL_LD );if (err)return err;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 191/406 wifi: ath10k: Use RMW accessors for changing LNKCTL
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilpo Järvinen <[email protected]>
[ Upstream commit f139492a09f15254fa261245cdbd65555cdf39e3 ]
Don't assume that only the driver would be accessing LNKCTL. ASPM policy changes can trigger write to LNKCTL outside of driver's control.
Use RMW capability accessors which does proper locking to avoid losing concurrent updates to the register value. On restore, clear the ASPMC field properly.
--- drivers/net/wireless/ath/ath10k/pci.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath10k/pci.c +5 -4
@@ -1963,8 +1963,9 @@ static int ath10k_pci_hif_start(struct ath10k *ar)ath10k_pci_irq_enable (ar);ath10k_pci_rx_post (ar); -pcie_capability_write_word (ar_pci->pdev,PCI_EXP_LNKCTL , - ar_pci->link_ctl); +pcie_capability_clear_and_set_word (ar_pci->pdev,PCI_EXP_LNKCTL , +PCI_EXP_LNKCTL_ASPMC , + ar_pci->link_ctl &PCI_EXP_LNKCTL_ASPMC );return 0 ; }
@@ -2820,8 +2821,8 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar,pcie_capability_read_word (ar_pci->pdev,PCI_EXP_LNKCTL , &ar_pci->link_ctl); -pcie_capability_write_word (ar_pci->pdev,PCI_EXP_LNKCTL , - ar_pci->link_ctl & ~PCI_EXP_LNKCTL_ASPMC ); +pcie_capability_clear_word (ar_pci->pdev,PCI_EXP_LNKCTL , +PCI_EXP_LNKCTL_ASPMC );/* * Bring the target up cleanly.
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 192/406 powerpc: Dont include lppaca.h in paca.h
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit 1aa000667669fa855853decbb1c69e974d8ff716 ]
By adding a forward declaration for struct lppaca we can untangle paca.h and lppaca.h. Also move get_lppaca() into lppaca.h for consistency.
Add includes of lppaca.h to some files that need it.
Stable-dep-of: eac030b22ea1 ("powerpc/pseries: Rework lppaca_shared_proc() to avoid DEBUG_PREEMPT")
--- arch/powerpc/include/asm/lppaca.h | 4 ++++ arch/powerpc/include/asm/paca.h | 6 +----- arch/powerpc/include/asm/paravirt.h | 1 + arch/powerpc/include/asm/plpar_wrappers.h | 1 + arch/powerpc/kvm/book3s_hv_ras.c | 1 + arch/powerpc/mm/book3s64/slb.c | 1 + arch/powerpc/xmon/xmon.c | 1 + 7 files changed, 10 insertions(+), 5 deletions(-)
arch/powerpc/include/asm/lppaca.h +4 -0
@@ -130,6 +130,10 @@ static inline bool lppaca_shared_proc(struct lppaca *l)return !!(l->__old_status &LPPACA_OLD_SHARED_PROC ); } +#ifdef CONFIG_PPC_PSERIES +#define get_lppaca () (get_paca()->lppaca_ptr) +#endif +/* * SLB shadow buffer structure as defined in the PAPR. The save_area * contains adjacent ESID and VSID pairs for each shadowed SLB. The
arch/powerpc/include/asm/paca.h +1 -5
@@ -14,7 +14,6 @@#include <linux/string.h> #include <asm/types.h> -#include <asm/lppaca.h> #include <asm/mmu.h> #include <asm/page.h> #ifdef CONFIG_PPC_BOOK3E
@@ -45,14 +44,11 @@ extern unsigned int debug_smp_processor_id(void); /* from linux/smp.h */#define get_paca () local_paca#endif -#ifdef CONFIG_PPC_PSERIES -#define get_lppaca () (get_paca()->lppaca_ptr) -#endif -#define get_slb_shadow () (get_paca()->slb_shadow_ptr)struct task_struct ;struct rtas_args ; +struct lppaca ;/* * Defines the layout of the paca.
arch/powerpc/include/asm/paravirt.h +1 -0
@@ -6,6 +6,7 @@#include <asm/smp.h> #ifdef CONFIG_PPC64 #include <asm/paca.h> +#include <asm/lppaca.h> #include <asm/hvcall.h> #endif
arch/powerpc/include/asm/plpar_wrappers.h +1 -0
@@ -9,6 +9,7 @@#include <asm/hvcall.h> #include <asm/paca.h> +#include <asm/lppaca.h> #include <asm/page.h> static inline long poll_pending (void )
arch/powerpc/kvm/book3s_hv_ras.c +1 -0
@@ -9,6 +9,7 @@#include <linux/kvm.h> #include <linux/kvm_host.h> #include <linux/kernel.h> +#include <asm/lppaca.h> #include <asm/opal.h> #include <asm/mce.h> #include <asm/machdep.h>
arch/powerpc/mm/book3s64/slb.c +1 -0
@@ -13,6 +13,7 @@#include <asm/mmu.h> #include <asm/mmu_context.h> #include <asm/paca.h> +#include <asm/lppaca.h> #include <asm/ppc-opcode.h> #include <asm/cputable.h> #include <asm/cacheflush.h>
arch/powerpc/xmon/xmon.c +1 -0
@@ -58,6 +58,7 @@#ifdef CONFIG_PPC64 #include <asm/hvcall.h> #include <asm/paca.h> +#include <asm/lppaca.h> #endif #include "nonstdio.h"
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 193/406 powerpc/pseries: Rework lppaca_shared_proc() to avoid DEBUG_PREEMPT
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell Currey <[email protected]>
[ Upstream commit eac030b22ea12cdfcbb2e941c21c03964403c63f ]
lppaca_shared_proc() takes a pointer to the lppaca which is typically accessed through get_lppaca(). With DEBUG_PREEMPT enabled, this leads to checking if preemption is enabled, for example:
BUG: using smp_processor_id() in preemptible [00000000] code: grep/10693
caller is lparcfg_data+0x408/0x19a0
CPU: 4 PID: 10693 Comm: grep Not tainted 6.5.0-rc3 #2
Call Trace:
dump_stack_lvl+0x154/0x200 (unreliable)
check_preemption_disabled+0x214/0x220
lparcfg_data+0x408/0x19a0
...This isn't actually a problem however, as it does not matter which lppaca is accessed, the shared proc state will be the same. vcpudispatch_stats_procfs_init() already works around this by disabling preemption, but the lparcfg code does not, erroring any time /proc/powerpc/lparcfg is accessed with DEBUG_PREEMPT enabled.
Instead of disabling preemption on the caller side, rework lppaca_shared_proc() to not take a pointer and instead directly access the lppaca, bypassing any potential preemption checks.
--- arch/powerpc/include/asm/lppaca.h | 11 +++++++++-- arch/powerpc/platforms/pseries/lpar.c | 10 +--------- arch/powerpc/platforms/pseries/lparcfg.c | 4 ++-- arch/powerpc/platforms/pseries/setup.c | 2 +- drivers/cpuidle/cpuidle-pseries.c | 8 +------- 5 files changed, 14 insertions(+), 21 deletions(-)
arch/powerpc/include/asm/lppaca.h +9 -2
@@ -45,6 +45,7 @@#include <asm/types.h> #include <asm/mmu.h> #include <asm/firmware.h> +#include <asm/paca.h> /* * The lppaca is the "virtual processor area" registered with the hypervisor,
@@ -123,14 +124,20 @@ struct lppaca {*/ #define LPPACA_OLD_SHARED_PROC 2 -static inline bool lppaca_shared_proc (struct lppaca *l) +#ifdef CONFIG_PPC_PSERIES +/* +* All CPUs should have the same shared proc value, so directly access the PACA +* to avoid false positives from DEBUG_PREEMPT. +*/ +static inline bool lppaca_shared_proc (void ) { +struct lppaca *l = local_paca->lppaca_ptr; +if (!firmware_has_feature (FW_FEATURE_SPLPAR ))return false;return !!(l->__old_status &LPPACA_OLD_SHARED_PROC ); } -#ifdef CONFIG_PPC_PSERIES #define get_lppaca () (get_paca()->lppaca_ptr)#endif
arch/powerpc/platforms/pseries/lpar.c +1 -9
@@ -637,16 +637,8 @@ static const struct proc_ops vcpudispatch_stats_freq_proc_ops = {static int __init vcpudispatch_stats_procfs_init (void ) { -/* -* Avoid smp_processor_id while preemptible. All CPUs should have -* the same value for lppaca_shared_proc. -*/ -preempt_disable (); -if (!lppaca_shared_proc (get_lppaca ())) { -preempt_enable (); +if (!lppaca_shared_proc ())return 0 ; - } -preempt_enable ();if (!proc_create ("powerpc/vcpudispatch_stats" ,0600 ,NULL , &vcpudispatch_stats_proc_ops))
arch/powerpc/platforms/pseries/lparcfg.c +2 -2
@@ -205,7 +205,7 @@ static void parse_ppp_data(struct seq_file *m) ppp_data.active_system_procs);/* pool related entries are appropriate for shared configs */ -if (lppaca_shared_proc (get_lppaca ())) { +if (lppaca_shared_proc ()) {unsigned long pool_idle_time, pool_procs;seq_printf (m,"pool=%d\n" , ppp_data.pool_num);
@@ -529,7 +529,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v) partition_potential_processors);seq_printf (m,"shared_processor_mode=%d\n" , -lppaca_shared_proc (get_lppaca ())); +lppaca_shared_proc ());#ifdef CONFIG_PPC_BOOK3S_64 seq_printf (m,"slb_size=%d\n" , mmu_slb_size);
arch/powerpc/platforms/pseries/setup.c +1 -1
@@ -800,7 +800,7 @@ static void __init pSeries_setup_arch(void)if (firmware_has_feature (FW_FEATURE_LPAR )) {vpa_init (boot_cpuid); -if (lppaca_shared_proc (get_lppaca ())) { +if (lppaca_shared_proc ()) {static_branch_enable (&shared_processor);pv_spinlocks_init (); }
drivers/cpuidle/cpuidle-pseries.c +1 -7
@@ -409,13 +409,7 @@ static int __init pseries_idle_probe(void)return -ENODEV ;if (firmware_has_feature (FW_FEATURE_SPLPAR )) { -/* -* Use local_paca instead of get_lppaca() since -* preemption is not disabled, and it is not required in -* fact, since lppaca_ptr does not need to be the value -* associated to the current CPU, it can be from any CPU. -*/ -if (lppaca_shared_proc (local_paca->lppaca_ptr)) { +if (lppaca_shared_proc ()) { cpuidle_state_table = shared_states; max_idle_state =ARRAY_SIZE (shared_states); }else {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 194/406 nfs/blocklayout: Use the passed in gfp flags
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 08b45fcb2d4675f6182fe0edc0d8b1fe604051fa ]
This allocation should use the passed in GFP_ flags instead of GFP_KERNEL. One places where this matters is in filelayout_pg_init_write() which uses GFP_NOFS as the allocation flags.
--- fs/nfs/blocklayout/dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/blocklayout/dev.c +2 -2
@@ -422,7 +422,7 @@ bl_parse_concat(struct nfs_server *server, struct pnfs_block_dev *d,int ret, i; d->children =kcalloc (v->concat.volumes_count, -sizeof (struct pnfs_block_dev ),GFP_KERNEL ); +sizeof (struct pnfs_block_dev ), gfp_mask);if (!d->children)return -ENOMEM ;
@@ -451,7 +451,7 @@ bl_parse_stripe(struct nfs_server *server, struct pnfs_block_dev *d,int ret, i; d->children =kcalloc (v->stripe.volumes_count, -sizeof (struct pnfs_block_dev ),GFP_KERNEL ); +sizeof (struct pnfs_block_dev ), gfp_mask);if (!d->children)return -ENOMEM ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 195/406 powerpc/iommu: Fix notifiers being shared by PCI and VIO buses
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell Currey <[email protected]>
[ Upstream commit c37b6908f7b2bd24dcaaf14a180e28c9132b9c58 ]
fail_iommu_setup() registers the fail_iommu_bus_notifier struct to both PCI and VIO buses. struct notifier_block is a linked list node, so this causes any notifiers later registered to either bus type to also be registered to the other since they share the same node.
This causes issues in (at least) the vgaarb code, which registers a notifier for PCI buses. pci_notify() ends up being called on a vio device, converted with to_pci_dev() even though it's not a PCI device, and finally makes a bad access in vga_arbiter_add_pci_device() as discovered with KASAN:
BUG: KASAN: slab-out-of-bounds in vga_arbiter_add_pci_device+0x60/0xe00 Read of size 4 at addr c000000264c26fdc by task swapper/0/1 Call Trace: dump_stack_lvl+0x1bc/0x2b8 (unreliable) print_report+0x3f4/0xc60 kasan_report+0x244/0x698 __asan_load4+0xe8/0x250 vga_arbiter_add_pci_device+0x60/0xe00 pci_notify+0x88/0x444 notifier_call_chain+0x104/0x320 blocking_notifier_call_chain+0xa0/0x140 device_add+0xac8/0x1d30 device_register+0x58/0x80 vio_register_device_node+0x9ac/0xce0 vio_bus_scan_register_devices+0xc4/0x13c __machine_initcall_pseries_vio_device_init+0x94/0xf0 do_one_initcall+0x12c/0xaa8 kernel_init_freeable+0xa48/0xba8 kernel_init+0x64/0x400 ret_from_kernel_thread+0x5c/0x64
Fix this by creating separate notifier_block structs for each bus type.
--- arch/powerpc/kernel/iommu.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
arch/powerpc/kernel/iommu.c +14 -3
@@ -133,17 +133,28 @@ static int fail_iommu_bus_notify(struct notifier_block *nb,return 0 ; } -static struct notifier_block fail_iommu_bus_notifier = { +/* +* PCI and VIO buses need separate notifier_block structs, since they're linked +* list nodes. Sharing a notifier_block would mean that any notifiers later +* registered for PCI buses would also get called by VIO buses and vice versa. +*/ +static struct notifier_block fail_iommu_pci_bus_notifier = { .notifier_call = fail_iommu_bus_notify }; +#ifdef CONFIG_IBMVIO +static struct notifier_block fail_iommu_vio_bus_notifier = { + .notifier_call = fail_iommu_bus_notify +}; +#endif +static int __init fail_iommu_setup (void ) {#ifdef CONFIG_PCI -bus_register_notifier (&pci_bus_type, &fail_iommu_bus_notifier); +bus_register_notifier (&pci_bus_type, &fail_iommu_pci_bus_notifier);#endif #ifdef CONFIG_IBMVIO -bus_register_notifier (&vio_bus_type, &fail_iommu_bus_notifier); +bus_register_notifier (&vio_bus_type, &fail_iommu_vio_bus_notifier);#endif return 0 ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 196/406 jfs: validate max amount of blocks before allocation.
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Filippov <[email protected]>
[ Upstream commit 0225e10972fa809728b8d4c1bd2772b3ec3fdb57 ]
The lack of checking bmp->db_max_freebud in extBalloc() can lead to shift out of bounds, so this patch prevents undefined behavior, because bmp->db_max_freebud == -1 only if there is no free space.
--- fs/jfs/jfs_extent.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/jfs/jfs_extent.c +5 -0
@@ -508,6 +508,11 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)* blocks in the map. in that case, we'll start off with the * maximum free. */ + +/* give up if no space left */ +if (bmp->db_maxfreebud ==-1 ) +return -ENOSPC ; + max = (s64 )1 << bmp->db_maxfreebud;if (*nblocks >= max && *nblocks > nbperpage) nb = nblks = (max > nbperpage) ? max : nbperpage;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 197/406 fs: lockd: avoid possible wrong NULL parameter
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Hui <[email protected]>
[ Upstream commit de8d38cf44bac43e83bad28357ba84784c412752 ]
clang's static analysis warning: fs/lockd/mon.c: line 293, column 2:
Null pointer passed as 2nd argument to memory copy function.
Assuming 'hostname' is NULL and calling 'nsm_create_handle()', this will pass NULL as 2nd argument to memory copy function 'memcpy()'. So return NULL if 'hostname' is invalid.
--- fs/lockd/mon.c | 3 +++ 1 file changed, 3 insertions(+)
fs/lockd/mon.c +3 -0
@@ -276,6 +276,9 @@ static struct nsm_handle *nsm_create_handle(const struct sockaddr *sap, {struct nsm_handle *new; +if (!hostname) +return NULL ; + new =kzalloc (sizeof (*new) + hostname_len +1 ,GFP_KERNEL );if (unlikely (new ==NULL ))return NULL ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 198/406 NFSD: da_addr_body field missing in some GETDEVICEINFO replies
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit 6372e2ee629894433fe6107d7048536a3280a284 ]
The XDR specification in RFC 8881 looks like this:
struct device_addr4 {
layouttype4 da_layout_type;
opaque da_addr_body<>;
};struct GETDEVICEINFO4resok {
device_addr4 gdir_device_addr;
bitmap4 gdir_notification;
};union GETDEVICEINFO4res switch (nfsstat4 gdir_status) { case NFS4_OK:
GETDEVICEINFO4resok gdir_resok4; case NFS4ERR_TOOSMALL: count4 gdir_mincount; default: void; };
Looking at nfsd4_encode_getdeviceinfo() ....
When the client provides a zero gd_maxcount, then the Linux NFS server implementation encodes the da_layout_type field and then skips the da_addr_body field completely, proceeding directly to encode gdir_notification field.
There does not appear to be an option in the specification to skip encoding da_addr_body. Moreover, Section 18.40.3 says:
Quoted 4 lines
If the client wants to just update or turn off notifications, it MAY send a GETDEVICEINFO operation with
gdia_maxcountset to zero. In that event, if the device ID is valid, the reply'sda_addr_bodyfield of thegdir_device_addrfield will be of zero length.
Since the layout drivers are responsible for encoding the da_addr_body field, put this fix inside the ->encode_getdeviceinfo methods.
--- fs/nfsd/blocklayoutxdr.c | 9 +++++++++ fs/nfsd/flexfilelayoutxdr.c | 9 +++++++++ fs/nfsd/nfs4xdr.c | 25 +++++++++++-------------- 3 files changed, 29 insertions(+), 14 deletions(-)
fs/nfsd/blocklayoutxdr.c +9 -0
@@ -82,6 +82,15 @@ nfsd4_block_encode_getdeviceinfo(struct xdr_stream *xdr,int len =sizeof (__be32), ret, i;__be32 *p; +/* +* See paragraph 5 of RFC 8881 S18.40.3. +*/ +if (!gdp->gd_maxcount) { +if (xdr_stream_encode_u32 (xdr,0 ) !=XDR_UNIT ) +return nfserr_resource; +return nfs_ok; + } + p =xdr_reserve_space (xdr, len +sizeof (__be32));if (!p)return nfserr_resource;
fs/nfsd/flexfilelayoutxdr.c +9 -0
@@ -85,6 +85,15 @@ nfsd4_ff_encode_getdeviceinfo(struct xdr_stream *xdr,int addr_len;__be32 *p; +/* +* See paragraph 5 of RFC 8881 S18.40.3. +*/ +if (!gdp->gd_maxcount) { +if (xdr_stream_encode_u32 (xdr,0 ) !=XDR_UNIT ) +return nfserr_resource; +return nfs_ok; + } +/* len + padding for two strings */ addr_len =16 + da->netaddr.netid_len + da->netaddr.addr_len; ver_len =20 ;
fs/nfsd/nfs4xdr.c +11 -14
@@ -4407,20 +4407,17 @@ nfsd4_encode_getdeviceinfo(struct nfsd4_compoundres *resp, __be32 nfserr, *p++ =cpu_to_be32 (gdev->gd_layout_type); -/* If maxcount is 0 then just update notifications */ -if (gdev->gd_maxcount !=0 ) { - ops = nfsd4_layout_ops[gdev->gd_layout_type]; - nfserr = ops->encode_getdeviceinfo (xdr, gdev); -if (nfserr) { -/* -* We don't bother to burden the layout drivers with -* enforcing gd_maxcount, just tell the client to -* come back with a bigger buffer if it's not enough. -*/ -if (xdr->buf->len +4 > gdev->gd_maxcount) - goto toosmall; -return nfserr; - } + ops = nfsd4_layout_ops[gdev->gd_layout_type]; + nfserr = ops->encode_getdeviceinfo (xdr, gdev); +if (nfserr) { +/* +* We don't bother to burden the layout drivers with +* enforcing gd_maxcount, just tell the client to +* come back with a bigger buffer if it's not enough. +*/ +if (xdr->buf->len +4 > gdev->gd_maxcount) + goto toosmall; +return nfserr; }if (gdev->gd_notify_types) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 199/406 NFS: Guard against READDIR loop when entry names exceed MAXNAMELEN
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Coddington <[email protected]>
[ Upstream commit f67b55b6588bcf9316a1e6e8d529100a5aa3ebe6 ]
Commit 64cfca85bacd asserts the only valid return values for nfs2/3_decode_dirent should not include -ENAMETOOLONG, but for a server that sends a filename3 which exceeds MAXNAMELEN in a READDIR response the client's behavior will be to endlessly retry the operation.
We could map -ENAMETOOLONG into -EBADCOOKIE, but that would produce truncated listings without any error. The client should return an error for this case to clearly assert that the server implementation must be corrected.
--- fs/nfs/nfs2xdr.c | 2 +- fs/nfs/nfs3xdr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/nfs/nfs2xdr.c +1 -1
@@ -948,7 +948,7 @@ int nfs2_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, error =decode_filename_inline (xdr, &entry->name, &entry->len);if (unlikely (error)) -return -EAGAIN ; +return error == -ENAMETOOLONG ? -ENAMETOOLONG : -EAGAIN ;/* * The type (size and byte order) of nfscookie isn't defined in
fs/nfs/nfs3xdr.c +1 -1
@@ -1987,7 +1987,7 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, error =decode_inline_filename3 (xdr, &entry->name, &entry->len);if (unlikely (error)) -return -EAGAIN ; +return error == -ENAMETOOLONG ? -ENAMETOOLONG : -EAGAIN ; error =decode_cookie3 (xdr, &new_cookie);if (unlikely (error))
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 200/406 NFSv4.2: fix handling of COPY ERR_OFFLOAD_NO_REQ
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olga Kornievskaia <[email protected]>
[ Upstream commit 5690eed941ab7e33c3c3d6b850100cabf740f075 ]
If the client sent a synchronous copy and the server replied with ERR_OFFLOAD_NO_REQ indicating that it wants an asynchronous copy instead, the client should retry with asynchronous copy.
--- fs/nfs/nfs42proc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/nfs/nfs42proc.c +3 -2
@@ -443,8 +443,9 @@ ssize_t nfs42_proc_copy(struct file *src, loff_t pos_src,continue ; }break ; - }else if (err == -NFS4ERR_OFFLOAD_NO_REQS && !args.sync) { - args.sync = true; + }else if (err == -NFS4ERR_OFFLOAD_NO_REQS && + args.sync != res.synchronous) { + args.sync = res.synchronous; dst_exception.retry =1 ;continue ; } else if ((err == -ESTALE ||
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 201/406 media: ad5820: Drop unsupported ad5823 from i2c_ and of_device_id tables
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit f126ff7e4024f6704e6ec0d4137037568708a3c7 ]
The supported ad5820 and ad5821 VCMs both use a single 16 bit register which is written by sending 2 bytes with the data directly after sending the i2c-client address.
The ad5823 OTOH has a more typical i2c / smbus device setup with multiple 8 bit registers where the first byte send after the i2c-client address is the register address and the actual data only starts from the second byte after the i2c-client address.
The ad5823 i2c_ and of_device_id-s was added at the same time as the ad5821 ids with as rationale:
"""
Some camera modules also refer that AD5823 is a replacement of AD5820:
https://download.kamami.com/p564094-OV8865_DS.pdf
"""
The AD5823 may be an electrical and functional replacement of the AD5820, but from a software pov it is not compatible at all and it is going to need its own driver, drop its id from the ad5820 driver.
--- drivers/media/i2c/ad5820.c | 2 -- 1 file changed, 2 deletions(-)
drivers/media/i2c/ad5820.c +0 -2
@@ -359,7 +359,6 @@ static int ad5820_remove(struct i2c_client *client)static const struct i2c_device_id ad5820_id_table[] = { {"ad5820" ,0 }, {"ad5821" ,0 }, - {"ad5823" ,0 }, { } };MODULE_DEVICE_TABLE (i2c, ad5820_id_table);
@@ -367,7 +366,6 @@ MODULE_DEVICE_TABLE(i2c, ad5820_id_table);static const struct of_device_id ad5820_of_table[] = { { .compatible ="adi,ad5820" }, { .compatible ="adi,ad5821" }, - { .compatible ="adi,ad5823" }, { } };MODULE_DEVICE_TABLE (of, ad5820_of_table);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 202/406 media: i2c: tvp5150: check return value of devm_kasprintf()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
[ Upstream commit 26ce7054d804be73935b9268d6e0ecf2fbbc8aef ]
devm_kasprintf() returns a pointer to dynamically allocated memory. Pointer could be NULL in case allocation fails. Check pointer validity. Identified with coccinelle (kmerr.cocci script).
--- drivers/media/i2c/tvp5150.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/i2c/tvp5150.c +4 -0
@@ -2078,6 +2078,10 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np) tvpc->ent.name =devm_kasprintf (dev,GFP_KERNEL ,"%s %s" , v4l2c->name, v4l2c->label ? v4l2c->label :"" ); +if (!tvpc->ent.name) { + ret = -ENOMEM ; + goto err_free; + } } ep_np =of_graph_get_endpoint_by_regs (np,TVP5150_PAD_VID_OUT ,0 );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 203/406 media: v4l2-core: Fix a potential resource leak in v4l2_fwnode_parse_link()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit d7b13edd4cb4bfa335b6008ab867ac28582d3e5c ]
If fwnode_graph_get_remote_endpoint() fails, 'fwnode' is known to be NULL, so fwnode_handle_put() is a no-op.
Release the reference taken from a previous fwnode_graph_get_port_parent() call instead.
Also handle fwnode_graph_get_port_parent() failures.
In order to fix these issues, add an error handling path to the function and the needed gotos.
--- drivers/media/v4l2-core/v4l2-fwnode.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/media/v4l2-core/v4l2-fwnode.c +14 -4
@@ -572,19 +572,29 @@ int v4l2_fwnode_parse_link(struct fwnode_handle *fwnode, link->local_id = fwep.id; link->local_port = fwep.port; link->local_node =fwnode_graph_get_port_parent (fwnode); +if (!link->local_node) +return -ENOLINK ; fwnode =fwnode_graph_get_remote_endpoint (fwnode); -if (!fwnode) { -fwnode_handle_put (fwnode); -return -ENOLINK ; - } +if (!fwnode) + goto err_put_local_node;fwnode_graph_parse_endpoint (fwnode, &fwep); link->remote_id = fwep.id; link->remote_port = fwep.port; link->remote_node =fwnode_graph_get_port_parent (fwnode); +if (!link->remote_node) + goto err_put_remote_endpoint;return 0 ; + +err_put_remote_endpoint: +fwnode_handle_put (fwnode); + +err_put_local_node: +fwnode_handle_put (link->local_node); + +return -ENOLINK ; }EXPORT_SYMBOL_GPL (v4l2_fwnode_parse_link);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 204/406 drivers: usb: smsusb: fix error handling code in smsusb_init_device
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dongliang Mu <[email protected]>
[ Upstream commit b9c7141f384097fa4fa67d2f72e5731d628aef7c ]
The previous commit 4b208f8b561f ("[media] siano: register media controller earlier")moves siano_media_device_register before smscore_register_device, and adds corresponding error handling code if smscore_register_device fails. However, it misses the following error handling code of smsusb_init_device.
Fix this by moving error handling code at the end of smsusb_init_device and adding a goto statement in the following error handling parts.
--- drivers/media/usb/siano/smsusb.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/media/usb/siano/smsusb.c +11 -10
@@ -455,12 +455,7 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id) rc =smscore_register_device (¶ms, &dev->coredev,0 , mdev);if (rc <0 ) {pr_err ("smscore_register_device(...) failed, rc %d\n" , rc); -smsusb_term_device (intf); -#ifdef CONFIG_MEDIA_CONTROLLER_DVB -media_device_unregister (mdev); -#endif -kfree (mdev); -return rc; + goto err_unregister_device; }smscore_set_board_id (dev->coredev, board_id);
@@ -477,8 +472,7 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id) rc =smsusb_start_streaming (dev);if (rc <0 ) {pr_err ("smsusb_start_streaming(...) failed\n" ); -smsusb_term_device (intf); -return rc; + goto err_unregister_device; } dev->state =SMSUSB_ACTIVE ;
@@ -486,13 +480,20 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id) rc =smscore_start_device (dev->coredev);if (rc <0 ) {pr_err ("smscore_start_device(...) failed\n" ); -smsusb_term_device (intf); -return rc; + goto err_unregister_device; }pr_debug ("device 0x%p created\n" , dev);return rc; + +err_unregister_device: +smsusb_term_device (intf); +#ifdef CONFIG_MEDIA_CONTROLLER_DVB +media_device_unregister (mdev); +#endif +kfree (mdev); +return rc; } static int smsusb_probe(struct usb_interface *intf,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 205/406 media: dib7000p: Fix potential division by zero
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniil Dulov <[email protected]>
[ Upstream commit a1db7b2c5533fc67e2681eb5efc921a67bc7d5b8 ]
Variable loopdiv can be assigned 0, then it is used as a denominator, without checking it for 0.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/media/dvb-frontends/dib7000p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-frontends/dib7000p.c +1 -1
@@ -497,7 +497,7 @@ static int dib7000p_update_pll(struct dvb_frontend *fe, struct dibx000_bandwidth prediv = reg_1856 &0x3f ; loopdiv = (reg_1856 >>6 ) &0x3f ; -if ((bw !=NULL ) && (bw->pll_prediv != prediv || bw->pll_ratio != loopdiv)) { +if (loopdiv && bw && (bw->pll_prediv != prediv || bw->pll_ratio != loopdiv)) {dprintk ("Updating pll (prediv: old = %d new = %d ; loopdiv : old = %d new = %d)\n" , prediv, bw->pll_prediv, loopdiv, bw->pll_ratio); reg_1856 &=0xf000 ; reg_1857 =dib7000p_read_word (state,1857 );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 206/406 media: dvb-usb: m920x: Fix a potential memory leak in m920x_i2c_xfer()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit ea9ef6c2e001c5dc94bee35ebd1c8a98621cf7b8 ]
'read' is freed when it is known to be NULL, but not when a read error occurs.
Revert the logic to avoid a small leak, should a m920x_read() call fail.
--- drivers/media/usb/dvb-usb/m920x.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/usb/dvb-usb/m920x.c +3 -2
@@ -277,7 +277,6 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nuchar *read =kmalloc (1 ,GFP_KERNEL );if (!read) { ret = -ENOMEM ; -kfree (read); goto unlock; }
@@ -288,8 +287,10 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nuif ((ret =m920x_read (d->udev,M9206_I2C ,0x0 ,0x20 | stop, - read,1 )) !=0 ) + read,1 )) !=0 ) { +kfree (read); goto unlock; + } msg[i].buf[j] = read[0 ]; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 207/406 media: cx24120: Add retval check for cx24120_message_send()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniil Dulov <[email protected]>
[ Upstream commit 96002c0ac824e1773d3f706b1f92e2a9f2988047 ]
If cx24120_message_send() returns error, we should keep local struct unchanged.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/media/dvb-frontends/cx24120.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/dvb-frontends/cx24120.c +3 -1
@@ -972,7 +972,9 @@ static void cx24120_set_clock_ratios(struct dvb_frontend *fe) cmd.arg[8 ] = (clock_ratios_table[idx].rate >>8 ) &0xff ; cmd.arg[9 ] = (clock_ratios_table[idx].rate >>0 ) &0xff ; -cx24120_message_send (state, &cmd); + ret =cx24120_message_send (state, &cmd); +if (ret !=0 ) +return ;/* Calculate ber window rates for stat work */ cx24120_calculate_ber_window (state, clock_ratios_table[idx].rate);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 208/406 scsi: hisi_sas: Print SAS address for v3 hw erroneous completion print
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luo Jiaxing <[email protected]>
[ Upstream commit 4da0b7f6fac331f2d2336df3ca88a335f545b4dc ]
To help debugging efforts, print the device SAS address for v3 hw erroneous completion log.
Here is an example print:
hisi_sas_v3_hw 0000:b4:02.0: erroneous completion iptt=2193 task=000000002b0c13f8 dev id=17 addr=570fd45f9d17b001
Stable-dep-of: f5393a5602ca ("scsi: hisi_sas: Fix normally completed I/O analysed as failed")
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +2 -1
@@ -2240,8 +2240,9 @@ static void slot_complete_v3_hw(struct hisi_hba *hisi_hba,slot_err_v3_hw (hisi_hba, task, slot);if (ts->stat !=SAS_DATA_UNDERRUN ) -dev_info (dev,"erroneous completion iptt=%d task=%pK dev id=%d CQ hdr: 0x%x 0x%x 0x%x 0x%x Error info: 0x%x 0x%x 0x%x 0x%x\n" , +dev_info (dev,"erroneous completion iptt=%d task=%pK dev id=%d addr=%016llx CQ hdr: 0x%x 0x%x 0x%x 0x%x Error info: 0x%x 0x%x 0x%x 0x%x\n" , slot->idx, task, sas_dev->device_id, +SAS_ADDR (device->sas_addr), dw0, dw1, complete_hdr->act, dw3, error_info[0 ], error_info[1 ], error_info[2 ], error_info[3 ]);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 209/406 scsi: libsas: Introduce more SAM status code aliases in enum exec_status
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
[ Upstream commit d377f415dddc18b33c88dcd41cfe4fe6d9db82fb ]
This patch prepares for converting SAM status codes into an enum. Without this patch converting SAM status codes into an enumeration type would trigger complaints about enum type mismatches for the SAS code.
Stable-dep-of: f5393a5602ca ("scsi: hisi_sas: Fix normally completed I/O analysed as failed")
--- drivers/scsi/aic94xx/aic94xx_task.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 8 ++++---- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 8 ++++---- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 8 ++++---- drivers/scsi/isci/request.c | 10 +++++----- drivers/scsi/isci/task.c | 2 +- drivers/scsi/libsas/sas_ata.c | 7 ++++--- drivers/scsi/libsas/sas_expander.c | 2 +- drivers/scsi/libsas/sas_task.c | 4 ++-- drivers/scsi/mvsas/mv_sas.c | 10 +++++----- drivers/scsi/pm8001/pm8001_hwi.c | 16 ++++++++-------- drivers/scsi/pm8001/pm8001_sas.c | 4 ++-- drivers/scsi/pm8001/pm80xx_hwi.c | 14 +++++++------- include/scsi/libsas.h | 12 +++++++++--- 14 files changed, 57 insertions(+), 50 deletions(-)
drivers/scsi/aic94xx/aic94xx_task.c +1 -1
@@ -208,7 +208,7 @@ static void asd_task_tasklet_complete(struct asd_ascb *ascb,switch (opcode) {case TC_NO_ERROR : ts->resp =SAS_TASK_COMPLETE ; - ts->stat =SAM_STAT_GOOD ; + ts->stat =SAS_SAM_STAT_GOOD ;break ;case TC_UNDERRUN : ts->resp =SAS_TASK_COMPLETE ;
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +4 -4
@@ -1152,14 +1152,14 @@ static void slot_err_v1_hw(struct hisi_hba *hisi_hba, }default : { - ts->stat =SAM_STAT_CHECK_CONDITION ; + ts->stat =SAS_SAM_STAT_CHECK_CONDITION ;break ; } } }break ;case SAS_PROTOCOL_SMP : - ts->stat =SAM_STAT_CHECK_CONDITION ; + ts->stat =SAS_SAM_STAT_CHECK_CONDITION ;break ;case SAS_PROTOCOL_SATA :
@@ -1281,7 +1281,7 @@ static void slot_complete_v1_hw(struct hisi_hba *hisi_hba,struct scatterlist *sg_resp = &task->smp_task.smp_resp;void *to =page_address (sg_page (sg_resp)); - ts->stat =SAM_STAT_GOOD ; + ts->stat =SAS_SAM_STAT_GOOD ;dma_unmap_sg (dev, &task->smp_task.smp_req,1 ,DMA_TO_DEVICE );
@@ -1298,7 +1298,7 @@ static void slot_complete_v1_hw(struct hisi_hba *hisi_hba,break ;default : - ts->stat =SAM_STAT_CHECK_CONDITION ; + ts->stat =SAS_SAM_STAT_CHECK_CONDITION ;break ; }
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +4 -4
@@ -2168,7 +2168,7 @@ static void slot_err_v2_hw(struct hisi_hba *hisi_hba, }break ;case SAS_PROTOCOL_SMP : - ts->stat =SAM_STAT_CHECK_CONDITION ; + ts->stat =SAS_SAM_STAT_CHECK_CONDITION ;break ;case SAS_PROTOCOL_SATA :
@@ -2427,7 +2427,7 @@ static void slot_complete_v2_hw(struct hisi_hba *hisi_hba,struct scatterlist *sg_resp = &task->smp_task.smp_resp;void *to =page_address (sg_page (sg_resp)); - ts->stat =SAM_STAT_GOOD ; + ts->stat =SAS_SAM_STAT_GOOD ;dma_unmap_sg (dev, &task->smp_task.smp_req,1 ,DMA_TO_DEVICE );
@@ -2441,12 +2441,12 @@ static void slot_complete_v2_hw(struct hisi_hba *hisi_hba,case SAS_PROTOCOL_STP :case SAS_PROTOCOL_SATA |SAS_PROTOCOL_STP : { - ts->stat =SAM_STAT_GOOD ; + ts->stat =SAS_SAM_STAT_GOOD ;hisi_sas_sata_done (task, slot);break ; }default : - ts->stat =SAM_STAT_CHECK_CONDITION ; + ts->stat =SAS_SAM_STAT_CHECK_CONDITION ;break ; }
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +4 -4
@@ -2159,7 +2159,7 @@ slot_err_v3_hw(struct hisi_hba *hisi_hba, struct sas_task *task,hisi_sas_sata_done (task, slot);break ;case SAS_PROTOCOL_SMP : - ts->stat =SAM_STAT_CHECK_CONDITION ; + ts->stat =SAS_SAM_STAT_CHECK_CONDITION ;break ;default :break ;
@@ -2266,7 +2266,7 @@ static void slot_complete_v3_hw(struct hisi_hba *hisi_hba,struct scatterlist *sg_resp = &task->smp_task.smp_resp;void *to =page_address (sg_page (sg_resp)); - ts->stat =SAM_STAT_GOOD ; + ts->stat =SAS_SAM_STAT_GOOD ;dma_unmap_sg (dev, &task->smp_task.smp_req,1 ,DMA_TO_DEVICE );
@@ -2279,11 +2279,11 @@ static void slot_complete_v3_hw(struct hisi_hba *hisi_hba,case SAS_PROTOCOL_SATA :case SAS_PROTOCOL_STP :case SAS_PROTOCOL_SATA |SAS_PROTOCOL_STP : - ts->stat =SAM_STAT_GOOD ; + ts->stat =SAS_SAM_STAT_GOOD ;hisi_sas_sata_done (task, slot);break ;default : - ts->stat =SAM_STAT_CHECK_CONDITION ; + ts->stat =SAS_SAM_STAT_CHECK_CONDITION ;break ; }
drivers/scsi/isci/request.c +5 -5
@@ -2574,7 +2574,7 @@ static void isci_request_handle_controller_specific_errors(if (!idev) *status_ptr =SAS_DEVICE_UNKNOWN ;else - *status_ptr =SAM_STAT_TASK_ABORTED ; + *status_ptr =SAS_SAM_STAT_TASK_ABORTED ;clear_bit (IREQ_COMPLETE_IN_TARGET , &request->flags); }
@@ -2704,7 +2704,7 @@ static void isci_request_handle_controller_specific_errors(default :/* Task in the target is not done. */ *response_ptr =SAS_TASK_UNDELIVERED ; - *status_ptr =SAM_STAT_TASK_ABORTED ; + *status_ptr =SAS_SAM_STAT_TASK_ABORTED ;if (task->task_proto ==SAS_PROTOCOL_SMP )set_bit (IREQ_COMPLETE_IN_TARGET , &request->flags);
@@ -2727,7 +2727,7 @@ static void isci_process_stp_response(struct sas_task *task, struct dev_to_host_if (ac_err_mask (fis->status)) ts->stat =SAS_PROTO_RESPONSE ;else - ts->stat =SAM_STAT_GOOD ; + ts->stat =SAS_SAM_STAT_GOOD ; ts->resp =SAS_TASK_COMPLETE ; }
@@ -2790,7 +2790,7 @@ static void isci_request_io_request_complete(struct isci_host *ihost,case SCI_IO_SUCCESS_IO_DONE_EARLY : response =SAS_TASK_COMPLETE ; - status =SAM_STAT_GOOD ; + status =SAS_SAM_STAT_GOOD ;set_bit (IREQ_COMPLETE_IN_TARGET , &request->flags);if (completion_status ==SCI_IO_SUCCESS_IO_DONE_EARLY ) {
@@ -2860,7 +2860,7 @@ static void isci_request_io_request_complete(struct isci_host *ihost,/* Fail the I/O. */ response =SAS_TASK_UNDELIVERED ; - status =SAM_STAT_TASK_ABORTED ; + status =SAS_SAM_STAT_TASK_ABORTED ;clear_bit (IREQ_COMPLETE_IN_TARGET , &request->flags);break ;
drivers/scsi/isci/task.c +1 -1
@@ -160,7 +160,7 @@ int isci_task_execute_task(struct sas_task *task, gfp_t gfp_flags)isci_task_refuse (ihost, task,SAS_TASK_UNDELIVERED , -SAM_STAT_TASK_ABORTED ); +SAS_SAM_STAT_TASK_ABORTED ); }else { task->task_state_flags |=SAS_TASK_AT_INITIATOR ;spin_unlock_irqrestore (&task->task_state_lock, flags);
drivers/scsi/libsas/sas_ata.c +4 -3
@@ -122,9 +122,10 @@ static void sas_ata_task_done(struct sas_task *task) } } -if (stat->stat ==SAS_PROTO_RESPONSE || stat->stat ==SAM_STAT_GOOD || - ((stat->stat ==SAM_STAT_CHECK_CONDITION && - dev->sata_dev.class ==ATA_DEV_ATAPI ))) { +if (stat->stat ==SAS_PROTO_RESPONSE || + stat->stat ==SAS_SAM_STAT_GOOD || + (stat->stat ==SAS_SAM_STAT_CHECK_CONDITION && + dev->sata_dev.class ==ATA_DEV_ATAPI )) {memcpy (dev->sata_dev.fis, resp->ending_fis,ATA_RESP_FIS_SIZE );if (!link->sactive) {
drivers/scsi/libsas/sas_expander.c +1 -1
@@ -101,7 +101,7 @@ static int smp_execute_task_sg(struct domain_device *dev, } }if (task->task_status.resp ==SAS_TASK_COMPLETE && - task->task_status.stat ==SAM_STAT_GOOD ) { + task->task_status.stat ==SAS_SAM_STAT_GOOD ) { res =0 ;break ; }
drivers/scsi/libsas/sas_task.c +2 -2
@@ -20,7 +20,7 @@ void sas_ssp_task_response(struct device *dev, struct sas_task *task,else if (iu->datapres ==1 ) tstat->stat = iu->resp_data[3 ];else if (iu->datapres ==2 ) { - tstat->stat =SAM_STAT_CHECK_CONDITION ; + tstat->stat =SAS_SAM_STAT_CHECK_CONDITION ; tstat->buf_valid_size =min_t (int,SAS_STATUS_BUF_SIZE ,be32_to_cpu (iu->sense_data_len));
@@ -32,7 +32,7 @@ void sas_ssp_task_response(struct device *dev, struct sas_task *task, }else /* when datapres contains corrupt/unknown value... */ - tstat->stat =SAM_STAT_CHECK_CONDITION ; + tstat->stat =SAS_SAM_STAT_CHECK_CONDITION ; }EXPORT_SYMBOL_GPL (sas_ssp_task_response);
drivers/scsi/mvsas/mv_sas.c +5 -5
@@ -1314,7 +1314,7 @@ static int mvs_exec_internal_tmf_task(struct domain_device *dev, }if (task->task_status.resp ==SAS_TASK_COMPLETE && - task->task_status.stat ==SAM_STAT_GOOD ) { + task->task_status.stat ==SAS_SAM_STAT_GOOD ) { res =TMF_RESP_FUNC_COMPLETE ;break ; }
@@ -1764,7 +1764,7 @@ int mvs_slot_complete(struct mvs_info *mvi, u32 rx_desc, u32 flags)case SAS_PROTOCOL_SSP :/* hw says status == 0, datapres == 0 */ if (rx_desc &RXQ_GOOD ) { - tstat->stat =SAM_STAT_GOOD ; + tstat->stat =SAS_SAM_STAT_GOOD ; tstat->resp =SAS_TASK_COMPLETE ; }/* response frame present */
@@ -1773,12 +1773,12 @@ int mvs_slot_complete(struct mvs_info *mvi, u32 rx_desc, u32 flags)sizeof (struct mvs_err_info );sas_ssp_task_response (mvi->dev, task, iu); }else - tstat->stat =SAM_STAT_CHECK_CONDITION ; + tstat->stat =SAS_SAM_STAT_CHECK_CONDITION ;break ;case SAS_PROTOCOL_SMP : {struct scatterlist *sg_resp = &task->smp_task.smp_resp; - tstat->stat =SAM_STAT_GOOD ; + tstat->stat =SAS_SAM_STAT_GOOD ; to =kmap_atomic (sg_page (sg_resp)); memcpy(to + sg_resp->offset, slot->response + sizeof(struct mvs_err_info),
@@ -1795,7 +1795,7 @@ int mvs_slot_complete(struct mvs_info *mvi, u32 rx_desc, u32 flags) }default : - tstat->stat =SAM_STAT_CHECK_CONDITION ; + tstat->stat =SAS_SAM_STAT_CHECK_CONDITION ;break ; }if (!slot->port->port_attached) {
drivers/scsi/pm8001/pm8001_hwi.c +8 -8
@@ -1881,7 +1881,7 @@ mpi_ssp_completion(struct pm8001_hba_info *pm8001_ha , void *piomb) param);if (param ==0 ) { ts->resp =SAS_TASK_COMPLETE ; - ts->stat =SAM_STAT_GOOD ; + ts->stat =SAS_SAM_STAT_GOOD ; }else { ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_PROTO_RESPONSE ;
@@ -2341,7 +2341,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)pm8001_dbg (pm8001_ha,IO ,"IO_SUCCESS\n" );if (param ==0 ) { ts->resp =SAS_TASK_COMPLETE ; - ts->stat =SAM_STAT_GOOD ; + ts->stat =SAS_SAM_STAT_GOOD ;/* check if response is for SEND READ LOG */ if (pm8001_dev && (pm8001_dev->id &NCQ_READ_LOG_FLAG )) {
@@ -2864,7 +2864,7 @@ mpi_smp_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)case IO_SUCCESS :pm8001_dbg (pm8001_ha,IO ,"IO_SUCCESS\n" ); ts->resp =SAS_TASK_COMPLETE ; - ts->stat =SAM_STAT_GOOD ; + ts->stat =SAS_SAM_STAT_GOOD ;if (pm8001_dev)atomic_dec (&pm8001_dev->running_req);break ;
@@ -2891,17 +2891,17 @@ mpi_smp_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)case IO_ERROR_HW_TIMEOUT :pm8001_dbg (pm8001_ha,IO ,"IO_ERROR_HW_TIMEOUT\n" ); ts->resp =SAS_TASK_COMPLETE ; - ts->stat =SAM_STAT_BUSY ; + ts->stat =SAS_SAM_STAT_BUSY ;break ;case IO_XFER_ERROR_BREAK :pm8001_dbg (pm8001_ha,IO ,"IO_XFER_ERROR_BREAK\n" ); ts->resp =SAS_TASK_COMPLETE ; - ts->stat =SAM_STAT_BUSY ; + ts->stat =SAS_SAM_STAT_BUSY ;break ;case IO_XFER_ERROR_PHY_NOT_READY :pm8001_dbg (pm8001_ha,IO ,"IO_XFER_ERROR_PHY_NOT_READY\n" ); ts->resp =SAS_TASK_COMPLETE ; - ts->stat =SAM_STAT_BUSY ; + ts->stat =SAS_SAM_STAT_BUSY ;break ;case IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED : pm8001_dbg(pm8001_ha, IO,
@@ -3656,7 +3656,7 @@ int pm8001_mpi_task_abort_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)case IO_SUCCESS :pm8001_dbg (pm8001_ha,EH ,"IO_SUCCESS\n" ); ts->resp =SAS_TASK_COMPLETE ; - ts->stat =SAM_STAT_GOOD ; + ts->stat =SAS_SAM_STAT_GOOD ;break ;case IO_NOT_VALID :pm8001_dbg (pm8001_ha,EH ,"IO_NOT_VALID\n" );
@@ -4288,7 +4288,7 @@ static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha,spin_lock_irqsave (&task->task_state_lock, flags); ts->resp =SAS_TASK_COMPLETE ; - ts->stat =SAM_STAT_GOOD ; + ts->stat =SAS_SAM_STAT_GOOD ; task->task_state_flags &= ~SAS_TASK_STATE_PENDING ; task->task_state_flags &= ~SAS_TASK_AT_INITIATOR ; task->task_state_flags |=SAS_TASK_STATE_DONE ;
drivers/scsi/pm8001/pm8001_sas.c +2 -2
@@ -764,7 +764,7 @@ static int pm8001_exec_internal_tmf_task(struct domain_device *dev, }if (task->task_status.resp ==SAS_TASK_COMPLETE && - task->task_status.stat ==SAM_STAT_GOOD ) { + task->task_status.stat ==SAS_SAM_STAT_GOOD ) { res =TMF_RESP_FUNC_COMPLETE ;break ; }
@@ -846,7 +846,7 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha, }if (task->task_status.resp ==SAS_TASK_COMPLETE && - task->task_status.stat ==SAM_STAT_GOOD ) { + task->task_status.stat ==SAS_SAM_STAT_GOOD ) { res =TMF_RESP_FUNC_COMPLETE ;break ;
drivers/scsi/pm8001/pm80xx_hwi.c +7 -7
@@ -1916,7 +1916,7 @@ mpi_ssp_completion(struct pm8001_hba_info *pm8001_ha , void *piomb) param);if (param ==0 ) { ts->resp =SAS_TASK_COMPLETE ; - ts->stat =SAM_STAT_GOOD ; + ts->stat =SAS_SAM_STAT_GOOD ; }else { ts->resp =SAS_TASK_COMPLETE ; ts->stat =SAS_PROTO_RESPONSE ;
@@ -2450,7 +2450,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)pm8001_dbg (pm8001_ha,IO ,"IO_SUCCESS\n" );if (param ==0 ) { ts->resp =SAS_TASK_COMPLETE ; - ts->stat =SAM_STAT_GOOD ; + ts->stat =SAS_SAM_STAT_GOOD ;/* check if response is for SEND READ LOG */ if (pm8001_dev && (pm8001_dev->id &NCQ_READ_LOG_FLAG )) {
@@ -3004,7 +3004,7 @@ mpi_smp_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)case IO_SUCCESS :pm8001_dbg (pm8001_ha,IO ,"IO_SUCCESS\n" ); ts->resp =SAS_TASK_COMPLETE ; - ts->stat =SAM_STAT_GOOD ; + ts->stat =SAS_SAM_STAT_GOOD ;if (pm8001_dev)atomic_dec (&pm8001_dev->running_req);if (pm8001_ha->smp_exp_mode ==SMP_DIRECT ) {
@@ -3046,17 +3046,17 @@ mpi_smp_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)case IO_ERROR_HW_TIMEOUT :pm8001_dbg (pm8001_ha,IO ,"IO_ERROR_HW_TIMEOUT\n" ); ts->resp =SAS_TASK_COMPLETE ; - ts->stat =SAM_STAT_BUSY ; + ts->stat =SAS_SAM_STAT_BUSY ;break ;case IO_XFER_ERROR_BREAK :pm8001_dbg (pm8001_ha,IO ,"IO_XFER_ERROR_BREAK\n" ); ts->resp =SAS_TASK_COMPLETE ; - ts->stat =SAM_STAT_BUSY ; + ts->stat =SAS_SAM_STAT_BUSY ;break ;case IO_XFER_ERROR_PHY_NOT_READY :pm8001_dbg (pm8001_ha,IO ,"IO_XFER_ERROR_PHY_NOT_READY\n" ); ts->resp =SAS_TASK_COMPLETE ; - ts->stat =SAM_STAT_BUSY ; + ts->stat =SAS_SAM_STAT_BUSY ;break ;case IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED : pm8001_dbg(pm8001_ha, IO,
@@ -4679,7 +4679,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,spin_lock_irqsave (&task->task_state_lock, flags); ts->resp =SAS_TASK_COMPLETE ; - ts->stat =SAM_STAT_GOOD ; + ts->stat =SAS_SAM_STAT_GOOD ; task->task_state_flags &= ~SAS_TASK_STATE_PENDING ; task->task_state_flags &= ~SAS_TASK_AT_INITIATOR ; task->task_state_flags |=SAS_TASK_STATE_DONE ;
include/scsi/libsas.h +9 -3
@@ -474,10 +474,16 @@ enum service_response { };enum exec_status { -/* The SAM_STAT_.. codes fit in the lower 6 bits, alias some of -* them here to silence 'case value not in enumerated type' warnings +/* +* Values 0..0x7f are used to return the SAM_STAT_* codes. To avoid +* 'case value not in enumerated type' compiler warnings every value +* returned through the exec_status enum needs an alias with the SAS_ +* prefix here. */ - __SAM_STAT_CHECK_CONDITION =SAM_STAT_CHECK_CONDITION , +SAS_SAM_STAT_GOOD =SAM_STAT_GOOD , +SAS_SAM_STAT_BUSY =SAM_STAT_BUSY , +SAS_SAM_STAT_TASK_ABORTED =SAM_STAT_TASK_ABORTED , +SAS_SAM_STAT_CHECK_CONDITION =SAM_STAT_CHECK_CONDITION ,SAS_DEV_NO_RESPONSE =0x80 ,SAS_DATA_UNDERRUN ,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 210/406 scsi: hisi_sas: Modify v3 HW SSP underflow error processing
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xingui Yang <[email protected]>
[ Upstream commit 62413199cd6d2906c121c2dfa3d7b82fd05f08db ]
In case of SSP underflow allow the response frame IU to be examined for setting the response stat value rather than always setting SAS_DATA_UNDERRUN.
This will mean that we call sas_ssp_task_response() in those scenarios and may send sense data to upper layer.
Such a condition would be for bad blocks were we just reporting an underflow error to upper layer, but now the sense data will tell immediately that the media is faulty.
Stable-dep-of: f5393a5602ca ("scsi: hisi_sas: Fix normally completed I/O analysed as failed")
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 39 +++++++++++++++++--------- 1 file changed, 26 insertions(+), 13 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +26 -13
@@ -392,6 +392,8 @@#define CMPLT_HDR_ERROR_PHASE_MSK (0xff << CMPLT_HDR_ERROR_PHASE_OFF)#define CMPLT_HDR_RSPNS_XFRD_OFF 10#define CMPLT_HDR_RSPNS_XFRD_MSK (0x1 << CMPLT_HDR_RSPNS_XFRD_OFF) +#define CMPLT_HDR_RSPNS_GOOD_OFF 11 +#define CMPLT_HDR_RSPNS_GOOD_MSK (0x1 << CMPLT_HDR_RSPNS_GOOD_OFF)#define CMPLT_HDR_ERX_OFF 12#define CMPLT_HDR_ERX_MSK (0x1 << CMPLT_HDR_ERX_OFF)#define CMPLT_HDR_ABORT_STAT_OFF 13
@@ -2115,7 +2117,7 @@ static irqreturn_t fatal_axi_int_v3_hw(int irq_no, void *p)return IRQ_HANDLED ; } -static void +static bool slot_err_v3_hw (struct hisi_hba *hisi_hba,struct sas_task *task,struct hisi_sas_slot *slot) {
@@ -2133,6 +2135,15 @@ slot_err_v3_hw(struct hisi_hba *hisi_hba, struct sas_task *task,switch (task->task_proto) {case SAS_PROTOCOL_SSP :if (dma_rx_err_type &RX_DATA_LEN_UNDERFLOW_MSK ) { +/* +* If returned response frame is incorrect because of data underflow, +* but I/O information has been written to the host memory, we examine +* response IU. +*/ +if (!(complete_hdr->dw0 &CMPLT_HDR_RSPNS_GOOD_MSK ) && + (complete_hdr->dw0 &CMPLT_HDR_RSPNS_XFRD_MSK )) +return false; + ts->residual = trans_tx_fail_type; ts->stat =SAS_DATA_UNDERRUN ; }else if (dw3 &CMPLT_HDR_IO_IN_TARGET_MSK ) {
@@ -2164,6 +2175,7 @@ slot_err_v3_hw(struct hisi_hba *hisi_hba, struct sas_task *task,default :break ; } +return true; } static void slot_complete_v3_hw(struct hisi_hba *hisi_hba,
@@ -2238,19 +2250,20 @@ static void slot_complete_v3_hw(struct hisi_hba *hisi_hba,if ((dw0 &CMPLT_HDR_CMPLT_MSK ) ==0x3 ) {u32 *error_info =hisi_sas_status_buf_addr_mem (slot); -slot_err_v3_hw (hisi_hba, task, slot); -if (ts->stat !=SAS_DATA_UNDERRUN ) -dev_info (dev,"erroneous completion iptt=%d task=%pK dev id=%d addr=%016llx CQ hdr: 0x%x 0x%x 0x%x 0x%x Error info: 0x%x 0x%x 0x%x 0x%x\n" , - slot->idx, task, sas_dev->device_id, -SAS_ADDR (device->sas_addr), - dw0, dw1, complete_hdr->act, dw3, - error_info[0 ], error_info[1 ], - error_info[2 ], error_info[3 ]); -if (unlikely (slot->abort)) { -sas_task_abort (task); -return ; +if (slot_err_v3_hw (hisi_hba, task, slot)) { +if (ts->stat !=SAS_DATA_UNDERRUN ) +dev_info (dev,"erroneous completion iptt=%d task=%pK dev id=%d addr=%016llx CQ hdr: 0x%x 0x%x 0x%x 0x%x Error info: 0x%x 0x%x 0x%x 0x%x\n" , + slot->idx, task, sas_dev->device_id, +SAS_ADDR (device->sas_addr), + dw0, dw1, complete_hdr->act, dw3, + error_info[0 ], error_info[1 ], + error_info[2 ], error_info[3 ]); +if (unlikely (slot->abort)) { +sas_task_abort (task); +return ; + } + goto out; } - goto out; }switch (task->task_proto) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 211/406 scsi: hisi_sas: Modify v3 HW SATA completion error processing
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xingui Yang <[email protected]>
[ Upstream commit 7e15334f5d256367fb4c77f4ee0003e1e3d9bf9d ]
If the I/O completion response frame returned by the target device has been written to the host memory and the err bit in the status field of the received fis is 1, ts->stat should set to SAS_PROTO_RESPONSE, and this will let EH analyze and further determine cause of failure.
Stable-dep-of: f5393a5602ca ("scsi: hisi_sas: Fix normally completed I/O analysed as failed")
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +8 -1
@@ -467,6 +467,9 @@ struct hisi_sas_err_record_v3 {#define RX_DATA_LEN_UNDERFLOW_OFF 6#define RX_DATA_LEN_UNDERFLOW_MSK (1 << RX_DATA_LEN_UNDERFLOW_OFF) +#define RX_FIS_STATUS_ERR_OFF 0 +#define RX_FIS_STATUS_ERR_MSK (1 << RX_FIS_STATUS_ERR_OFF) +#define HISI_SAS_COMMAND_ENTRIES_V3_HW 4096#define HISI_SAS_MSI_COUNT_V3_HW 32
@@ -2130,6 +2133,7 @@ slot_err_v3_hw(struct hisi_hba *hisi_hba, struct sas_task *task,hisi_sas_status_buf_addr_mem (slot);u32 dma_rx_err_type =le32_to_cpu (record->dma_rx_err_type);u32 trans_tx_fail_type =le32_to_cpu (record->trans_tx_fail_type); +u16 sipc_rx_err_type =le16_to_cpu (record->sipc_rx_err_type);u32 dw3 =le32_to_cpu (complete_hdr->dw3);switch (task->task_proto) {
@@ -2157,7 +2161,10 @@ slot_err_v3_hw(struct hisi_hba *hisi_hba, struct sas_task *task,case SAS_PROTOCOL_SATA :case SAS_PROTOCOL_STP :case SAS_PROTOCOL_SATA |SAS_PROTOCOL_STP : -if (dma_rx_err_type &RX_DATA_LEN_UNDERFLOW_MSK ) { +if ((complete_hdr->dw0 &CMPLT_HDR_RSPNS_XFRD_MSK ) && + (sipc_rx_err_type &RX_FIS_STATUS_ERR_MSK )) { + ts->stat =SAS_PROTO_RESPONSE ; + }else if (dma_rx_err_type &RX_DATA_LEN_UNDERFLOW_MSK ) { ts->residual = trans_tx_fail_type; ts->stat =SAS_DATA_UNDERRUN ; }else if (dw3 &CMPLT_HDR_IO_IN_TARGET_MSK ) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 212/406 scsi: hisi_sas: Fix warnings detected by sparse
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xingui Yang <[email protected]>
[ Upstream commit c0328cc595124579328462fc45d7a29a084cf357 ]
This patch fixes the following warning:
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:2168:43: sparse: sparse: restricted __le32 degrades to integer
Stable-dep-of: f5393a5602ca ("scsi: hisi_sas: Fix normally completed I/O analysed as failed")
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +4 -3
@@ -2135,6 +2135,7 @@ slot_err_v3_hw(struct hisi_hba *hisi_hba, struct sas_task *task,u32 trans_tx_fail_type =le32_to_cpu (record->trans_tx_fail_type);u16 sipc_rx_err_type =le16_to_cpu (record->sipc_rx_err_type);u32 dw3 =le32_to_cpu (complete_hdr->dw3); +u32 dw0 =le32_to_cpu (complete_hdr->dw0);switch (task->task_proto) {case SAS_PROTOCOL_SSP :
@@ -2144,8 +2145,8 @@ slot_err_v3_hw(struct hisi_hba *hisi_hba, struct sas_task *task,* but I/O information has been written to the host memory, we examine * response IU. */ -if (!(complete_hdr->dw0 &CMPLT_HDR_RSPNS_GOOD_MSK ) && - (complete_hdr->dw0 &CMPLT_HDR_RSPNS_XFRD_MSK )) +if (!(dw0 &CMPLT_HDR_RSPNS_GOOD_MSK ) && + (dw0 &CMPLT_HDR_RSPNS_XFRD_MSK ))return false; ts->residual = trans_tx_fail_type;
@@ -2161,7 +2162,7 @@ slot_err_v3_hw(struct hisi_hba *hisi_hba, struct sas_task *task,case SAS_PROTOCOL_SATA :case SAS_PROTOCOL_STP :case SAS_PROTOCOL_SATA |SAS_PROTOCOL_STP : -if ((complete_hdr->dw0 &CMPLT_HDR_RSPNS_XFRD_MSK ) && +if ((dw0 &CMPLT_HDR_RSPNS_XFRD_MSK ) && (sipc_rx_err_type &RX_FIS_STATUS_ERR_MSK )) { ts->stat =SAS_PROTO_RESPONSE ; }else if (dma_rx_err_type &RX_DATA_LEN_UNDERFLOW_MSK ) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 213/406 scsi: hisi_sas: Fix normally completed I/O analysed as failed
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xingui Yang <[email protected]>
[ Upstream commit f5393a5602cacfda2014e0ff8220e5a7564e7cd1 ]
The PIO read command has no response frame and the struct iu[1024] won't be filled. I/Os which are normally completed will be treated as failed in sas_ata_task_done() when iu contains abnormal dirty data.
Consequently ending_fis should not be filled by iu when the response frame hasn't been written to memory.
--- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 11 +++++++++-- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 6 ++++-- 2 files changed, 13 insertions(+), 4 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +9 -2
@@ -2026,6 +2026,11 @@ static void slot_err_v2_hw(struct hisi_hba *hisi_hba,u16 dma_tx_err_type =le16_to_cpu (err_record->dma_tx_err_type);u16 sipc_rx_err_type =le16_to_cpu (err_record->sipc_rx_err_type);u32 dma_rx_err_type =le32_to_cpu (err_record->dma_rx_err_type); +struct hisi_sas_complete_v2_hdr *complete_queue = + hisi_hba->complete_hdr[slot->cmplt_queue]; +struct hisi_sas_complete_v2_hdr *complete_hdr = + &complete_queue[slot->cmplt_queue_slot]; +u32 dw0 =le32_to_cpu (complete_hdr->dw0);int error =-1 ;if (err_phase ==1 ) {
@@ -2310,7 +2315,8 @@ static void slot_err_v2_hw(struct hisi_hba *hisi_hba,break ; } } -hisi_sas_sata_done (task, slot); +if (dw0 &CMPLT_HDR_RSPNS_XFRD_MSK ) +hisi_sas_sata_done (task, slot); }break ;default :
@@ -2442,7 +2448,8 @@ static void slot_complete_v2_hw(struct hisi_hba *hisi_hba,case SAS_PROTOCOL_SATA |SAS_PROTOCOL_STP : { ts->stat =SAS_SAM_STAT_GOOD ; -hisi_sas_sata_done (task, slot); +if (dw0 &CMPLT_HDR_RSPNS_XFRD_MSK ) +hisi_sas_sata_done (task, slot);break ; }default :
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +4 -2
@@ -2175,7 +2175,8 @@ slot_err_v3_hw(struct hisi_hba *hisi_hba, struct sas_task *task, ts->stat =SAS_OPEN_REJECT ; ts->open_rej_reason =SAS_OREJ_RSVD_RETRY ; } -hisi_sas_sata_done (task, slot); +if (dw0 &CMPLT_HDR_RSPNS_XFRD_MSK ) +hisi_sas_sata_done (task, slot);break ;case SAS_PROTOCOL_SMP : ts->stat =SAS_SAM_STAT_CHECK_CONDITION ;
@@ -2301,7 +2302,8 @@ static void slot_complete_v3_hw(struct hisi_hba *hisi_hba,case SAS_PROTOCOL_STP :case SAS_PROTOCOL_SATA |SAS_PROTOCOL_STP : ts->stat =SAS_SAM_STAT_GOOD ; -hisi_sas_sata_done (task, slot); +if (dw0 &CMPLT_HDR_RSPNS_XFRD_MSK ) +hisi_sas_sata_done (task, slot);break ;default : ts->stat =SAS_SAM_STAT_CHECK_CONDITION ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 214/406 media: rkvdec: increase max supported height for H.264
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Gaignard <[email protected]>
[ Upstream commit f000e6ca2d60fefd02a180a57df2c4162fa0c1b7 ]
After testing it is possible for the hardware to decode H264 bistream with a height up to 2560.
--- drivers/staging/media/rkvdec/rkvdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/rkvdec/rkvdec.c +1 -1
@@ -101,7 +101,7 @@ static const struct rkvdec_coded_fmt_desc rkvdec_coded_fmts[] = { .max_width = 4096, .step_width = 16, .min_height = 48, - .max_height = 2304, + .max_height = 2560, .step_height = 16, }, .ctrls = &rkvdec_h264_ctrls,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 215/406 media: mediatek: vcodec: Return NULL if no vdec_fb is found
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Irui Wang <[email protected]>
[ Upstream commit dfa2d6e07432270330ae191f50a0e70636a4cd2b ]
"fb_use_list" is used to store used or referenced frame buffers for vp9 stateful decoder. "NULL" should be returned when getting target frame buffer failed from "fb_use_list", not a random unexpected one.
--- drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c +3 -2
@@ -226,10 +226,11 @@ static struct vdec_fb *vp9_rm_from_fb_use_list(struct vdec_vp9_instif (fb->base_y.va == addr) {list_move_tail (&node->list, &inst->available_fb_node_list); -break ; +return fb; } } -return fb; + +return NULL ; } static void vp9_add_to_fb_free_list(struct vdec_vp9_inst *inst,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 216/406 usb: phy: mxs: fix getting wrong state with mxs_phy_is_otg_host()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Yang <[email protected]>
[ Upstream commit 5eda42aebb7668b4dcff025cd3ccb0d3d7c53da6 ]
The function mxs_phy_is_otg_host() will return true if OTG_ID_VALUE is 0 at USBPHY_CTRL register. However, OTG_ID_VALUE will not reflect the real state if the ID pin is float, such as Host-only or Type-C cases. The value of OTG_ID_VALUE is always 1 which means device mode.
This patch will fix the issue by judging the current mode based on last_event. The controller will update last_event in time.
--- drivers/usb/phy/phy-mxs-usb.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/usb/phy/phy-mxs-usb.c +2 -8
@@ -388,14 +388,8 @@ static void __mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool disconnect)static bool mxs_phy_is_otg_host (struct mxs_phy *mxs_phy) { -void __iomem *base = mxs_phy->phy.io_priv; -u32 phyctrl =readl (base +HW_USBPHY_CTRL ); - -if (IS_ENABLED (CONFIG_USB_OTG ) && - !(phyctrl &BM_USBPHY_CTRL_OTG_ID_VALUE )) -return true; - -return false; +return IS_ENABLED (CONFIG_USB_OTG ) && + mxs_phy->phy.last_event ==USB_EVENT_ID ; }static void mxs_phy_disconnect_line (struct mxs_phy *mxs_phy,bool on)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 217/406 scsi: RDMA/srp: Fix residual handling
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
[ Upstream commit 89e637c19b2441aabc8dbf22a8745b932fd6996e ]
Although the code for residual handling in the SRP initiator follows the SCSI documentation, that documentation has never been correct. Because scsi_finish_command() starts from the data buffer length and subtracts the residual, scsi_set_resid() must not be called if a residual overflow occurs. Hence remove the scsi_set_resid() calls from the SRP initiator if a residual overflow occurrs.
--- drivers/infiniband/ulp/srp/ib_srp.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/infiniband/ulp/srp/ib_srp.c +0 -4
@@ -1990,12 +1990,8 @@ static void srp_process_rsp(struct srp_rdma_ch *ch, struct srp_rsp *rsp)if (unlikely (rsp->flags &SRP_RSP_FLAG_DIUNDER ))scsi_set_resid (scmnd,be32_to_cpu (rsp->data_in_res_cnt)); -else if (unlikely (rsp->flags &SRP_RSP_FLAG_DIOVER )) -scsi_set_resid (scmnd, -be32_to_cpu (rsp->data_in_res_cnt));else if (unlikely (rsp->flags &SRP_RSP_FLAG_DOUNDER ))scsi_set_resid (scmnd,be32_to_cpu (rsp->data_out_res_cnt)); -else if (unlikely (rsp->flags &SRP_RSP_FLAG_DOOVER )) -scsi_set_resid (scmnd, -be32_to_cpu (rsp->data_out_res_cnt));srp_free_req (ch, req, scmnd,be32_to_cpu (rsp->req_lim_delta));
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 218/406 scsi: iscsi: Rename iscsi_set_param() to iscsi_if_set_param()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wenchao Hao <[email protected]>
[ Upstream commit 0c26a2d7c98039e913e63f9250fde738a3f88a60 ]
There are two iscsi_set_param() functions defined in libiscsi.c and scsi_transport_iscsi.c respectively which is confusing.
Rename the one in scsi_transport_iscsi.c to iscsi_if_set_param().
Stable-dep-of: 971dfcb74a80 ("scsi: iscsi: Add length check for nlattr payload")
--- drivers/scsi/scsi_transport_iscsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/scsi_transport_iscsi.c +2 -2
@@ -2991,7 +2991,7 @@ iscsi_if_destroy_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev }static int -iscsi_set_param (struct iscsi_transport *transport,struct iscsi_uevent *ev) +iscsi_if_set_param (struct iscsi_transport *transport,struct iscsi_uevent *ev) {char *data = (char *)ev +sizeof (*ev);struct iscsi_cls_conn *conn;
@@ -3940,7 +3940,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) err = -EINVAL ;break ;case ISCSI_UEVENT_SET_PARAM : - err =iscsi_set_param (transport, ev); + err =iscsi_if_set_param (transport, ev);break ;case ISCSI_UEVENT_CREATE_CONN :case ISCSI_UEVENT_DESTROY_CONN :
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 219/406 scsi: iscsi: Add length check for nlattr payload
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin Ma <[email protected]>
[ Upstream commit 971dfcb74a800047952f5288512b9c7ddedb050a ]
The current NETLINK_ISCSI netlink parsing loop checks every nlmsg to make sure the length is bigger than sizeof(struct iscsi_uevent) and then calls iscsi_if_recv_msg().
nlh = nlmsg_hdr(skb);
if (nlh->nlmsg_len < sizeof(*nlh) + sizeof(*ev) ||
skb->len < nlh->nlmsg_len) {
break;
}
...
err = iscsi_if_recv_msg(skb, nlh, &group);Hence, in iscsi_if_recv_msg() the nlmsg_data can be safely converted to iscsi_uevent as the length is already checked.
However, in other cases the length of nlattr payload is not checked before the payload is converted to other data structures. One example is iscsi_set_path() which converts the payload to type iscsi_path without any checks:
params = (struct iscsi_path *)((char *)ev + sizeof(*ev));
Whereas iscsi_if_transport_conn() correctly checks the pdu_len:
pdu_len = nlh->nlmsg_len - sizeof(*nlh) - sizeof(*ev);
if ((ev->u.send_pdu.hdr_size > pdu_len) ..
err = -EINVAL;To sum up, some code paths called in iscsi_if_recv_msg() do not check the length of the data (see below picture) and directly convert the data to another data structure. This could result in an out-of-bound reads and heap dirty data leakage.
_________ nlmsg_len(nlh) _______________
/ \
+----------+--------------+---------------------------+
| nlmsghdr | iscsi_uevent | data |
+----------+--------------+---------------------------+
\ /
iscsi_uevent->u.set_param.lenFix the issue by adding the length check before accessing it. To clean up the code, an additional parameter named rlen is added. The rlen is calculated at the beginning of iscsi_if_recv_msg() which avoids duplicated calculation.
--- drivers/scsi/scsi_transport_iscsi.c | 72 +++++++++++++++++------------ 1 file changed, 43 insertions(+), 29 deletions(-)
drivers/scsi/scsi_transport_iscsi.c +43 -29
@@ -2991,14 +2991,15 @@ iscsi_if_destroy_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev }static int -iscsi_if_set_param (struct iscsi_transport *transport,struct iscsi_uevent *ev) +iscsi_if_set_param (struct iscsi_transport *transport,struct iscsi_uevent *ev,u32 rlen) {char *data = (char *)ev +sizeof (*ev);struct iscsi_cls_conn *conn;struct iscsi_cls_session *session;int err =0 , value =0 , state; -if (ev->u.set_param.len >PAGE_SIZE ) +if (ev->u.set_param.len > rlen || + ev->u.set_param.len >PAGE_SIZE )return -EINVAL ; session =iscsi_session_lookup (ev->u.set_param.sid);
@@ -3095,7 +3096,7 @@ static int iscsi_if_ep_disconnect(struct iscsi_transport *transport,static int iscsi_if_transport_ep (struct iscsi_transport *transport, -struct iscsi_uevent *ev,int msg_type) +struct iscsi_uevent *ev,int msg_type,u32 rlen) {struct iscsi_endpoint *ep;int rc =0 ;
@@ -3103,7 +3104,10 @@ iscsi_if_transport_ep(struct iscsi_transport *transport,switch (msg_type) {case ISCSI_UEVENT_TRANSPORT_EP_CONNECT_THROUGH_HOST :case ISCSI_UEVENT_TRANSPORT_EP_CONNECT : - rc =iscsi_if_ep_connect (transport, ev, msg_type); +if (rlen <sizeof (struct sockaddr )) + rc = -EINVAL ; +else + rc =iscsi_if_ep_connect (transport, ev, msg_type);break ;case ISCSI_UEVENT_TRANSPORT_EP_POLL :if (!transport->ep_poll)
@@ -3127,12 +3131,15 @@ iscsi_if_transport_ep(struct iscsi_transport *transport,static int iscsi_tgt_dscvr (struct iscsi_transport *transport, -struct iscsi_uevent *ev) +struct iscsi_uevent *ev,u32 rlen) {struct Scsi_Host *shost;struct sockaddr *dst_addr;int err; +if (rlen <sizeof (*dst_addr)) +return -EINVAL ; +if (!transport->tgt_dscvr)return -EINVAL ;
@@ -3153,7 +3160,7 @@ iscsi_tgt_dscvr(struct iscsi_transport *transport,static int iscsi_set_host_param (struct iscsi_transport *transport, -struct iscsi_uevent *ev) +struct iscsi_uevent *ev,u32 rlen) {char *data = (char *)ev +sizeof (*ev);struct Scsi_Host *shost;
@@ -3162,7 +3169,8 @@ iscsi_set_host_param(struct iscsi_transport *transport,if (!transport->set_host_param)return -ENOSYS ; -if (ev->u.set_host_param.len >PAGE_SIZE ) +if (ev->u.set_host_param.len > rlen || + ev->u.set_host_param.len >PAGE_SIZE )return -EINVAL ; shost =scsi_host_lookup (ev->u.set_host_param.host_no);
@@ -3179,12 +3187,15 @@ iscsi_set_host_param(struct iscsi_transport *transport, }static int -iscsi_set_path (struct iscsi_transport *transport,struct iscsi_uevent *ev) +iscsi_set_path (struct iscsi_transport *transport,struct iscsi_uevent *ev,u32 rlen) {struct Scsi_Host *shost;struct iscsi_path *params;int err; +if (rlen <sizeof (*params)) +return -EINVAL ; +if (!transport->set_path)return -ENOSYS ;
@@ -3244,12 +3255,15 @@ iscsi_set_iface_params(struct iscsi_transport *transport, }static int -iscsi_send_ping (struct iscsi_transport *transport,struct iscsi_uevent *ev) +iscsi_send_ping (struct iscsi_transport *transport,struct iscsi_uevent *ev,u32 rlen) {struct Scsi_Host *shost;struct sockaddr *dst_addr;int err; +if (rlen <sizeof (*dst_addr)) +return -EINVAL ; +if (!transport->send_ping)return -ENOSYS ;
@@ -3747,13 +3761,12 @@ iscsi_get_host_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh) }static int iscsi_if_transport_conn (struct iscsi_transport *transport, -struct nlmsghdr *nlh) +struct nlmsghdr *nlh,u32 pdu_len) {struct iscsi_uevent *ev =nlmsg_data (nlh);struct iscsi_cls_session *session;struct iscsi_cls_conn *conn =NULL ;struct iscsi_endpoint *ep; -uint32_t pdu_len;int err =0 ;switch (nlh->nlmsg_type) {
@@ -3833,8 +3846,6 @@ static int iscsi_if_transport_conn(struct iscsi_transport *transport,break ;case ISCSI_UEVENT_SEND_PDU : - pdu_len = nlh->nlmsg_len -sizeof (*nlh) -sizeof (*ev); -if ((ev->u.send_pdu.hdr_size > pdu_len) || (ev->u.send_pdu.data_size > (pdu_len - ev->u.send_pdu.hdr_size))) { err = -EINVAL ;
@@ -3864,6 +3875,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)struct iscsi_internal *priv;struct iscsi_cls_session *session;struct iscsi_endpoint *ep =NULL ; +u32 rlen;if (!netlink_capable (skb,CAP_SYS_ADMIN ))return -EPERM ;
@@ -3883,6 +3895,13 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) portid =NETLINK_CB (skb).portid; +/* +* Even though the remaining payload may not be regarded as nlattr, +* (like address or something else), calculate the remaining length +* here to ease following length checks. +*/ + rlen =nlmsg_attrlen (nlh,sizeof (*ev)); +switch (nlh->nlmsg_type) {case ISCSI_UEVENT_CREATE_SESSION : err = iscsi_if_create_session(priv, ep, ev,
@@ -3940,7 +3959,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) err = -EINVAL ;break ;case ISCSI_UEVENT_SET_PARAM : - err =iscsi_if_set_param (transport, ev); + err =iscsi_if_set_param (transport, ev, rlen);break ;case ISCSI_UEVENT_CREATE_CONN :case ISCSI_UEVENT_DESTROY_CONN :
@@ -3948,7 +3967,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)case ISCSI_UEVENT_START_CONN :case ISCSI_UEVENT_BIND_CONN :case ISCSI_UEVENT_SEND_PDU : - err =iscsi_if_transport_conn (transport, nlh); + err =iscsi_if_transport_conn (transport, nlh, rlen);break ;case ISCSI_UEVENT_GET_STATS : err =iscsi_if_get_stats (transport, nlh);
@@ -3957,23 +3976,22 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group)case ISCSI_UEVENT_TRANSPORT_EP_POLL :case ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT :case ISCSI_UEVENT_TRANSPORT_EP_CONNECT_THROUGH_HOST : - err =iscsi_if_transport_ep (transport, ev, nlh->nlmsg_type); + err =iscsi_if_transport_ep (transport, ev, nlh->nlmsg_type, rlen);break ;case ISCSI_UEVENT_TGT_DSCVR : - err =iscsi_tgt_dscvr (transport, ev); + err =iscsi_tgt_dscvr (transport, ev, rlen);break ;case ISCSI_UEVENT_SET_HOST_PARAM : - err =iscsi_set_host_param (transport, ev); + err =iscsi_set_host_param (transport, ev, rlen);break ;case ISCSI_UEVENT_PATH_UPDATE : - err =iscsi_set_path (transport, ev); + err =iscsi_set_path (transport, ev, rlen);break ;case ISCSI_UEVENT_SET_IFACE_PARAMS : - err =iscsi_set_iface_params (transport, ev, -nlmsg_attrlen (nlh,sizeof (*ev))); + err =iscsi_set_iface_params (transport, ev, rlen);break ;case ISCSI_UEVENT_PING : - err =iscsi_send_ping (transport, ev); + err =iscsi_send_ping (transport, ev, rlen);break ;case ISCSI_UEVENT_GET_CHAP : err =iscsi_get_chap (transport, nlh);
@@ -3982,13 +4000,10 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) err =iscsi_delete_chap (transport, ev);break ;case ISCSI_UEVENT_SET_FLASHNODE_PARAMS : - err =iscsi_set_flashnode_param (transport, ev, -nlmsg_attrlen (nlh, -sizeof (*ev))); + err =iscsi_set_flashnode_param (transport, ev, rlen);break ;case ISCSI_UEVENT_NEW_FLASHNODE : - err =iscsi_new_flashnode (transport, ev, -nlmsg_attrlen (nlh,sizeof (*ev))); + err =iscsi_new_flashnode (transport, ev, rlen);break ;case ISCSI_UEVENT_DEL_FLASHNODE : err =iscsi_del_flashnode (transport, ev);
@@ -4003,8 +4018,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) err =iscsi_logout_flashnode_sid (transport, ev);break ;case ISCSI_UEVENT_SET_CHAP : - err =iscsi_set_chap (transport, ev, -nlmsg_attrlen (nlh,sizeof (*ev))); + err =iscsi_set_chap (transport, ev, rlen);break ;case ISCSI_UEVENT_GET_HOST_STATS : err =iscsi_get_host_stats (transport, nlh);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 220/406 scsi: iscsi: Add strlen() check in iscsi_if_set{_host}_param()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin Ma <[email protected]>
[ Upstream commit ce51c817008450ef4188471db31639d42d37a5e1 ]
The functions iscsi_if_set_param() and iscsi_if_set_host_param() convert an nlattr payload to type char* and then call C string handling functions like sscanf and kstrdup:
char *data = (char*)ev + sizeof(*ev); ... sscanf(data, "%d", &value);
However, since the nlattr is provided by the user-space program and the nlmsg skb is allocated with GFP_KERNEL instead of GFP_ZERO flag (see netlink_alloc_large_skb() in netlink_sendmsg()), dirty data on the heap can lead to an OOB access for those string handling functions.
By investigating how the bug is introduced, we find it is really interesting as the old version parsing code starting from commit fd7255f51a13 ("[SCSI] iscsi: add sysfs attrs for uspace sync up") treated the nlattr as integer bytes instead of string and had length check in iscsi_copy_param():
if (ev->u.set_param.len != sizeof(uint32_t))
BUG();But, since the commit a54a52caad4b ("[SCSI] iscsi: fixup set/get param functions"), the code treated the nlattr as C string while forgetting to add any strlen checks(), opening the possibility of an OOB access.
Fix the potential OOB by adding the strlen() check before accessing the buf. If the data passes this check, all low-level set_param handlers can safely treat this buf as legal C string.
--- drivers/scsi/scsi_transport_iscsi.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/scsi/scsi_transport_iscsi.c +8 -0
@@ -3007,6 +3007,10 @@ iscsi_if_set_param(struct iscsi_transport *transport, struct iscsi_uevent *ev, uif (!conn || !session)return -EINVAL ; +/* data will be regarded as NULL-ended string, do length check */ +if (strlen (data) > ev->u.set_param.len) +return -EINVAL ; +switch (ev->u.set_param.param) {case ISCSI_PARAM_SESS_RECOVERY_TMO :sscanf (data,"%d" , &value);
@@ -3180,6 +3184,10 @@ iscsi_set_host_param(struct iscsi_transport *transport,return -ENODEV ; } +/* see similar check in iscsi_if_set_param() */ +if (strlen (data) > ev->u.set_host_param.len) +return -EINVAL ; + err = transport->set_host_param (shost, ev->u.set_host_param.param, data, ev->u.set_host_param.len);scsi_host_put (shost);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 221/406 scsi: be2iscsi: Add length check when parsing nlattrs
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin Ma <[email protected]>
[ Upstream commit ee0268f230f66cb472df3424f380ea668da2749a ]
beiscsi_iface_set_param() parses nlattr with nla_for_each_attr and assumes every attributes can be viewed as struct iscsi_iface_param_info.
This is not true because there is no any nla_policy to validate the attributes passed from the upper function iscsi_set_iface_params().
Add the nla_len check before accessing the nlattr data and return EINVAL if the length check fails.
--- drivers/scsi/be2iscsi/be_iscsi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/scsi/be2iscsi/be_iscsi.c +4 -0
@@ -450,6 +450,10 @@ int beiscsi_iface_set_param(struct Scsi_Host *shost, }nla_for_each_attr (attrib, data, dt_len, rm_len) { +/* ignore nla_type as it is never used */ +if (nla_len (attrib) <sizeof (*iface_param)) +return -EINVAL ; + iface_param =nla_data (attrib);if (iface_param->param_type !=ISCSI_NET_PARAM )
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 222/406 scsi: qla4xxx: Add length check when parsing nlattrs
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin Ma <[email protected]>
[ Upstream commit 47cd3770e31df942e2bb925a9a855c79ed0662eb ]
There are three places that qla4xxx parses nlattrs:
- qla4xxx_set_chap_entry()
- qla4xxx_iface_set_param()
- qla4xxx_sysfs_ddb_set_param()
and each of them directly converts the nlattr to specific pointer of structure without length checking. This could be dangerous as those attributes are not validated and a malformed nlattr (e.g., length 0) could result in an OOB read that leaks heap dirty data.
Add the nla_len check before accessing the nlattr data and return EINVAL if the length check fails.
--- drivers/scsi/qla4xxx/ql4_os.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/scsi/qla4xxx/ql4_os.c +15 -0
@@ -973,6 +973,11 @@ static int qla4xxx_set_chap_entry(struct Scsi_Host *shost, void *data, int len)memset (&chap_rec,0 ,sizeof (chap_rec));nla_for_each_attr (attr, data, len, rem) { +if (nla_len (attr) <sizeof (*param_info)) { + rc = -EINVAL ; + goto exit_set_chap; + } + param_info =nla_data (attr);switch (param_info->param) {
@@ -2755,6 +2760,11 @@ qla4xxx_iface_set_param(struct Scsi_Host *shost, void *data, uint32_t len) }nla_for_each_attr (attr, data, len, rem) { +if (nla_len (attr) <sizeof (*iface_param)) { + rval = -EINVAL ; + goto exit_init_fw_cb; + } + iface_param =nla_data (attr);if (iface_param->param_type ==ISCSI_NET_PARAM ) {
@@ -8119,6 +8129,11 @@ qla4xxx_sysfs_ddb_set_param(struct iscsi_bus_flash_session *fnode_sess,memset ((void *)&chap_tbl,0 ,sizeof (chap_tbl));nla_for_each_attr (attr, data, len, rem) { +if (nla_len (attr) <sizeof (*fnode_param)) { + rc = -EINVAL ; + goto exit_set_param; + } + fnode_param =nla_data (attr);switch (fnode_param->param) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 223/406 serial: sprd: Assign sprd_port after initialized to avoid wrong access
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chunyan Zhang <[email protected]>
[ Upstream commit f9608f1887568b728839d006024585ab02ef29e5 ]
The global pointer 'sprd_port' may not zero when sprd_probe returns failure, that is a risk for sprd_port to be accessed afterward, and may lead to unexpected errors.
For example:
There are two UART ports, UART1 is used for console and configured in kernel command line, i.e. "console=";
The UART1 probe failed and the memory allocated to sprd_port[1] was released, but sprd_port[1] was not set to NULL;
In UART2 probe, the same virtual address was allocated to sprd_port[2], and UART2 probe process finally will go into sprd_console_setup() to register UART1 as console since it is configured as preferred console (filled to console_cmdline[]), but the console parameters (sprd_port[1]) belong to UART2.
So move the sprd_port[] assignment to where the port already initialized can avoid the above issue.
--- drivers/tty/serial/sprd_serial.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
drivers/tty/serial/sprd_serial.c +17 -8
@@ -1133,7 +1133,7 @@ static bool sprd_uart_is_console(struct uart_port *uport)static int sprd_clk_init (struct uart_port *uport) {struct clk *clk_uart, *clk_parent; -struct sprd_uart_port *u = sprd_port[uport->line]; + struct sprd_uart_port *u = container_of(uport, struct sprd_uart_port, port); clk_uart =devm_clk_get (uport->dev,"uart" );if (IS_ERR (clk_uart)) {
@@ -1176,22 +1176,22 @@ static int sprd_probe(struct platform_device *pdev) {struct resource *res;struct uart_port *up; +struct sprd_uart_port *sport;int irq;int index;int ret; index =of_alias_get_id (pdev->dev.of_node,"serial" ); -if (index <0 || index >=ARRAY_SIZE (sprd_port)) { +if (index <0 || index >=UART_NR_MAX ) {dev_err (&pdev->dev,"got a wrong serial alias id %d\n" , index);return -EINVAL ; } - sprd_port[index] =devm_kzalloc (&pdev->dev,sizeof (*sprd_port[index]), -GFP_KERNEL ); -if (!sprd_port[index]) + sport =devm_kzalloc (&pdev->dev,sizeof (*sport),GFP_KERNEL ); +if (!sport)return -ENOMEM ; - up = &sprd_port[index]->port; + up = &sport->port; up->dev = &pdev->dev; up->line = index; up->type =PORT_SPRD ;
@@ -1222,7 +1222,7 @@ static int sprd_probe(struct platform_device *pdev)* Allocate one dma buffer to prepare for receive transfer, in case * memory allocation failure at runtime. */ - ret =sprd_rx_alloc_buf (sprd_port[index]); + ret =sprd_rx_alloc_buf (sport);if (ret)return ret;
@@ -1233,14 +1233,23 @@ static int sprd_probe(struct platform_device *pdev)return ret; } } + sprd_ports_num++; + sprd_port[index] = sport; ret =uart_add_one_port (&sprd_uart_driver, up);if (ret) -sprd_remove (pdev); + goto clean_port;platform_set_drvdata (pdev, up); +return 0 ; + +clean_port: + sprd_port[index] =NULL ; +if (--sprd_ports_num ==0 ) +uart_unregister_driver (&sprd_uart_driver); +sprd_rx_free_buf (sport);return ret; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 224/406 serial: sprd: Fix DMA buffer leak issue
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chunyan Zhang <[email protected]>
[ Upstream commit cd119fdc3ee1450fbf7f78862b5de44c42b6e47f ]
Release DMA buffer when _probe() returns failure to avoid memory leak.
--- drivers/tty/serial/sprd_serial.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/tty/serial/sprd_serial.c +3 -2
@@ -367,7 +367,7 @@ static void sprd_rx_free_buf(struct sprd_uart_port *sp)if (sp->rx_dma.virt)dma_free_coherent (sp->port.dev,SPRD_UART_RX_SIZE , sp->rx_dma.virt, sp->rx_dma.phys_addr); - + sp->rx_dma.virt =NULL ; }static int sprd_rx_dma_config (struct uart_port *port,u32 burst)
@@ -1230,7 +1230,7 @@ static int sprd_probe(struct platform_device *pdev) ret =uart_register_driver (&sprd_uart_driver);if (ret <0 ) {pr_err ("Failed to register SPRD-UART driver\n" ); -return ret; + goto free_rx_buf; } }
@@ -1249,6 +1249,7 @@ static int sprd_probe(struct platform_device *pdev) sprd_port[index] =NULL ;if (--sprd_ports_num ==0 )uart_unregister_driver (&sprd_uart_driver); +free_rx_buf:sprd_rx_free_buf (sport);return ret; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 225/406 x86/APM: drop the duplicate APM_MINOR_DEV macro
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit 4ba2909638a29630a346d6c4907a3105409bee7d ]
This source file already includes <linux/miscdevice.h>, which contains the same macro. It doesn't need to be defined here again.
--- arch/x86/kernel/apm_32.c | 6 ------ 1 file changed, 6 deletions(-)
arch/x86/kernel/apm_32.c +0 -6
@@ -237,12 +237,6 @@extern int (*console_blank_hook)(int );#endif -/* -* The apm_bios device is one of the misc char devices. -* This is its minor number. -*/ -#define APM_MINOR_DEV 134 -/* * Various options can be changed at boot time as follows: * (We allow underscores for compatibility with the modules code)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 226/406 scsi: qedf: Do not touch __user pointer in qedf_dbg_stop_io_on_error_cmd_read() directly
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleksandr Natalenko <[email protected]>
[ Upstream commit 7d3d20dee4f648ec44e9717d5f647d594d184433 ]
The qedf_dbg_stop_io_on_error_cmd_read() function invokes sprintf() directly on a __user pointer, which may crash the kernel.
Avoid doing that by using a small on-stack buffer for scnprintf() and then calling simple_read_from_buffer() which does a proper copy_to_user() call.
--- drivers/scsi/qedf/qedf_debugfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/qedf/qedf_debugfs.c +3 -4
@@ -185,18 +185,17 @@ qedf_dbg_stop_io_on_error_cmd_read(struct file *filp, char __user *buffer, size_t count, loff_t *ppos) { int cnt; +char cbuf[7 ];struct qedf_dbg_ctx *qedf_dbg = (struct qedf_dbg_ctx *)filp->private_data;struct qedf_ctx *qedf =container_of (qedf_dbg, struct qedf_ctx, dbg_ctx);QEDF_INFO (qedf_dbg,QEDF_LOG_DEBUGFS ,"entered\n" ); - cnt =sprintf (buffer,"%s\n" , + cnt =scnprintf (cbuf,sizeof (cbuf),"%s\n" , qedf->stop_io_on_error ?"true" :"false" ); - cnt =min_t (int, count, cnt - *ppos); - *ppos += cnt; -return cnt; +return simple_read_from_buffer (buffer, count, ppos, cbuf, cnt); } static ssize_t
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 227/406 scsi: qedf: Do not touch __user pointer in qedf_dbg_debug_cmd_read() directly
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleksandr Natalenko <[email protected]>
[ Upstream commit 31b5991a9a91ba97237ac9da509d78eec453ff72 ]
The qedf_dbg_debug_cmd_read() function invokes sprintf() directly on a __user pointer, which may crash the kernel.
Avoid doing that by using a small on-stack buffer for scnprintf() and then calling simple_read_from_buffer() which does a proper copy_to_user() call.
--- drivers/scsi/qedf/qedf_debugfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/qedf/qedf_debugfs.c +3 -4
@@ -138,15 +138,14 @@ qedf_dbg_debug_cmd_read(struct file *filp, char __user *buffer, size_t count, loff_t *ppos) {int cnt; +char cbuf[32 ];struct qedf_dbg_ctx *qedf_dbg = (struct qedf_dbg_ctx *)filp->private_data;QEDF_INFO (qedf_dbg,QEDF_LOG_DEBUGFS ,"debug mask=0x%x\n" , qedf_debug); - cnt =sprintf (buffer,"debug mask = 0x%x\n" , qedf_debug); + cnt =scnprintf (cbuf,sizeof (cbuf),"debug mask = 0x%x\n" , qedf_debug); - cnt =min_t (int, count, cnt - *ppos); - *ppos += cnt; -return cnt; +return simple_read_from_buffer (buffer, count, ppos, cbuf, cnt); } static ssize_t
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 228/406 scsi: qedf: Do not touch __user pointer in qedf_dbg_fp_int_cmd_read() directly
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleksandr Natalenko <[email protected]>
[ Upstream commit 25dbc20deab5165f847b4eb42f376f725a986ee8 ]
The qedf_dbg_fp_int_cmd_read() function invokes sprintf() directly on a __user pointer, which may crash the kernel.
Avoid doing that by vmalloc()'ating a buffer for scnprintf() and then calling simple_read_from_buffer() which does a proper copy_to_user() call.
--- drivers/scsi/qedf/qedf_dbg.h | 2 ++ drivers/scsi/qedf/qedf_debugfs.c | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-)
drivers/scsi/qedf/qedf_dbg.h +2 -0
@@ -60,6 +60,8 @@ extern uint qedf_debug;#define QEDF_LOG_NOTICE 0x40000000/* Notice logs */ #define QEDF_LOG_WARN 0x80000000/* Warning logs */ +#define QEDF_DEBUGFS_LOG_LEN (2 * PAGE_SIZE) +/* Debug context structure */ struct qedf_dbg_ctx {unsigned int host_no;
drivers/scsi/qedf/qedf_debugfs.c +15 -6
@@ -8,6 +8,7 @@#include <linux/uaccess.h> #include <linux/debugfs.h> #include <linux/module.h> +#include <linux/vmalloc.h> #include "qedf.h" #include "qedf_dbg.h"
@@ -98,7 +99,9 @@ static ssize_t qedf_dbg_fp_int_cmd_read(struct file *filp, char __user *buffer, size_t count, loff_t *ppos) { + ssize_t ret;size_t cnt =0 ; +char *cbuf;int id;struct qedf_fastpath *fp =NULL ; struct qedf_dbg_ctx *qedf_dbg =
@@ -108,19 +111,25 @@ qedf_dbg_fp_int_cmd_read(struct file *filp, char __user *buffer, size_t count,QEDF_INFO (qedf_dbg,QEDF_LOG_DEBUGFS ,"entered\n" ); - cnt =sprintf (buffer,"\nFastpath I/O completions\n\n" ); + cbuf =vmalloc (QEDF_DEBUGFS_LOG_LEN ); +if (!cbuf) +return 0 ; + + cnt +=scnprintf (cbuf + cnt,QEDF_DEBUGFS_LOG_LEN - cnt,"\nFastpath I/O completions\n\n" );for (id =0 ; id < qedf->num_queues; id++) { fp = &(qedf->fp_array[id]);if (fp->sb_id ==QEDF_SB_ID_NULL )continue ; - cnt +=sprintf ((buffer + cnt),"#%d: %lu\n" , id, - fp->completions); + cnt +=scnprintf (cbuf + cnt,QEDF_DEBUGFS_LOG_LEN - cnt, +"#%d: %lu\n" , id, fp->completions); } - cnt =min_t (int, count, cnt - *ppos); - *ppos += cnt; -return cnt; + ret =simple_read_from_buffer (buffer, count, ppos, cbuf, cnt); + +vfree (cbuf); + +return ret; } static ssize_t
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 229/406 coresight: tmc: Explicit type conversions to prevent integer overflow
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruidong Tian <[email protected]>
[ Upstream commit fd380097cdb305582b7a1f9476391330299d2c59 ]
Perf cs_etm session executed unexpectedly when AUX buffer > 1G.
perf record -C 0 -m ,2G -e cs_etm// -- <workload> [ perf record: Captured and wrote 2.615 MB perf.data ]
Perf only collect about 2M perf data rather than 2G. This is becasuse the operation, "nr_pages << PAGE_SHIFT", in coresight tmc driver, will overflow when nr_pages >= 0x80000(correspond to 1G AUX buffer). The overflow cause buffer allocation to fail, and TMC driver will alloc minimal buffer size(1M). You can just get about 2M perf data(1M AUX buffer + perf data header) at least.
Explicit convert nr_pages to 64 bit to avoid overflow.
--- drivers/hwtracing/coresight/coresight-tmc-etf.c | 2 +- drivers/hwtracing/coresight/coresight-tmc-etr.c | 5 +++-- drivers/hwtracing/coresight/coresight-tmc.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-)
drivers/hwtracing/coresight/coresight-tmc-etf.c +1 -1
@@ -426,7 +426,7 @@ static int tmc_set_etf_buffer(struct coresight_device *csdev,return -EINVAL ;/* wrap head around to the amount of space we have */ - head = handle->head & ((buf->nr_pages <<PAGE_SHIFT ) -1 ); + head = handle->head & (((unsigned long )buf->nr_pages <<PAGE_SHIFT ) -1 );/* find the page to write to */ buf->cur = head /PAGE_SIZE ;
drivers/hwtracing/coresight/coresight-tmc-etr.c +3 -2
@@ -47,7 +47,8 @@ struct etr_perf_buffer { };/* Convert the perf index to an offset within the ETR buffer */ -#define PERF_IDX2OFF (idx, buf) ((idx) % ((buf)->nr_pages << PAGE_SHIFT)) +#define PERF_IDX2OFF (idx, buf) \ + ((idx) % ((unsigned long)(buf)->nr_pages << PAGE_SHIFT))/* Lower limit for ETR hardware buffer */ #define TMC_ETR_PERF_MIN_BUF_SIZE SZ_1M
@@ -1232,7 +1233,7 @@ alloc_etr_buf(struct tmc_drvdata *drvdata, struct perf_event *event,* than the size requested via sysfs. */ if ((nr_pages <<PAGE_SHIFT ) > drvdata->size) { - etr_buf =tmc_alloc_etr_buf (drvdata, (nr_pages <<PAGE_SHIFT ), + etr_buf =tmc_alloc_etr_buf (drvdata, ((ssize_t )nr_pages <<PAGE_SHIFT ),0 , node,NULL );if (!IS_ERR (etr_buf)) goto done;
drivers/hwtracing/coresight/coresight-tmc.h +1 -1
@@ -321,7 +321,7 @@ ssize_t tmc_sg_table_get_data(struct tmc_sg_table *sg_table,static inline unsigned long tmc_sg_table_buf_size (struct tmc_sg_table *sg_table) { -return sg_table->data_pages.nr_pages <<PAGE_SHIFT ; +return (unsigned long )sg_table->data_pages.nr_pages <<PAGE_SHIFT ; }struct coresight_device *tmc_etr_get_catu_device (struct tmc_drvdata *drvdata);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 230/406 dma-buf/sync_file: Fix docs syntax
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <[email protected]>
[ Upstream commit 05d56d8079d510a2994039470f65bea85f0075ee ]
Fixes the warning:
include/uapi/linux/sync_file.h:77: warning: Function parameter or member 'num_fences' not described in 'sync_file_info'
--- include/uapi/linux/sync_file.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/sync_file.h +1 -1
@@ -52,7 +52,7 @@ struct sync_fence_info {* @name: name of fence * @status: status of fence. 1: signaled 0:active <0:error * @flags: sync_file_info flags -* @num_fences number of fences in the sync_file +* @num_fences: number of fences in the sync_file * @pad: padding for 64-bit alignment, should always be zero * @sync_fence_info: pointer to array of structs sync_fence_info with all * fences in the sync_file
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 231/406 driver core: test_async: fix an error code
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 22d2381bbd70a5853c2ee77522f4965139672db9 ]
The test_platform_device_register_node() function should return error pointers instead of NULL. That is what the callers are expecting.
--- drivers/base/test/test_async_driver_probe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/test/test_async_driver_probe.c +1 -1
@@ -84,7 +84,7 @@ test_platform_device_register_node(char *name, int id, int nid) pdev =platform_device_alloc (name, id);if (!pdev) -return NULL ; +return ERR_PTR (-ENOMEM );if (nid !=NUMA_NO_NODE )set_dev_node (&pdev->dev, nid);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 232/406 IB/uverbs: Fix an potential error pointer dereference
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Yang <[email protected]>
[ Upstream commit 26b7d1a27167e7adf75b150755e05d2bc123ce55 ]
smatch reports the warning below:drivers/infiniband/core/uverbs_std_types_counters.c:110 ib_uverbs_handler_UVERBS_METHOD_COUNTERS_READ() error: 'uattr' dereferencing possible ERR_PTR()
The return value of uattr maybe ERR_PTR(-ENOENT), fix this by checking the value of uattr before using it.
--- drivers/infiniband/core/uverbs_std_types_counters.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/core/uverbs_std_types_counters.c +2 -0
@@ -108,6 +108,8 @@ static int UVERBS_HANDLER(UVERBS_METHOD_COUNTERS_READ)(return ret; uattr =uverbs_attr_get (attrs,UVERBS_ATTR_READ_COUNTERS_BUFF ); +if (IS_ERR (uattr)) +return PTR_ERR (uattr); read_attr.ncounters = uattr->ptr_attr.len /sizeof (u64); read_attr.counters_buff =uverbs_zalloc ( attrs,array_size (read_attr.ncounters,sizeof (u64)));
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 233/406 fsi: aspeed: Reset master errors after CFAM reset
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eddie James <[email protected]>
[ Upstream commit 52300909f4670ac552bfeb33c1355b896eac8c06 ]
It has been observed that sometimes the FSI master will return all 0xffs after a CFAM has been taken out of reset, without presenting any error. Resetting the FSI master errors resolves the issue.
--- drivers/fsi/fsi-master-aspeed.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/fsi/fsi-master-aspeed.c +2 -0
@@ -445,6 +445,8 @@ static ssize_t cfam_reset_store(struct device *dev, struct device_attribute *attgpiod_set_value (aspeed->cfam_reset_gpio,1 );usleep_range (900 ,1000 );gpiod_set_value (aspeed->cfam_reset_gpio,0 ); +usleep_range (900 ,1000 ); +opb_writel (aspeed, ctrl_base +FSI_MRESP0 ,cpu_to_be32 (FSI_MRESP_RST_ALL_MASTER ));mutex_unlock (&aspeed->lock);return count;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 234/406 iommu/qcom: Disable and reset context bank before programming
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 9f3fef23d9b5a858a6e6d5f478bb1b6b76265e76 ]
Writing the new TTBRs, TCRs and MAIRs on a previously enabled
context bank may trigger a context fault, resulting in firmware driven AP resets: change the domain initialization programming sequence to disable the context bank(s) and to also clear the related fault address (CB_FAR) and fault status (CB_FSR) registers before writing new values to TTBR0/1, TCR/TCR2, MAIR0/1.
--- drivers/iommu/arm/arm-smmu/qcom_iommu.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/iommu/arm/arm-smmu/qcom_iommu.c +7 -0
@@ -283,6 +283,13 @@ static int qcom_iommu_init_domain(struct iommu_domain *domain, ctx->secure_init = true; } +/* Disable context bank before programming */ +iommu_writel (ctx,ARM_SMMU_CB_SCTLR ,0 ); + +/* Clear context bank fault address fault status registers */ +iommu_writel (ctx,ARM_SMMU_CB_FAR ,0 ); +iommu_writel (ctx,ARM_SMMU_CB_FSR ,ARM_SMMU_FSR_FAULT ); +/* TTBRs */ iommu_writeq(ctx, ARM_SMMU_CB_TTBR0, pgtbl_cfg.arm_lpae_s1_cfg.ttbr |
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 235/406 iommu/vt-d: Fix to flush cache of PASID directory table
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yanfei Xu <[email protected]>
[ Upstream commit 8a3b8e63f8371c1247b7aa24ff9c5312f1a6948b ]
Even the PCI devices don't support pasid capability, PASID table is mandatory for a PCI device in scalable mode. However flushing cache of pasid directory table for these devices are not taken after pasid table is allocated as the "size" of table is zero. Fix it by calculating the size by page order.
Found this when reading the code, no real problem encountered for now.
--- drivers/iommu/intel/pasid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel/pasid.c +1 -1
@@ -187,7 +187,7 @@ int intel_pasid_alloc_table(struct device *dev)device_attach_pasid_table (info, pasid_table);if (!ecap_coherent (info->iommu->ecap)) -clflush_cache_range (pasid_table->table, size); +clflush_cache_range (pasid_table->table, (1 << order) *PAGE_SIZE );return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 236/406 media: go7007: Remove redundant if statement
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit f33cb49081da0ec5af0888f8ecbd566bd326eed1 ]
The if statement that compares msgs[i].len != 3 is always false because it is in a code block where msg[i].len is equal to 3. The check is redundant and can be removed.
As detected by cppcheck static analysis:drivers/media/usb/go7007/go7007-i2c.c:168:20: warning: Opposite inner 'if' condition leads to a dead code block. [oppositeInnerCondition]
--- drivers/media/usb/go7007/go7007-i2c.c | 2 -- 1 file changed, 2 deletions(-)
drivers/media/usb/go7007/go7007-i2c.c +0 -2
@@ -165,8 +165,6 @@ static int go7007_i2c_master_xfer(struct i2c_adapter *adapter, }else if (msgs[i].len ==3 ) {if (msgs[i].flags &I2C_M_RD )return -EIO ; -if (msgs[i].len !=3 ) -return -EIO ;if (go7007_i2c_xfer (go, msgs[i].addr,0 , (msgs[i].buf[0 ] <<8 ) | msgs[i].buf[1 ],0x01 , &msgs[i].buf[2 ]) <0 )
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 237/406 USB: gadget: f_mass_storage: Fix unused variable warning
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
[ Upstream commit 55c3e571d2a0aabef4f1354604443f1c415d2e85 ]
Fix a "variable set but not used" warning in f_mass_storage.c. rc is
used if verbose debugging is enabled but not otherwise.
--- drivers/usb/gadget/function/f_mass_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/function/f_mass_storage.c +1 -1
@@ -951,7 +951,7 @@ static void invalidate_sub(struct fsg_lun *curlun) {struct file *filp = curlun->filp;struct inode *inode =file_inode (filp); -unsigned long rc; +unsigned long __maybe_unused rc; rc =invalidate_mapping_pages (inode->i_mapping,0 ,-1 );VLDBG (curlun,"invalidate_mapping_pages -> %ld\n" , rc);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 238/406 media: ov5640: Enable MIPI interface in ov5640_set_power_mipi()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit 98cb72d3b9c5e03b10fa993752ecfcbd9c572d8c ]
Set OV5640_REG_IO_MIPI_CTRL00 bit 2 to 1 instead of 0, since 1 means MIPI CSI2 interface, while 0 means CPI parallel interface.
In the ov5640_set_power_mipi() the interface should obviously be set to MIPI CSI2 since this functions is used to power up the sensor when operated in MIPI CSI2 mode. The sensor should not be in CPI mode in that case.
This fixes a corner case where capturing the first frame on i.MX8MN with CSI/ISI resulted in corrupted frame.
--- drivers/media/i2c/ov5640.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/i2c/ov5640.c +2 -2
@@ -1942,9 +1942,9 @@ static int ov5640_set_power_mipi(struct ov5640_dev *sensor, bool on)* "ov5640_set_stream_mipi()") * [4] = 0 : Power up MIPI HS Tx * [3] = 0 : Power up MIPI LS Rx -* [2] = 0 : MIPI interface disabled +* [2] = 1 : MIPI interface enabled */ - ret =ov5640_write_reg (sensor,OV5640_REG_IO_MIPI_CTRL00 ,0x40 ); + ret =ov5640_write_reg (sensor,OV5640_REG_IO_MIPI_CTRL00 ,0x44 );if (ret)return ret;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 239/406 media: i2c: ov2680: Set V4L2_CTRL_FLAG_MODIFY_LAYOUT on flips
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Stevenson <[email protected]>
[ Upstream commit 66274280b2c745d380508dc27b9a4dfd736e5eda ]
The driver changes the Bayer order based on the flips, but does not define the control correctly with the V4L2_CTRL_FLAG_MODIFY_LAYOUT flag.
Add the V4L2_CTRL_FLAG_MODIFY_LAYOUT flag.
Stable-dep-of: 7b5a42e6ae71 ("media: ov2680: Remove auto-gain and auto-exposure controls")
--- drivers/media/i2c/ov2680.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/i2c/ov2680.c +2 -0
@@ -966,6 +966,8 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor) ctrls->gain->flags |=V4L2_CTRL_FLAG_VOLATILE ; ctrls->exposure->flags |=V4L2_CTRL_FLAG_VOLATILE ; + ctrls->vflip->flags |=V4L2_CTRL_FLAG_MODIFY_LAYOUT ; + ctrls->hflip->flags |=V4L2_CTRL_FLAG_MODIFY_LAYOUT ;v4l2_ctrl_auto_cluster (2 , &ctrls->auto_gain,0 , true);v4l2_ctrl_auto_cluster (2 , &ctrls->auto_exp,1 , true);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 240/406 media: ov2680: Remove auto-gain and auto-exposure controls
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 7b5a42e6ae71927359ea67a2c22570ba97fa4059 ]
Quoting the OV2680 datasheet:
"3.2 exposure and gain control
In the OV2680, the exposure time and gain are set manually from an external controller. The OV2680 supports manual gain and exposure control only for normal applications, no auto mode."
And indeed testing with the atomisp_ov2680 fork of ov2680.c has shown that auto-exposure and auto-gain do not work.
Note that the code setting the auto-exposure flag was broken, callers of ov2680_exposure_set() were directly passing !!ctrls->auto_exp->val as "bool auto_exp" value, but ctrls->auto_exp is a menu control with:
enum v4l2_exposure_auto_type {
V4L2_EXPOSURE_AUTO = 0,
V4L2_EXPOSURE_MANUAL = 1,
...So instead of passing !!ctrls->auto_exp->val they should have been passing ctrls->auto_exp->val == V4L2_EXPOSURE_AUTO, iow the passed value was inverted of what it should have been.
Also remove ov2680_g_volatile_ctrl() since without auto support the gain and exposure controls are not volatile.
This also fixes the control values not being properly applied in ov2680_mode_set(). The 800x600 mode register-list also sets gain, exposure and vflip overriding the last set ctrl values.
ov2680_mode_set() does call ov2680_gain_set() and ov2680_exposure_set() but did this before writing the mode register-list, so these values would still be overridden by the mode register-list.
Add a v4l2_ctrl_handler_setup() call after writing the mode register-list to restore all ctrl values. Also remove the ctrls->gain->is_new check from ov2680_gain_set() so that the gain always gets restored properly.
Last since ov2680_mode_set() now calls v4l2_ctrl_handler_setup(), remove the v4l2_ctrl_handler_setup() call after ov2680_mode_restore() since ov2680_mode_restore() calls ov2680_mode_set().
--- drivers/media/i2c/ov2680.c | 161 ++++--------------------------------- 1 file changed, 17 insertions(+), 144 deletions(-)
drivers/media/i2c/ov2680.c +17 -144
@@ -85,15 +85,8 @@ struct ov2680_mode_info {struct ov2680_ctrls {struct v4l2_ctrl_handler handler; -struct { -struct v4l2_ctrl *auto_exp; -struct v4l2_ctrl *exposure; - }; -struct { -struct v4l2_ctrl *auto_gain; -struct v4l2_ctrl *gain; - }; - +struct v4l2_ctrl *exposure; +struct v4l2_ctrl *gain;struct v4l2_ctrl *hflip;struct v4l2_ctrl *vflip;struct v4l2_ctrl *test_pattern;
@@ -143,6 +136,7 @@ static const struct reg_value ov2680_setting_30fps_QUXGA_800_600[] = { {0x380e, 0x02}, {0x380f, 0x84}, {0x3811, 0x04}, {0x3813, 0x04}, {0x3814, 0x31}, {0x3815, 0x31}, {0x3820, 0xc0}, {0x4008, 0x00}, {0x4009, 0x03}, {0x4837, 0x1e}, {0x3501, 0x4e}, {0x3502, 0xe0}, + {0x3503, 0x03}, }; static const struct reg_value ov2680_setting_30fps_720P_1280_720[] = {
@@ -405,69 +399,15 @@ static int ov2680_test_pattern_set(struct ov2680_dev *sensor, int value)return 0 ; } -static int ov2680_gain_set (struct ov2680_dev *sensor,bool auto_gain) -{ -struct ov2680_ctrls *ctrls = &sensor->ctrls; -u32 gain; -int ret; - - ret =ov2680_mod_reg (sensor,OV2680_REG_R_MANUAL ,BIT (1 ), - auto_gain ?0 :BIT (1 )); -if (ret <0 ) -return ret; - -if (auto_gain || !ctrls->gain->is_new) -return 0 ; - - gain = ctrls->gain->val; - - ret =ov2680_write_reg16 (sensor,OV2680_REG_GAIN_PK , gain); - -return 0 ; -} - -static int ov2680_gain_get (struct ov2680_dev *sensor) -{ -u32 gain; -int ret; - - ret =ov2680_read_reg16 (sensor,OV2680_REG_GAIN_PK , &gain); -if (ret) -return ret; - -return gain; -} - -static int ov2680_exposure_set (struct ov2680_dev *sensor,bool auto_exp) +static int ov2680_gain_set (struct ov2680_dev *sensor,u32 gain) { -struct ov2680_ctrls *ctrls = &sensor->ctrls; -u32 exp; -int ret; - - ret =ov2680_mod_reg (sensor,OV2680_REG_R_MANUAL ,BIT (0 ), - auto_exp ?0 :BIT (0 )); -if (ret <0 ) -return ret; - -if (auto_exp || !ctrls->exposure->is_new) -return 0 ; - - exp = (u32 )ctrls->exposure->val; - exp <<=4 ; - -return ov2680_write_reg24 (sensor,OV2680_REG_EXPOSURE_PK_HIGH , exp); +return ov2680_write_reg16 (sensor,OV2680_REG_GAIN_PK , gain); } -static int ov2680_exposure_get (struct ov2680_dev *sensor) +static int ov2680_exposure_set (struct ov2680_dev *sensor,u32 exp) { -int ret; -u32 exp; - - ret =ov2680_read_reg24 (sensor,OV2680_REG_EXPOSURE_PK_HIGH , &exp); -if (ret) -return ret; - -return exp >>4 ; +return ov2680_write_reg24 (sensor,OV2680_REG_EXPOSURE_PK_HIGH , + exp <<4 ); }static int ov2680_stream_enable (struct ov2680_dev *sensor)
@@ -482,33 +422,17 @@ static int ov2680_stream_disable(struct ov2680_dev *sensor)static int ov2680_mode_set (struct ov2680_dev *sensor) { -struct ov2680_ctrls *ctrls = &sensor->ctrls;int ret; - ret =ov2680_gain_set (sensor, false); -if (ret <0 ) -return ret; - - ret =ov2680_exposure_set (sensor, false); + ret =ov2680_load_regs (sensor, sensor->current_mode);if (ret <0 )return ret; - ret =ov2680_load_regs (sensor, sensor->current_mode); +/* Restore value of all ctrls */ + ret =__v4l2_ctrl_handler_setup (&sensor->ctrls.handler);if (ret <0 )return ret; -if (ctrls->auto_gain->val) { - ret =ov2680_gain_set (sensor, true); -if (ret <0 ) -return ret; - } - -if (ctrls->auto_exp->val ==V4L2_EXPOSURE_AUTO ) { - ret =ov2680_exposure_set (sensor, true); -if (ret <0 ) -return ret; - } - sensor->mode_pending_changes = false;return 0 ;
@@ -590,15 +514,10 @@ static int ov2680_s_power(struct v4l2_subdev *sd, int on)else ret =ov2680_power_off (sensor); -mutex_unlock (&sensor->lock); - -if (on && ret ==0 ) { - ret =v4l2_ctrl_handler_setup (&sensor->ctrls.handler); -if (ret <0 ) -return ret; - +if (on && ret ==0 ) ret =ov2680_mode_restore (sensor); - } + +mutex_unlock (&sensor->lock);return ret; }
@@ -793,52 +712,19 @@ static int ov2680_enum_frame_interval(struct v4l2_subdev *sd,return 0 ; } -static int ov2680_g_volatile_ctrl (struct v4l2_ctrl *ctrl) -{ -struct v4l2_subdev *sd =ctrl_to_sd (ctrl); -struct ov2680_dev *sensor =to_ov2680_dev (sd); -struct ov2680_ctrls *ctrls = &sensor->ctrls; -int val; - -if (!sensor->is_enabled) -return 0 ; - -switch (ctrl->id) { -case V4L2_CID_GAIN : - val =ov2680_gain_get (sensor); -if (val <0 ) -return val; - ctrls->gain->val = val; -break ; -case V4L2_CID_EXPOSURE : - val =ov2680_exposure_get (sensor); -if (val <0 ) -return val; - ctrls->exposure->val = val; -break ; - } - -return 0 ; -} -static int ov2680_s_ctrl (struct v4l2_ctrl *ctrl) {struct v4l2_subdev *sd =ctrl_to_sd (ctrl);struct ov2680_dev *sensor =to_ov2680_dev (sd); -struct ov2680_ctrls *ctrls = &sensor->ctrls;if (!sensor->is_enabled)return 0 ;switch (ctrl->id) { -case V4L2_CID_AUTOGAIN : -return ov2680_gain_set (sensor, !!ctrl->val);case V4L2_CID_GAIN : -return ov2680_gain_set (sensor, !!ctrls->auto_gain->val); -case V4L2_CID_EXPOSURE_AUTO : -return ov2680_exposure_set (sensor, !!ctrl->val); +return ov2680_gain_set (sensor, ctrl->val);case V4L2_CID_EXPOSURE : -return ov2680_exposure_set (sensor, !!ctrls->auto_exp->val); +return ov2680_exposure_set (sensor, ctrl->val);case V4L2_CID_VFLIP :if (sensor->is_streaming)return -EBUSY ;
@@ -863,7 +749,6 @@ static int ov2680_s_ctrl(struct v4l2_ctrl *ctrl) }static const struct v4l2_ctrl_ops ov2680_ctrl_ops = { - .g_volatile_ctrl = ov2680_g_volatile_ctrl, .s_ctrl = ov2680_s_ctrl, };
@@ -935,7 +820,7 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor)if (ret <0 )return ret; -v4l2_ctrl_handler_init (hdl,7 ); +v4l2_ctrl_handler_init (hdl,5 ); hdl->lock = &sensor->lock;
@@ -947,16 +832,9 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor)ARRAY_SIZE (test_pattern_menu) -1 , 0, 0, test_pattern_menu); - ctrls->auto_exp =v4l2_ctrl_new_std_menu (hdl, ops, -V4L2_CID_EXPOSURE_AUTO , -V4L2_EXPOSURE_MANUAL ,0 , -V4L2_EXPOSURE_AUTO ); - ctrls->exposure =v4l2_ctrl_new_std (hdl, ops,V4L2_CID_EXPOSURE ,0 ,32767 ,1 ,0 ); - ctrls->auto_gain =v4l2_ctrl_new_std (hdl, ops,V4L2_CID_AUTOGAIN , -0 ,1 ,1 ,1 ); ctrls->gain =v4l2_ctrl_new_std (hdl, ops,V4L2_CID_GAIN ,0 ,2047 ,1 ,0 );if (hdl->error) {
@@ -964,14 +842,9 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor) goto cleanup_entity; } - ctrls->gain->flags |=V4L2_CTRL_FLAG_VOLATILE ; - ctrls->exposure->flags |=V4L2_CTRL_FLAG_VOLATILE ; ctrls->vflip->flags |=V4L2_CTRL_FLAG_MODIFY_LAYOUT ; ctrls->hflip->flags |=V4L2_CTRL_FLAG_MODIFY_LAYOUT ; -v4l2_ctrl_auto_cluster (2 , &ctrls->auto_gain,0 , true); -v4l2_ctrl_auto_cluster (2 , &ctrls->auto_exp,1 , true); - sensor->sd.ctrl_handler = hdl; ret =v4l2_async_register_subdev (&sensor->sd);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 241/406 media: ov2680: Fix ov2680_bayer_order()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 50a7bad4e0a37d7018ab6fe843dd84bc6b2ecf72 ]
The index into ov2680_hv_flip_bayer_order[] should be 0-3, but ov2680_bayer_order() was using 0 + BIT(2) + (BIT(2) << 1) as max index, while the intention was to use: 0 + 1 + 2 as max index.
Fix the index calculation in ov2680_bayer_order(), while at it also just use the ctrl values rather then reading them back using a slow i2c-read transaction.
This also allows making the function void, since there now are no more i2c-reads to error check.
Note the check for the ctrls being NULL is there to allow adding an ov2680_fill_format() helper later, which will call ov2680_set_bayer_order() during probe() before the ctrls are created.
[Sakari Ailus: Change all users of ov2680_set_bayer_order() here]
--- drivers/media/i2c/ov2680.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-)
drivers/media/i2c/ov2680.c +14 -19
@@ -315,26 +315,17 @@ static void ov2680_power_down(struct ov2680_dev *sensor)usleep_range (5000 ,10000 ); } -static int ov2680_bayer_order (struct ov2680_dev *sensor) +static void ov2680_set_bayer_order (struct ov2680_dev *sensor) { -u32 format1; -u32 format2; -u32 hv_flip; -int ret; - - ret =ov2680_read_reg (sensor,OV2680_REG_FORMAT1 , &format1); -if (ret <0 ) -return ret; +int hv_flip =0 ; - ret =ov2680_read_reg (sensor,OV2680_REG_FORMAT2 , &format2); -if (ret <0 ) -return ret; +if (sensor->ctrls.vflip && sensor->ctrls.vflip->val) + hv_flip +=1 ; - hv_flip = (format2 &BIT (2 ) <<1 ) | (format1 &BIT (2 )); +if (sensor->ctrls.hflip && sensor->ctrls.hflip->val) + hv_flip +=2 ; sensor->fmt.code = ov2680_hv_flip_bayer_order[hv_flip]; - -return 0 ; }static int ov2680_vflip_enable (struct ov2680_dev *sensor)
@@ -345,7 +336,8 @@ static int ov2680_vflip_enable(struct ov2680_dev *sensor)if (ret <0 )return ret; -return ov2680_bayer_order (sensor); +ov2680_set_bayer_order (sensor); +return 0 ; }static int ov2680_vflip_disable (struct ov2680_dev *sensor)
@@ -356,7 +348,8 @@ static int ov2680_vflip_disable(struct ov2680_dev *sensor)if (ret <0 )return ret; -return ov2680_bayer_order (sensor); +ov2680_set_bayer_order (sensor); +return 0 ; }static int ov2680_hflip_enable (struct ov2680_dev *sensor)
@@ -367,7 +360,8 @@ static int ov2680_hflip_enable(struct ov2680_dev *sensor)if (ret <0 )return ret; -return ov2680_bayer_order (sensor); +ov2680_set_bayer_order (sensor); +return 0 ; }static int ov2680_hflip_disable (struct ov2680_dev *sensor)
@@ -378,7 +372,8 @@ static int ov2680_hflip_disable(struct ov2680_dev *sensor)if (ret <0 )return ret; -return ov2680_bayer_order (sensor); +ov2680_set_bayer_order (sensor); +return 0 ; }static int ov2680_test_pattern_set (struct ov2680_dev *sensor,int value)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 242/406 media: ov2680: Fix vflip / hflip set functions
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit d5d08ad330c9ccebc5e066fda815423a290f48b0 ]
ov2680_vflip_disable() / ov2680_hflip_disable() pass BIT(0) instead of 0 as value to ov2680_mod_reg().
While fixing this also:
1. Stop having separate enable/disable functions for hflip / vflip
2. Move the is_streaming check, which is unique to hflip / vflip into the ov2680_set_?flip() functions.
for a nice code cleanup.
--- drivers/media/i2c/ov2680.c | 50 +++++++++----------------------------- 1 file changed, 12 insertions(+), 38 deletions(-)
drivers/media/i2c/ov2680.c +12 -38
@@ -328,23 +328,15 @@ static void ov2680_set_bayer_order(struct ov2680_dev *sensor) sensor->fmt.code = ov2680_hv_flip_bayer_order[hv_flip]; } -static int ov2680_vflip_enable (struct ov2680_dev *sensor) +static int ov2680_set_vflip (struct ov2680_dev *sensor,s32 val) {int ret; - ret =ov2680_mod_reg (sensor,OV2680_REG_FORMAT1 ,BIT (2 ),BIT (2 )); -if (ret <0 ) -return ret; - -ov2680_set_bayer_order (sensor); -return 0 ; -} - -static int ov2680_vflip_disable (struct ov2680_dev *sensor) -{ -int ret; +if (sensor->is_streaming) +return -EBUSY ; - ret =ov2680_mod_reg (sensor,OV2680_REG_FORMAT1 ,BIT (2 ),BIT (0 )); + ret =ov2680_mod_reg (sensor,OV2680_REG_FORMAT1 , +BIT (2 ), val ?BIT (2 ) :0 );if (ret <0 )return ret;
@@ -352,23 +344,15 @@ static int ov2680_vflip_disable(struct ov2680_dev *sensor)return 0 ; } -static int ov2680_hflip_enable (struct ov2680_dev *sensor) +static int ov2680_set_hflip (struct ov2680_dev *sensor,s32 val) {int ret; - ret =ov2680_mod_reg (sensor,OV2680_REG_FORMAT2 ,BIT (2 ),BIT (2 )); -if (ret <0 ) -return ret; - -ov2680_set_bayer_order (sensor); -return 0 ; -} - -static int ov2680_hflip_disable (struct ov2680_dev *sensor) -{ -int ret; +if (sensor->is_streaming) +return -EBUSY ; - ret =ov2680_mod_reg (sensor,OV2680_REG_FORMAT2 ,BIT (2 ),BIT (0 )); + ret =ov2680_mod_reg (sensor,OV2680_REG_FORMAT2 , +BIT (2 ), val ?BIT (2 ) :0 );if (ret <0 )return ret;
@@ -721,19 +705,9 @@ static int ov2680_s_ctrl(struct v4l2_ctrl *ctrl)case V4L2_CID_EXPOSURE :return ov2680_exposure_set (sensor, ctrl->val);case V4L2_CID_VFLIP : -if (sensor->is_streaming) -return -EBUSY ; -if (ctrl->val) -return ov2680_vflip_enable (sensor); -else -return ov2680_vflip_disable (sensor); +return ov2680_set_vflip (sensor, ctrl->val);case V4L2_CID_HFLIP : -if (sensor->is_streaming) -return -EBUSY ; -if (ctrl->val) -return ov2680_hflip_enable (sensor); -else -return ov2680_hflip_disable (sensor); +return ov2680_set_hflip (sensor, ctrl->val);case V4L2_CID_TEST_PATTERN :return ov2680_test_pattern_set (sensor, ctrl->val);default :
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 243/406 media: ov2680: Fix regulators being left enabled on ov2680_power_on() errors
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 84b4bd7e0d98166aa32fd470e672721190492eae ]
When the ov2680_power_on() "sensor soft reset failed" path is hit during probe() the WARN() about putting an enabled regulator at drivers/regulator/core.c:2398 triggers 3 times (once for each regulator), filling dmesg with backtraces.
Fix this by properly disabling the regulators on ov2680_power_on() errors.
--- drivers/media/i2c/ov2680.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/media/i2c/ov2680.c +6 -2
@@ -459,7 +459,7 @@ static int ov2680_power_on(struct ov2680_dev *sensor) ret =ov2680_write_reg (sensor,OV2680_REG_SOFT_RESET ,0x01 );if (ret !=0 ) {dev_err (dev,"sensor soft reset failed\n" ); -return ret; + goto err_disable_regulators; }usleep_range (1000 ,2000 ); }else {
@@ -469,7 +469,7 @@ static int ov2680_power_on(struct ov2680_dev *sensor) ret =clk_prepare_enable (sensor->xvclk);if (ret <0 ) -return ret; + goto err_disable_regulators; sensor->is_enabled = true;
@@ -479,6 +479,10 @@ static int ov2680_power_on(struct ov2680_dev *sensor)ov2680_stream_disable (sensor);return 0 ; + +err_disable_regulators: +regulator_bulk_disable (OV2680_NUM_SUPPLIES , sensor->supplies); +return ret; }static int ov2680_s_power (struct v4l2_subdev *sd,int on)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 244/406 cgroup:namespace: Remove unused cgroup_namespaces_init()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lu Jialin <[email protected]>
[ Upstream commit 82b90b6c5b38e457c7081d50dff11ecbafc1e61a ]
cgroup_namspace_init() just return 0. Therefore, there is no need to call it during start_kernel. Just remove it.
--- kernel/cgroup/namespace.c | 6 ------ 1 file changed, 6 deletions(-)
kernel/cgroup/namespace.c +0 -6
@@ -149,9 +149,3 @@ const struct proc_ns_operations cgroupns_operations = { .install = cgroupns_install, .owner = cgroupns_owner, }; - -static __init int cgroup_namespaces_init (void ) -{ -return 0 ; -} -subsys_initcall (cgroup_namespaces_init);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 245/406 scsi: core: Use 32-bit hostnum in scsi_host_lookup()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Battersby <[email protected]>
[ Upstream commit 62ec2092095b678ff89ce4ba51c2938cd1e8e630 ]
Change scsi_host_lookup() hostnum argument type from unsigned short to unsigned int to match the type used everywhere else.
--- drivers/scsi/hosts.c | 4 ++-- include/scsi/scsi_host.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/hosts.c +2 -2
@@ -522,7 +522,7 @@ EXPORT_SYMBOL(scsi_host_alloc);static int __scsi_host_match (struct device *dev,const void *data) {struct Scsi_Host *p; -const unsigned short *hostnum = data; +const unsigned int *hostnum = data; p =class_to_shost (dev);return p->host_no == *hostnum;
@@ -539,7 +539,7 @@ static int __scsi_host_match(struct device *dev, const void *data)* that scsi_host_get() took. The put_device() below dropped * the reference from class_find_device(). **/ -struct Scsi_Host *scsi_host_lookup (unsigned short hostnum) +struct Scsi_Host *scsi_host_lookup (unsigned int hostnum) {struct device *cdev;struct Scsi_Host *shost =NULL ;
include/scsi/scsi_host.h +1 -1
@@ -745,7 +745,7 @@ extern void scsi_remove_host(struct Scsi_Host *);extern struct Scsi_Host *scsi_host_get (struct Scsi_Host *);extern int scsi_host_busy (struct Scsi_Host *shost);extern void scsi_host_put (struct Scsi_Host *t); -extern struct Scsi_Host *scsi_host_lookup (unsigned short ); +extern struct Scsi_Host *scsi_host_lookup (unsigned int hostnum);extern const char *scsi_host_state_name (enum scsi_host_state );extern void scsi_host_complete_all_commands (struct Scsi_Host *shost,int status);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 246/406 scsi: fcoe: Fix potential deadlock on &fip->ctlr_lock
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengfeng Ye <[email protected]>
[ Upstream commit 1a1975551943f681772720f639ff42fbaa746212 ]
There is a long call chain that &fip->ctlr_lock is acquired by isr fnic_isr_msix_wq_copy() under hard IRQ context. Thus other process context code acquiring the lock should disable IRQ, otherwise deadlock could happen if the IRQ preempts the execution while the lock is held in process context on the same CPU.
[ISR]fnic_isr_msix_wq_copy()
-> fnic_wq_copy_cmpl_handler()
-> fnic_fcpio_cmpl_handler()
-> fnic_fcpio_flogi_reg_cmpl_handler()
-> fnic_flush_tx()
-> fnic_send_frame()
-> fcoe_ctlr_els_send()
-> spin_lock_bh(&fip->ctlr_lock)
[Process Context]
1. fcoe_ctlr_timer_work()
-> fcoe_ctlr_flogi_send()
-> spin_lock_bh(&fip->ctlr_lock)
2. fcoe_ctlr_recv_work()
-> fcoe_ctlr_recv_handler()
-> fcoe_ctlr_recv_els()
-> fcoe_ctlr_announce()
-> spin_lock_bh(&fip->ctlr_lock)
3. fcoe_ctlr_recv_work()
-> fcoe_ctlr_recv_handler()
-> fcoe_ctlr_recv_els()
-> fcoe_ctlr_flogi_retry()
-> spin_lock_bh(&fip->ctlr_lock)
4. -> fcoe_xmit()
-> fcoe_ctlr_els_send()
-> spin_lock_bh(&fip->ctlr_lock)
spin_lock_bh() is not enough since fnic_isr_msix_wq_copy() is a hardirq.
These flaws were found by an experimental static analysis tool I am developing for irq-related deadlock.
The patch fix the potential deadlocks by spin_lock_irqsave() to disable hard irq.
--- drivers/scsi/fcoe/fcoe_ctlr.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/scsi/fcoe/fcoe_ctlr.c +12 -8
@@ -319,16 +319,17 @@ static void fcoe_ctlr_announce(struct fcoe_ctlr *fip) {struct fcoe_fcf *sel;struct fcoe_fcf *fcf; +unsigned long flags;mutex_lock (&fip->ctlr_mutex); -spin_lock_bh (&fip->ctlr_lock); +spin_lock_irqsave (&fip->ctlr_lock, flags);kfree_skb (fip->flogi_req); fip->flogi_req =NULL ;list_for_each_entry (fcf, &fip->fcfs, list) fcf->flogi_sent =0 ; -spin_unlock_bh (&fip->ctlr_lock); +spin_unlock_irqrestore (&fip->ctlr_lock, flags); sel = fip->sel_fcf;if (sel &ðer_addr_equal (sel->fcf_mac, fip->dest_addr))
@@ -699,6 +700,7 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr *fip, struct fc_lport *lport, {struct fc_frame *fp;struct fc_frame_header *fh; +unsigned long flags;u16 old_xid;u8 op;u8 mac[ETH_ALEN ];
@@ -732,11 +734,11 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr *fip, struct fc_lport *lport, op =FIP_DT_FLOGI ;if (fip->mode ==FIP_MODE_VN2VN )break ; -spin_lock_bh (&fip->ctlr_lock); +spin_lock_irqsave (&fip->ctlr_lock, flags);kfree_skb (fip->flogi_req); fip->flogi_req = skb; fip->flogi_req_send =1 ; -spin_unlock_bh (&fip->ctlr_lock); +spin_unlock_irqrestore (&fip->ctlr_lock, flags);schedule_work (&fip->timer_work);return -EINPROGRESS ;case ELS_FDISC :
@@ -1713,10 +1715,11 @@ static int fcoe_ctlr_flogi_send_locked(struct fcoe_ctlr *fip)static int fcoe_ctlr_flogi_retry (struct fcoe_ctlr *fip) {struct fcoe_fcf *fcf; +unsigned long flags;int error;mutex_lock (&fip->ctlr_mutex); -spin_lock_bh (&fip->ctlr_lock); +spin_lock_irqsave (&fip->ctlr_lock, flags);LIBFCOE_FIP_DBG (fip,"re-sending FLOGI - reselect\n" ); fcf =fcoe_ctlr_select (fip);if (!fcf || fcf->flogi_sent) {
@@ -1727,7 +1730,7 @@ static int fcoe_ctlr_flogi_retry(struct fcoe_ctlr *fip)fcoe_ctlr_solicit (fip,NULL ); error =fcoe_ctlr_flogi_send_locked (fip); } -spin_unlock_bh (&fip->ctlr_lock); +spin_unlock_irqrestore (&fip->ctlr_lock, flags);mutex_unlock (&fip->ctlr_mutex);return error; }
@@ -1744,8 +1747,9 @@ static int fcoe_ctlr_flogi_retry(struct fcoe_ctlr *fip)static void fcoe_ctlr_flogi_send (struct fcoe_ctlr *fip) {struct fcoe_fcf *fcf; +unsigned long flags; -spin_lock_bh (&fip->ctlr_lock); +spin_lock_irqsave (&fip->ctlr_lock, flags); fcf = fip->sel_fcf;if (!fcf || !fip->flogi_req_send) goto unlock;
@@ -1772,7 +1776,7 @@ static void fcoe_ctlr_flogi_send(struct fcoe_ctlr *fip) }else /* XXX */ LIBFCOE_FIP_DBG (fip,"No FCF selected - defer send\n" ); unlock: -spin_unlock_bh (&fip->ctlr_lock); +spin_unlock_irqrestore (&fip->ctlr_lock, flags); }/**
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 247/406 serial: tegra: handle clk prepare error in tegra_uart_hw_init()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yi Yang <[email protected]>
[ Upstream commit 5abd01145d0cc6cd1b7c2fe6ee0b9ea0fa13671e ]
In tegra_uart_hw_init(), the return value of clk_prepare_enable() should be checked since it might fail.
--- drivers/tty/serial/serial-tegra.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/tty/serial/serial-tegra.c +5 -1
@@ -994,7 +994,11 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup) tup->ier_shadow =0 ; tup->current_baud =0 ; -clk_prepare_enable (tup->uart_clk); + ret =clk_prepare_enable (tup->uart_clk); +if (ret) { +dev_err (tup->uport.dev,"could not enable clk\n" ); +return ret; + }/* Reset the UART controller to clear all previous status.*/ reset_control_assert (tup->rst);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 248/406 amba: bus: fix refcount leak
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit e312cbdc11305568554a9e18a2ea5c2492c183f3 ]
commit 5de1540b7bc4 ("drivers/amba: create devices from device tree") increases the refcount of of_node, but not releases it in amba_device_release, so there is refcount leak. By using of_node_put to avoid refcount leak.
--- drivers/amba/bus.c | 1 + 1 file changed, 1 insertion(+)
drivers/amba/bus.c +1 -0
@@ -363,6 +363,7 @@ static void amba_device_release(struct device *dev) {struct amba_device *d =to_amba_device (dev); +of_node_put (d->dev.of_node);if (d->res.parent)release_resource (&d->res);kfree (d);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 249/406 Revert "IB/isert: Fix incorrect release of isert connection"
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
[ Upstream commit dfe261107c080709459c32695847eec96238852b ]
Commit: 699826f4e30a ("IB/isert: Fix incorrect release of isert connection") is causing problems on OPA when DEVICE_REMOVAL is happening.
------------[ cut here ]------------ WARNING: CPU: 52 PID: 2117247 at drivers/infiniband/core/cq.c:359 ib_cq_pool_cleanup+0xac/0xb0 [ib_core] Modules linked in: nfsd nfs_acl target_core_user uio tcm_fc libfc
scsi_transport_fc tcm_loop target_core_pscsi target_core_iblock target_core_file rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache netfs rfkill rpcrdma rdma_ucm ib_srpt sunrpc ib_isert iscsi_target_mod target_core_mod opa_vnic ib_iser libiscsi ib_umad scsi_transport_iscsi rdma_cm ib_ipoib iw_cm ib_cm hfi1(-) rdmavt ib_uverbs intel_rapl_msr intel_rapl_common sb_edac ib_core x86_pkg_temp_thermal intel_powerclamp coretemp i2c_i801 mxm_wmi rapl iTCO_wdt ipmi_si iTCO_vendor_support mei_me ipmi_devintf mei intel_cstate ioatdma intel_uncore i2c_smbus joydev pcspkr lpc_ich ipmi_msghandler acpi_power_meter acpi_pad xfs libcrc32c sr_mod sd_mod cdrom t10_pi sg crct10dif_pclmul crc32_pclmul crc32c_intel drm_kms_helper drm_shmem_helper ahci libahci ghash_clmulni_intel igb drm libata dca i2c_algo_bit wmi fuse
CPU: 52 PID: 2117247 Comm: modprobe Not tainted 6.5.0-rc1+ #1 Hardware name: Intel Corporation S2600CWR/S2600CW, BIOS SE5C610.86B.01.01.0014.121820151719 12/18/2015 RIP: 0010:ib_cq_pool_cleanup+0xac/0xb0 [ib_core] Code: ff 48 8b 43 40 48 8d 7b 40 48 83 e8 40 4c 39 e7 75 b3 49 83
c4 10 4d 39 fc 75 94 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc <0f> 0b eb a1 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1f
RSP: 0018:ffffc10bea13fc80 EFLAGS: 00010206
RAX: 000000000000010c RBX: ffff9bf5c7e66c00 RCX: 000000008020001d
RDX: 000000008020001e RSI: fffff175221f9900 RDI: ffff9bf5c7e67640
RBP: ffff9bf5c7e67600 R08: ffff9bf5c7e64400 R09: 000000008020001d
R10: 0000000040000000 R11: 0000000000000000 R12: ffff9bee4b1e8a18
R13: dead000000000122 R14: dead000000000100 R15: ffff9bee4b1e8a38
FS: 00007ff1e6d38740(0000) GS:ffff9bfd9fb00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005652044ecc68 CR3: 0000000889b5c005 CR4: 00000000001706e0
Call Trace: <TASK> ? __warn+0x80/0x130 ? ib_cq_pool_cleanup+0xac/0xb0 [ib_core] ? report_bug+0x195/0x1a0 ? handle_bug+0x3c/0x70 ? exc_invalid_op+0x14/0x70 ? asm_exc_invalid_op+0x16/0x20 ? ib_cq_pool_cleanup+0xac/0xb0 [ib_core] disable_device+0x9d/0x160 [ib_core] __ib_unregister_device+0x42/0xb0 [ib_core] ib_unregister_device+0x22/0x30 [ib_core] rvt_unregister_device+0x20/0x90 [rdmavt] hfi1_unregister_ib_device+0x16/0xf0 [hfi1] remove_one+0x55/0x1a0 [hfi1] pci_device_remove+0x36/0xa0 device_release_driver_internal+0x193/0x200 driver_detach+0x44/0x90 bus_remove_driver+0x69/0xf0 pci_unregister_driver+0x2a/0xb0 hfi1_mod_cleanup+0xc/0x3c [hfi1] __do_sys_delete_module.constprop.0+0x17a/0x2f0 ? exit_to_user_mode_prepare+0xc4/0xd0 ? syscall_trace_enter.constprop.0+0x126/0x1a0 do_syscall_64+0x5c/0x90 ? syscall_exit_to_user_mode+0x12/0x30 ? do_syscall_64+0x69/0x90 ? syscall_exit_work+0x103/0x130 ? syscall_exit_to_user_mode+0x12/0x30 ? do_syscall_64+0x69/0x90 ? exc_page_fault+0x65/0x150 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 RIP: 0033:0x7ff1e643f5ab Code: 73 01 c3 48 8b 0d 75 a8 1b 00 f7 d8 64 89 01 48 83 c8 ff c3
66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 45 a8 1b 00 f7 d8 64 89 01 48
RSP: 002b:00007ffec9103cc8 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
RAX: ffffffffffffffda RBX: 00005615267fdc50 RCX: 00007ff1e643f5ab
RDX: 0000000000000000 RSI: 0000000000000800 RDI: 00005615267fdcb8
RBP: 00005615267fdc50 R08: 0000000000000000 R09: 0000000000000000
R10: 00007ff1e659eac0 R11: 0000000000000206 R12: 00005615267fdcb8
R13: 0000000000000000 R14: 00005615267fdcb8 R15: 00007ffec9105ff8
</TASK> ---[ end trace 0000000000000000 ]---
And...
restrack: ------------[ cut here ]------------ infiniband hfi1_0: BUG: RESTRACK detected leak of resources
restrack: Kernel PD object allocated by ib_isert is not freed
restrack: Kernel CQ object allocated by ib_core is not freed
restrack: Kernel QP object allocated by rdma_cm is not freed
restrack: ------------[ cut here ]------------
--- drivers/infiniband/ulp/isert/ib_isert.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/ulp/isert/ib_isert.c +2 -0
@@ -2560,6 +2560,8 @@ static void isert_wait_conn(struct iscsi_conn *conn)isert_put_unsol_pending_cmds (conn);isert_wait4cmds (conn);isert_wait4logout (isert_conn); + +queue_work (isert_release_wq, &isert_conn->release_work); }static void isert_free_conn (struct iscsi_conn *conn)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 250/406 RDMA/siw: Balance the reference of cep->kref in the error path
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guoqing Jiang <[email protected]>
[ Upstream commit b056327bee09e6b86683d3f709a438ccd6031d72 ]
The siw_connect can go to err in below after cep is allocated successfully:
1. If siw_cm_alloc_work returns failure. In this case socket is not assoicated with cep so siw_cep_put can't be called by siw_socket_disassoc. We need to call siw_cep_put twice since cep->kref is increased once after it was initialized.
2. If siw_cm_queue_work can't find a work, which means siw_cep_get is not called in siw_cm_queue_work, so cep->kref is increased twice by siw_cep_get and when associate socket with cep after it was initialized. So we need to call siw_cep_put three times (one in siw_socket_disassoc).
3. siw_send_mpareqrep returns error, this scenario is similar as 2.
So we need to remove one siw_cep_put in the error path.
--- drivers/infiniband/sw/siw/siw_cm.c | 1 - 1 file changed, 1 deletion(-)
drivers/infiniband/sw/siw/siw_cm.c +0 -1
@@ -1490,7 +1490,6 @@ int siw_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params) cep->cm_id =NULL ; id->rem_ref (id); -siw_cep_put (cep); qp->cep =NULL ;siw_cep_put (cep);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 251/406 RDMA/siw: Correct wrong debug message
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guoqing Jiang <[email protected]>
[ Upstream commit bee024d20451e4ce04ea30099cad09f7f75d288b ]
We need to print num_sle first then pbl->max_buf per the condition. Also replace mem->pbl with pbl while at it.
--- drivers/infiniband/sw/siw/siw_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/siw/siw_verbs.c +1 -1
@@ -1487,7 +1487,7 @@ int siw_map_mr_sg(struct ib_mr *base_mr, struct scatterlist *sl, int num_sle,if (pbl->max_buf < num_sle) {siw_dbg_mem (mem,"too many SGE's: %d > %d\n" , - mem->pbl->max_buf, num_sle); + num_sle, pbl->max_buf);return -ENOMEM ; }for_each_sg (sl, slp, num_sle, i) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 252/406 HID: logitech-dj: Fix error handling in logi_dj_recv_switch_to_dj_mode()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
[ Upstream commit 6f20d3261265885f6a6be4cda49d7019728760e0 ]
Presently, if a call to logi_dj_recv_send_report() fails, we do not learn about the error until after sending short HID_OUTPUT_REPORT with hid_hw_raw_request().
To handle this somewhat unlikely issue, return on error in logi_dj_recv_send_report() (minding ugly sleep workaround) and take into account the result of hid_hw_raw_request().
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- drivers/hid/hid-logitech-dj.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/hid/hid-logitech-dj.c +4 -1
@@ -1217,6 +1217,9 @@ static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,* 50 msec should gives enough time to the receiver to be ready. */ msleep (50 ); + +if (retval) +return retval; }/*
@@ -1238,7 +1241,7 @@ static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, buf[5 ] =0x09 ; buf[6 ] =0x00 ; -hid_hw_raw_request (hdev,REPORT_ID_HIDPP_SHORT , buf, + retval =hid_hw_raw_request (hdev,REPORT_ID_HIDPP_SHORT , buf,HIDPP_REPORT_SHORT_LENGTH ,HID_OUTPUT_REPORT ,HID_REQ_SET_REPORT );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 253/406 HID: multitouch: Correct devm device reference for hidinput input_dev name
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rahul Rameshbabu <[email protected]>
[ Upstream commit 4794394635293a3e74591351fff469cea7ad15a2 ]
Reference the HID device rather than the input device for the devm allocation of the input_dev name. Referencing the input_dev would lead to a use-after-free when the input_dev was unregistered and subsequently fires a uevent that depends on the name. At the point of firing the uevent, the name would be freed by devres management.
Use devm_kasprintf to simplify the logic for allocating memory and formatting the input_dev name string.
--- drivers/hid/hid-multitouch.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/hid/hid-multitouch.c +3 -10
@@ -1541,7 +1541,6 @@ static void mt_post_parse(struct mt_device *td, struct mt_application *app)static int mt_input_configured (struct hid_device *hdev,struct hid_input *hi) {struct mt_device *td =hid_get_drvdata (hdev); -char *name;const char *suffix =NULL ;struct mt_report_data *rdata;struct mt_application *mt_application =NULL ;
@@ -1595,15 +1594,9 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)break ; } -if (suffix) { - name =devm_kzalloc (&hi->input->dev, -strlen (hdev->name) +strlen (suffix) +2 , -GFP_KERNEL ); -if (name) { -sprintf (name,"%s %s" , hdev->name, suffix); - hi->input->name = name; - } - } +if (suffix) + hi->input->name =devm_kasprintf (&hdev->dev,GFP_KERNEL , +"%s %s" , hdev->name, suffix);return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 254/406 x86/speculation: Mark all Skylake CPUs as vulnerable to GDS
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
[ Upstream commit c9f4c45c8ec3f07f4f083f9750032a1ec3eab6b2 ]
The Gather Data Sampling (GDS) vulnerability is common to all Skylake processors. However, the "client" Skylakes* are now in this list:
https://www.intel.com/content/www/us/en/support/articles/000022396/processors.html
which means they are no longer included for new vulnerabilities here:
or in other GDS documentation. Thus, they were not included in the original GDS mitigation patches.
Mark SKYLAKE and SKYLAKE_L as vulnerable to GDS to match all the other Skylake CPUs (which include Kaby Lake). Also group the CPUs so that the ones that share the exact same vulnerabilities are next to each other.
Last, move SRBDS to the end of each line. This makes it clear at a glance that SKYLAKE_X is unique. Of the five Skylakes, it is the only "server" CPU and has a different implementation from the clients of the "special register" hardware, making it immune to SRBDS.
This makes the diff much harder to read, but the resulting table is worth it.
I very much appreciate the report from Michael Zhivich about this issue. Despite what level of support a hardware vendor is providing, the kernel very much needs an accurate and up-to-date list of vulnerable CPUs. More reports like this are very welcome.
* Client Skylakes are CPUID 406E3/506E3 which is family 6, models 0x4E and 0x5E, aka INTEL_FAM6_SKYLAKE and INTEL_FAM6_SKYLAKE_L.
--- arch/x86/kernel/cpu/common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/common.c +4 -4
@@ -1145,11 +1145,11 @@ static const struct x86_cpu_id cpu_vuln_blacklist[] __initconst = {VULNBL_INTEL_STEPPINGS (BROADWELL_G ,X86_STEPPING_ANY ,SRBDS ),VULNBL_INTEL_STEPPINGS (BROADWELL_X ,X86_STEPPING_ANY ,MMIO ),VULNBL_INTEL_STEPPINGS (BROADWELL ,X86_STEPPING_ANY ,SRBDS ), -VULNBL_INTEL_STEPPINGS (SKYLAKE_L ,X86_STEPPING_ANY ,SRBDS |MMIO |RETBLEED ),VULNBL_INTEL_STEPPINGS (SKYLAKE_X ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS ), -VULNBL_INTEL_STEPPINGS (SKYLAKE ,X86_STEPPING_ANY ,SRBDS |MMIO |RETBLEED ), -VULNBL_INTEL_STEPPINGS (KABYLAKE_L ,X86_STEPPING_ANY ,SRBDS |MMIO |RETBLEED |GDS ), -VULNBL_INTEL_STEPPINGS (KABYLAKE ,X86_STEPPING_ANY ,SRBDS |MMIO |RETBLEED |GDS ), +VULNBL_INTEL_STEPPINGS (SKYLAKE_L ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS |SRBDS ), +VULNBL_INTEL_STEPPINGS (SKYLAKE ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS |SRBDS ), +VULNBL_INTEL_STEPPINGS (KABYLAKE_L ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS |SRBDS ), +VULNBL_INTEL_STEPPINGS (KABYLAKE ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS |SRBDS ),VULNBL_INTEL_STEPPINGS (CANNONLAKE_L ,X86_STEPPING_ANY ,RETBLEED ),VULNBL_INTEL_STEPPINGS (ICELAKE_L ,X86_STEPPING_ANY ,MMIO |MMIO_SBDS |RETBLEED |GDS ), VULNBL_INTEL_STEPPINGS(ICELAKE_D, X86_STEPPING_ANY, MMIO | GDS),
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 255/406 tracing: Fix race issue between cpu buffer write and swap
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Yejian <[email protected]>
[ Upstream commit 3163f635b20e9e1fb4659e74f47918c9dddfe64e ]
Warning happened in rb_end_commit() at code:
if (RB_WARN_ON(cpu_buffer, !local_read(&cpu_buffer->committing)))
WARNING: CPU: 0 PID: 139 at kernel/trace/ring_buffer.c:3142 rb_commit+0x402/0x4a0 Call Trace: ring_buffer_unlock_commit+0x42/0x250 trace_buffer_unlock_commit_regs+0x3b/0x250 trace_event_buffer_commit+0xe5/0x440 trace_event_buffer_reserve+0x11c/0x150 trace_event_raw_event_sched_switch+0x23c/0x2c0 __traceiter_sched_switch+0x59/0x80 __schedule+0x72b/0x1580 schedule+0x92/0x120 worker_thread+0xa0/0x6f0
It is because the race between writing event into cpu buffer and swapping cpu buffer through file per_cpu/cpu0/snapshot:
Write on CPU 0 Swap buffer by per_cpu/cpu0/snapshot on CPU 1
-------- --------
tracing_snapshot_write()
[...] ring_buffer_lock_reserve()
cpu_buffer = buffer->buffers[cpu]; // 1. Suppose find 'cpu_buffer_a';
[...]
rb_reserve_next_event()
[...] ring_buffer_swap_cpu()
if (local_read(&cpu_buffer_a->committing))
goto out_dec;
if (local_read(&cpu_buffer_b->committing))
goto out_dec;
buffer_a->buffers[cpu] = cpu_buffer_b;
buffer_b->buffers[cpu] = cpu_buffer_a;
// 2. cpu_buffer has swapped here.
rb_start_commit(cpu_buffer);
if (unlikely(READ_ONCE(cpu_buffer->buffer)
!= buffer)) { // 3. This check passed due to 'cpu_buffer->buffer'
[...] // has not changed here.
return NULL;
}
cpu_buffer_b->buffer = buffer_a;
cpu_buffer_a->buffer = buffer_b;
[...]
// 4. Reserve event from 'cpu_buffer_a'. ring_buffer_unlock_commit()
[...]
cpu_buffer = buffer->buffers[cpu]; // 5. Now find 'cpu_buffer_b' !!!
rb_commit(cpu_buffer)
rb_end_commit() // 6. WARN for the wrong 'committing' state !!!Based on above analysis, we can easily reproduce by following testcase:
``` bash
#!/bin/bash
dmesg -n 7
sysctl -w kernel.panic_on_warn=1
TR=/sys/kernel/tracing
echo 7 > ${TR}/buffer_size_kb
echo "sched:sched_switch" > ${TR}/set_event
while [ true ]; do
echo 1 > ${TR}/per_cpu/cpu0/snapshot
done &
while [ true ]; do
echo 1 > ${TR}/per_cpu/cpu0/snapshot
done &
while [ true ]; do
echo 1 > ${TR}/per_cpu/cpu0/snapshot
done &
```To fix it, IIUC, we can use smp_call_function_single() to do the swap on the target cpu where the buffer is located, so that above race would be avoided.
--- kernel/trace/trace.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
kernel/trace/trace.c +12 -5
@@ -7164,6 +7164,11 @@ static int tracing_snapshot_open(struct inode *inode, struct file *file)return ret; } +static void tracing_swap_cpu_buffer (void *tr) +{ +update_max_tr_single ((struct trace_array *)tr, current,smp_processor_id ()); +} +static ssize_t tracing_snapshot_write (struct file *filp,const char __user *ubuf,size_t cnt,loff_t *ppos)
@@ -7222,13 +7227,15 @@ tracing_snapshot_write(struct file *filp, const char __user *ubuf, size_t cnt, ret =tracing_alloc_snapshot_instance (tr);if (ret <0 )break ; -local_irq_disable ();/* Now, we're going to swap */ -if (iter->cpu_file ==RING_BUFFER_ALL_CPUS ) +if (iter->cpu_file ==RING_BUFFER_ALL_CPUS ) { +local_irq_disable ();update_max_tr (tr, current,smp_processor_id (),NULL ); -else -update_max_tr_single (tr, current, iter->cpu_file); -local_irq_enable (); +local_irq_enable (); + }else { +smp_call_function_single (iter->cpu_file, tracing_swap_cpu_buffer, + (void *)tr,1 ); + }break ;default :if (tr->allocated_snapshot) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 256/406 mtd: rawnand: brcmnand: Fix mtd oobsize
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: William Zhang <[email protected]>
[ Upstream commit 60177390fa061c62d156f4a546e3efd90df3c183 ]
brcmnand controller can only access the flash spare area up to certain bytes based on the ECC level. It can be less than the actual flash spare area size. For example, for many NAND chip supporting ECC BCH-8, it has 226 bytes spare area. But controller can only uses 218 bytes. So brcmand driver overrides the mtd oobsize with the controller's accessible spare area size. When the nand base driver utilizes the nand_device object, it resets the oobsize back to the actual flash spare aprea size from nand_memory_organization structure and controller may not able to access all the oob area as mtd advises.
This change fixes the issue by overriding the oobsize in the nand_memory_organization structure to the controller's accessible spare area size.
--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +5 -2
@@ -2534,6 +2534,8 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)struct nand_chip *chip = &host->chip;const struct nand_ecc_props *requirements =nanddev_get_ecc_requirements (&chip->base); +struct nand_memory_organization *memorg = +nanddev_get_memorg (&chip->base);struct brcmnand_controller *ctrl = host->ctrl;struct brcmnand_cfg *cfg = &host->hwcfg;char msg[128 ];
@@ -2555,10 +2557,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)if (cfg->spare_area_size > ctrl->max_oob) cfg->spare_area_size = ctrl->max_oob;/* -* Set oobsize to be consistent with controller's spare_area_size, as -* the rest is inaccessible. +* Set mtd and memorg oobsize to be consistent with controller's +* spare_area_size, as the rest is inaccessible. */ mtd->oobsize = cfg->spare_area_size * (mtd->writesize >>FC_SHIFT ); + memorg->oobsize = mtd->oobsize; cfg->device_size = mtd->size; cfg->block_size = mtd->erasesize;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 257/406 phy/rockchip: inno-hdmi: use correct vco_div_5 macro on rk3328
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Karlman <[email protected]>
[ Upstream commit 644c06dfbd0da713f772abf0a8f8581ac78e6264 ]
inno_hdmi_phy_rk3328_clk_set_rate() is using the RK3228 macro when configuring vco_div_5 on RK3328.
Fix this by using correct vco_div_5 macro for RK3328.
--- drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +2 -2
@@ -790,8 +790,8 @@ static int inno_hdmi_phy_rk3328_clk_set_rate(struct clk_hw *hw, RK3328_PRE_PLL_POWER_DOWN);/* Configure pre-pll */ -inno_update_bits (inno,0xa0 ,RK3228_PCLK_VCO_DIV_5_MASK , -RK3228_PCLK_VCO_DIV_5 (cfg->vco_div_5_en)); +inno_update_bits (inno,0xa0 ,RK3328_PCLK_VCO_DIV_5_MASK , +RK3328_PCLK_VCO_DIV_5 (cfg->vco_div_5_en));inno_write (inno,0xa1 ,RK3328_PRE_PLL_PRE_DIV (cfg->prediv)); val =RK3328_SPREAD_SPECTRUM_MOD_DISABLE ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 258/406 phy/rockchip: inno-hdmi: round fractal pixclock in rk3328 recalc_rate
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Yang <[email protected]>
[ Upstream commit d5ef343c1d62bc4c4c2c393af654a41cb34b449f ]
inno_hdmi_phy_rk3328_clk_recalc_rate() is returning a rate not found in the pre pll config table when the fractal divider is used. This can prevent proper power_on because a tmdsclock for the new rate is not found in the pre pll config table.
Fix this by saving and returning a rounded pixel rate that exist in the pre pll config table.
--- drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +5 -3
@@ -745,10 +745,12 @@ unsigned long inno_hdmi_phy_rk3328_clk_recalc_rate(struct clk_hw *hw,do_div (vco, (nd * (no_a ==1 ? no_b : no_a) * no_d *2 )); } - inno->pixclock = vco; -dev_dbg (inno->dev,"%s rate %lu\n" , __func__, inno->pixclock); + inno->pixclock =DIV_ROUND_CLOSEST ((unsigned long )vco,1000 ) *1000 ; -return vco; +dev_dbg (inno->dev,"%s rate %lu vco %llu\n" , + __func__, inno->pixclock, vco); + +return inno->pixclock; } static long inno_hdmi_phy_rk3328_clk_round_rate(struct clk_hw *hw,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 259/406 phy/rockchip: inno-hdmi: do not power on rk3328 post pll on reg write
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Karlman <[email protected]>
[ Upstream commit 19a1d46bd699940a496d3b0d4e142ef99834988c ]
inno_write is used to configure 0xaa reg, that also hold the POST_PLL_POWER_DOWN bit.
When POST_PLL_REFCLK_SEL_TMDS is configured the power down bit is not taken into consideration.
Fix this by keeping the power down bit until configuration is complete. Also reorder the reg write order for consistency.
--- drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +4 -2
@@ -1023,9 +1023,10 @@ inno_hdmi_phy_rk3328_power_on(struct inno_hdmi_phy *inno,inno_write (inno,0xac ,RK3328_POST_PLL_FB_DIV_7_0 (cfg->fbdiv));if (cfg->postdiv ==1 ) { -inno_write (inno,0xaa ,RK3328_POST_PLL_REFCLK_SEL_TMDS );inno_write (inno,0xab ,RK3328_POST_PLL_FB_DIV_8 (cfg->fbdiv) |RK3328_POST_PLL_PRE_DIV (cfg->prediv)); +inno_write (inno,0xaa ,RK3328_POST_PLL_REFCLK_SEL_TMDS | +RK3328_POST_PLL_POWER_DOWN ); }else { v = (cfg->postdiv /2 ) -1 ; v &=RK3328_POST_PLL_POST_DIV_MASK ;
@@ -1033,7 +1034,8 @@ inno_hdmi_phy_rk3328_power_on(struct inno_hdmi_phy *inno,inno_write (inno,0xab ,RK3328_POST_PLL_FB_DIV_8 (cfg->fbdiv) |RK3328_POST_PLL_PRE_DIV (cfg->prediv));inno_write (inno,0xaa ,RK3328_POST_PLL_POST_DIV_ENABLE | -RK3328_POST_PLL_REFCLK_SEL_TMDS ); +RK3328_POST_PLL_REFCLK_SEL_TMDS | +RK3328_POST_PLL_POWER_DOWN ); }for (v =0 ; v <14 ; v++)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 260/406 rpmsg: glink: Add check for kstrdup
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
[ Upstream commit b5c9ee8296a3760760c7b5d2e305f91412adc795 ]
Add check for the return value of kstrdup() and return the error if it fails in order to avoid NULL pointer dereference.
--- drivers/rpmsg/qcom_glink_native.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/rpmsg/qcom_glink_native.c +4 -0
@@ -222,6 +222,10 @@ static struct glink_channel *qcom_glink_alloc_channel(struct qcom_glink *glink, channel->glink = glink; channel->name =kstrdup (name,GFP_KERNEL ); +if (!channel->name) { +kfree (channel); +return ERR_PTR (-ENOMEM ); + }init_completion (&channel->open_req);init_completion (&channel->open_ack);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 261/406 leds: Fix BUG_ON check for LED_COLOR_ID_MULTI that is always false
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Behún <[email protected]>
[ Upstream commit c3f853184bed04105682383c2971798c572226b5 ]
At the time we call
BUG_ON(props.color == LED_COLOR_ID_MULTI);
the props variable is still initialized to zero.
Call the BUG_ON only after we parse fwnode into props.
--- drivers/leds/led-core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/leds/led-core.c +4 -4
@@ -425,15 +425,15 @@ int led_compose_name(struct device *dev, struct led_init_data *init_data,struct fwnode_handle *fwnode = init_data->fwnode;const char *devicename = init_data->devicename; -/* We want to label LEDs that can produce full range of colors -* as RGB, not multicolor */ -BUG_ON (props.color ==LED_COLOR_ID_MULTI ); -if (!led_classdev_name)return -EINVAL ;led_parse_fwnode_props (dev, fwnode, &props); +/* We want to label LEDs that can produce full range of colors +* as RGB, not multicolor */ +BUG_ON (props.color ==LED_COLOR_ID_MULTI ); +if (props.label) {/* * If init_data.devicename is NULL, then it indicates that
Signature · 1 line
2.40.1
Re: [PATCH 5.10 261/406] leds: Fix BUG_ON check for LED_COLOR_ID_MULTI that is always false
Greg, please drop this patch from both 5.10 and 5.15.
Reference:
https://lore.kernel.org/linux-leds/[email protected]/T/
I am going to send a fix to drop the check altogether.
Marek
Quoted 47 lines · On Sun, 17 Sep 2023 21:11:55 +0200 Greg Kroah-Hartman…
5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Behún <[email protected]>
[ Upstream commit
c3f853184bed04105682383c2971798c572226b5]At the time we call
BUG_ON(props.color == LED_COLOR_ID_MULTI);the props variable is still initialized to zero.
Call the
BUG_ONonly after we parse fwnode into props.Fixes 77dce3a22e89 ("leds: disallow /sys/class/leds/*:multi:* for now")Signed-off-by Marek Behún <[email protected]>Signed-off-by Lee Jones <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/leds/led-core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/leds/led-core.c +4
-4@@ -425,15 +425,15 @@ int led_compose_name(struct device *dev, struct led_init_data *init_data,struct fwnode_handle *fwnode = init_data->fwnode;const char *devicename = init_data->devicename; -/* We want to label LEDs that can produce full range of colors -* as RGB, not multicolor */ -BUG_ON (props.color ==LED_COLOR_ID_MULTI ); -if (!led_classdev_name)return -EINVAL ;led_parse_fwnode_props (dev, fwnode, &props); +/* We want to label LEDs that can produce full range of colors +* as RGB, not multicolor */ +BUG_ON (props.color ==LED_COLOR_ID_MULTI ); +if (props.label) {/* * If init_data.devicename is NULL, then it indicates that
Greg Kroah-Hartman
maintainerRe: [PATCH 5.10 261/406] leds: Fix BUG_ON check for LED_COLOR_ID_MULTI that is always false
Quoted 4 lines · Marek Behún
Greg, please drop this patch from both 5.10 and 5.15.
Reference:
https://lore.kernel.org/linux-leds/[email protected]/T/
But this is already in released kernels:
6.1.53 6.4.16 6.5.3 6.6-rc1
Quoted 1 line
I am going to send a fix to drop the check altogether.
We will be glad to queue up the fix as well when it hits Linus's tree, please be sure to tag it for stable backporting so we can get it in all locations.
But for now, being bug-compatible makes more sense, right? Or is this really critical and should not be in these kernels now?
thanks,
greg k-h
Re: [PATCH 5.10 261/406] leds: Fix BUG_ON check for LED_COLOR_ID_MULTI that is always false
Quoted 9 lines · On Mon, 18 Sep 2023 17:22:59 +0200 Greg Kroah-Hartman…
Quoted 4 lines · Marek Behún
Greg, please drop this patch from both 5.10 and 5.15.
Reference:
https://lore.kernel.org/linux-leds/[email protected]/T/But this is already in released kernels:
6.1.53 6.4.16 6.5.3 6.6-rc1
Quoted 8 lines
Quoted 1 line
I am going to send a fix to drop the check altogether.
We will be glad to queue up the fix as well when it hits Linus's tree, please be sure to tag it for stable backporting so we can get it in all locations.
But for now, being bug-compatible makes more sense, right? Or is this really critical and should not be in these kernels now?
According to that e-mail, the patch breaks booting for some systems, so if it would be possible to avoid it...
I've sent a fixup patch which removes the BUG_ON altogether, and referenced the patch that broke booting in the Fixes tag. But I don't know how long it will take to hit Linus' tree, it may take several weeks.
Marek
Greg Kroah-Hartman
maintainerRe: [PATCH 5.10 261/406] leds: Fix BUG_ON check for LED_COLOR_ID_MULTI that is always false
Quoted 21 lines · Marek Behún
Quoted 9 lines · On Mon, 18 Sep 2023 17:22:59 +0200 Greg Kroah-Hartman…
Quoted 4 lines · Marek Behún
Greg, please drop this patch from both 5.10 and 5.15.
Reference:
https://lore.kernel.org/linux-leds/[email protected]/T/But this is already in released kernels:
6.1.53 6.4.16 6.5.3 6.6-rc1Quoted 8 lines
Quoted 1 line
I am going to send a fix to drop the check altogether.
We will be glad to queue up the fix as well when it hits Linus's tree, please be sure to tag it for stable backporting so we can get it in all locations.
But for now, being bug-compatible makes more sense, right? Or is this really critical and should not be in these kernels now?
Quoted 7 lines
According to that e-mail, the patch breaks booting for some systems, so if it would be possible to avoid it...
I've sent a fixup patch which removes the
BUG_ONaltogether, and referenced the patch that broke booting in the Fixes tag. But I don't know how long it will take to hit Linus' tree, it may take several weeks.
Ok, thanks, now dropped from these trees. Please pester the maintainers to get this merged into Linus's tree soon so that the other stable trees can be fixed up as well.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 262/406 mtd: spi-nor: Check bus width while setting QE bit
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hsin-Yi Wang <[email protected]>
[ Upstream commit f01d8155a92e33cdaa85d20bfbe6c441907b3c1f ]
spi_nor_write_16bit_sr_and_check() should also check if bus width is 4 before setting QE bit.
--- drivers/mtd/spi-nor/core.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/mtd/spi-nor/core.c +10 -9
@@ -800,21 +800,22 @@ static int spi_nor_write_16bit_sr_and_check(struct spi_nor *nor, u8 sr1) ret =spi_nor_read_cr (nor, &sr_cr[1 ]);if (ret)return ret; - }else if (nor->params->quad_enable) { + }else if (spi_nor_get_protocol_width (nor->read_proto) ==4 && +spi_nor_get_protocol_width (nor->write_proto) ==4 && + nor->params->quad_enable) {/* * If the Status Register 2 Read command (35h) is not * supported, we should at least be sure we don't * change the value of the SR2 Quad Enable bit. * -* We can safely assume that when the Quad Enable method is -* set, the value of the QE bit is one, as a consequence of the -* nor->params->quad_enable() call. +* When the Quad Enable method is set and the buswidth is 4, we +* can safely assume that the value of the QE bit is one, as a +* consequence of the nor->params->quad_enable() call. * -* We can safely assume that the Quad Enable bit is present in -* the Status Register 2 at BIT(1). According to the JESD216 -* revB standard, BFPT DWORDS[15], bits 22:20, the 16-bit -* Write Status (01h) command is available just for the cases -* in which the QE bit is described in SR2 at BIT(1). +* According to the JESD216 revB standard, BFPT DWORDS[15], +* bits 22:20, the 16-bit Write Status (01h) command is +* available just for the cases in which the QE bit is +* described in SR2 at BIT(1). */ sr_cr[1 ] =SR2_QUAD_EN_BIT1 ; }else {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 263/406 mtd: rawnand: fsmc: handle clk prepare error in fsmc_nand_resume()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yi Yang <[email protected]>
[ Upstream commit a5a88125d00612586e941ae13e7fcf36ba8f18a7 ]
In fsmc_nand_resume(), the return value of clk_prepare_enable() should be checked since it might fail.
--- drivers/mtd/nand/raw/fsmc_nand.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mtd/nand/raw/fsmc_nand.c +6 -1
@@ -1190,9 +1190,14 @@ static int fsmc_nand_suspend(struct device *dev)static int fsmc_nand_resume (struct device *dev) {struct fsmc_nand_data *host =dev_get_drvdata (dev); +int ret;if (host) { -clk_prepare_enable (host->clk); + ret =clk_prepare_enable (host->clk); +if (ret) { +dev_err (dev,"failed to enable clk\n" ); +return ret; + }if (host->dev_timings)fsmc_nand_setup (host, host->dev_timings);nand_reset (&host->nand,0 );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 264/406 um: Fix hostaudio build errors
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit db4bfcba7bb8d10f00bba2a3da6b9a9c2a1d7b71 ]
Use "select" to ensure that the required kconfig symbols are set as expected.
Drop HOSTAUDIO since it is now equivalent to UML_SOUND.
Set CONFIG_SOUND=m in ARCH=um defconfig files to maintain the status quo of the default configs.
Allow SOUND with UML regardless of HAS_IOMEM. Otherwise there is a kconfig warning for unmet dependencies. (This was not an issue when SOUND was defined in arch/um/drivers/Kconfig. I have done 50 randconfig builds and didn't find any issues.)
This fixes build errors when CONFIG_SOUND is not set:
ld: arch/um/drivers/hostaudio_kern.o: in function `hostaudio_cleanup_module':
hostaudio_kern.c:(.exit.text+0xa): undefined reference to `unregister_sound_mixer'
ld: hostaudio_kern.c:(.exit.text+0x15): undefined reference to `unregister_sound_dsp'
ld: arch/um/drivers/hostaudio_kern.o: in function `hostaudio_init_module':
hostaudio_kern.c:(.init.text+0x19): undefined reference to `register_sound_dsp'
ld: hostaudio_kern.c:(.init.text+0x31): undefined reference to `register_sound_mixer'
ld: hostaudio_kern.c:(.init.text+0x49): undefined reference to `unregister_sound_dsp'
and this kconfig warning:
WARNING: unmet direct dependencies detected for SOUND
--- arch/um/configs/i386_defconfig | 1 + arch/um/configs/x86_64_defconfig | 1 + arch/um/drivers/Kconfig | 16 +++------------- arch/um/drivers/Makefile | 2 +- sound/Kconfig | 2 +- 5 files changed, 7 insertions(+), 15 deletions(-)
arch/um/configs/i386_defconfig +1 -0
@@ -35,6 +35,7 @@ CONFIG_TTY_CHAN=y CONFIG_XTERM_CHAN=y CONFIG_CON_CHAN="pts" CONFIG_SSL_CHAN="pts" +CONFIG_SOUND=m CONFIG_UML_SOUND=m CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y
arch/um/configs/x86_64_defconfig +1 -0
@@ -33,6 +33,7 @@ CONFIG_TTY_CHAN=y CONFIG_XTERM_CHAN=y CONFIG_CON_CHAN="pts" CONFIG_SSL_CHAN="pts" +CONFIG_SOUND=m CONFIG_UML_SOUND=m CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y
arch/um/drivers/Kconfig +3 -13
@@ -104,24 +104,14 @@ config SSL_CHAN config UML_SOUND tristate "Sound support" + depends on SOUND + select SOUND_OSS_CORE help This option enables UML sound support. If enabled, it will pull in - soundcore and the UML hostaudio relay, which acts as a intermediary + the UML hostaudio relay, which acts as a intermediary between the host's dsp and mixer devices and the UML sound system. It is safe to say 'Y' here. -config SOUND - tristate - default UML_SOUND - -config SOUND_OSS_CORE - bool - default UML_SOUND - -config HOSTAUDIO - tristate - default UML_SOUND - endmenu menu "UML Network Devices"
arch/um/drivers/Makefile +1 -1
@@ -52,7 +52,7 @@ obj-$(CONFIG_UML_NET) += net.o obj-$(CONFIG_MCONSOLE) += mconsole.o obj-$(CONFIG_MMAPPER) += mmapper_kern.o obj-$(CONFIG_BLK_DEV_UBD) += ubd.o -obj-$(CONFIG_HOSTAUDIO) += hostaudio.o +obj-$(CONFIG_UML_SOUND) += hostaudio.o obj-$(CONFIG_NULL_CHAN) += null.o obj-$(CONFIG_PORT_CHAN) += port.o obj-$(CONFIG_PTY_CHAN) += pty.o
sound/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only menuconfig SOUND tristate "Sound card support" - depends on HAS_IOMEM + depends on HAS_IOMEM || UML help If you have a sound card in your computer, i.e. if it can say more than an occasional beep, say Y.
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 265/406 dmaengine: ste_dma40: Add missing IRQ check in d40_probe
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: ruanjinjie <[email protected]>
[ Upstream commit c05ce6907b3d6e148b70f0bb5eafd61dcef1ddc1 ]
Check for the return value of platform_get_irq(): if no interrupt is specified, it wouldn't make sense to call request_irq().
--- drivers/dma/ste_dma40.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/dma/ste_dma40.c +4 -0
@@ -3598,6 +3598,10 @@ static int __init d40_probe(struct platform_device *pdev)spin_lock_init (&base->lcla_pool.lock); base->irq =platform_get_irq (pdev,0 ); +if (base->irq <0 ) { + ret = base->irq; + goto destroy_cache; + } ret =request_irq (base->irq, d40_handle_interrupt,0 ,D40_NAME , base);if (ret) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 266/406 cpufreq: Fix the race condition while updating the transition_task of policy
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liao Chang <[email protected]>
[ Upstream commit 61bfbf7951ba561dcbdd5357702d3cbc2d447812 ]
The field 'transition_task' of policy structure is used to track the task which is performing the frequency transition. Using this field to print a warning once detect a case where the same task is calling _begin() again before completing the preivous frequency transition via the _end().
However, there is a potential race condition in _end() and _begin() APIs while updating the field 'transition_task' of policy, the scenario is depicted below:
Task A Task B
/* 1st freq transition */
Invoke _begin() {
...
...
}
/* 2nd freq transition */
Invoke _begin() {
... //waiting for A to
... //clear
... //transition_ongoing
... //in _end() for
... //the 1st transition
|
Change the frequency |
|
Invoke _end() { |
... |
... |
transition_ongoing = false; V
transition_ongoing = true;
transition_task = current;
transition_task = NULL;
... //A overwrites the task
... //performing the transition
... //result in error warning.
}To fix this race condition, the transition_lock of policy structure is now acquired before updating policy structure in _end() API. Which ensure that only one task can update the 'transition_task' field at a time.
--- drivers/cpufreq/cpufreq.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/cpufreq/cpufreq.c +2 -0
@@ -450,8 +450,10 @@ void cpufreq_freq_transition_end(struct cpufreq_policy *policy, policy->cur, policy->cpuinfo.max_freq); +spin_lock (&policy->transition_lock); policy->transition_ongoing = false; policy->transition_task =NULL ; +spin_unlock (&policy->transition_lock);wake_up (&policy->transition_wait); }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 267/406 virtio_ring: fix avail_wrap_counter in virtqueue_add_packed
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Yao <[email protected]>
[ Upstream commit 1acfe2c1225899eab5ab724c91b7e1eb2881b9ab ]
In current packed virtqueue implementation, the avail_wrap_counter won't flip, in the case when the driver supplies a descriptor chain with a length equals to the queue size; total_sg == vq->packed.vring.num.
Let’s assume the following situation:
vq->packed.vring.num=4vq->packed.next_avail_idx: 1vq->packed.avail_wrap_counter: 0
Then the driver adds a descriptor chain containing 4 descriptors.
We expect the following result with avail_wrap_counter flipped:vq->packed.next_avail_idx: 1 vq->packed.avail_wrap_counter: 1
But, the current implementation gives the following result:vq->packed.next_avail_idx: 1 vq->packed.avail_wrap_counter: 0
To reproduce the bug, you can set a packed queue size as small as possible, so that the driver is more likely to provide a descriptor chain with a length equal to the packed queue size. For example, in qemu run following commands:
sudo qemu-system-x86_64 \
-enable-kvm \
-nographic \
-kernel "path/to/kernel_image" \
-m 1G \
-drive file="path/to/rootfs",if=none,id=disk \
-device virtio-blk,drive=disk \
-drive file="path/to/disk_image",if=none,id=rwdisk \
-device virtio-blk,drive=rwdisk,packed=on,queue-size=4,\
indirect_desc=off \
-append "console=ttyS0 root=/dev/vda rw init=/bin/bash"
Inside the VM, create a directory and mount the rwdisk device on it. The rwdisk will hang and mount operation will not complete.
This commit fixes the wrap counter error by flipping the packed.avail_wrap_counter, when start of descriptor chain equals to the end of descriptor chain (head == i).
Message-Id: <[email protected]>
--- drivers/virtio/virtio_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virtio/virtio_ring.c +1 -1
@@ -1190,7 +1190,7 @@ static inline int virtqueue_add_packed(struct virtqueue *_vq, } } -if (i < head) +if (i <= head) vq->packed.avail_wrap_counter ^=1 ;/* We're using some buffers from the free list. */
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 268/406 igmp: limit igmpv3_newpack() packet size to IP_MAX_MTU
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit c3b704d4a4a265660e665df51b129e8425216ed1 upstream.
This is a follow up of commit 915d975b2ffa ("net: deal with integer overflows in kmalloc_reserve()") based on David Laight feedback.
Back in 2010, I failed to realize malicious users could set dev->mtu to arbitrary values. This mtu has been since limited to 0x7fffffff but regardless of how big dev->mtu is, it makes no sense for igmpv3_newpack() to allocate more than IP_MAX_MTU and risk various skb fields overflows.
--- net/ipv4/igmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/igmp.c +2 -1
@@ -353,8 +353,9 @@ static struct sk_buff *igmpv3_newpack(ststruct flowi4 fl4;int hlen =LL_RESERVED_SPACE (dev);int tlen = dev->needed_tailroom; -unsigned int size = mtu; +unsigned int size; + size =min (mtu,IP_MAX_MTU );while (1 ) { skb =alloc_skb (size + hlen + tlen,GFP_ATOMIC | __GFP_NOWARN);
Greg Kroah-Hartman
maintainerPATCH 269/406 netfilter: ipset: add the missing IP_SET_HASH_WITH_NET0 macro for ip_set_hash_netportnet.c
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <[email protected]>
commit 050d91c03b28ca479df13dfb02bcd2c60dd6a878 upstream.
The missing IP_SET_HASH_WITH_NET0 macro in ip_set_hash_netportnet can lead to the use of wrong CIDR_POS(c) for calculating array offsets, which can lead to integer underflow. As a result, it leads to slab out-of-bound access.
This patch adds back the IP_SET_HASH_WITH_NET0 macro to ip_set_hash_netportnet to address the issue.
--- net/netfilter/ipset/ip_set_hash_netportnet.c | 1 + 1 file changed, 1 insertion(+)
net/netfilter/ipset/ip_set_hash_netportnet.c +1 -0
@@ -35,6 +35,7 @@ MODULE_ALIAS("ip_set_hash:net,port,net")#define IP_SET_HASH_WITH_PROTO #define IP_SET_HASH_WITH_NETS #define IPSET_NET_COUNT 2 +#define IP_SET_HASH_WITH_NET0 /* IPv4 variant */
Greg Kroah-Hartman
maintainerPATCH 270/406 netfilter: xt_u32: validate user space input
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wander Lairson Costa <[email protected]>
commit 69c5d284f67089b4750d28ff6ac6f52ec224b330 upstream.
The xt_u32 module doesn't validate the fields in the xt_u32 structure. An attacker may take advantage of this to trigger an OOB read by setting the size fields with a value beyond the arrays boundaries.
Add a checkentry function to validate the structure.
This was originally reported by the ZDI project (ZDI-CAN-18408).
--- net/netfilter/xt_u32.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
net/netfilter/xt_u32.c +21 -0
@@ -96,11 +96,32 @@ static bool u32_mt(const struct sk_buffreturn ret ^ data->invert; } +static int u32_mt_checkentry (const struct xt_mtchk_param *par) +{ +const struct xt_u32 *data = par->matchinfo; +const struct xt_u32_test *ct; +unsigned int i; + +if (data->ntests >ARRAY_SIZE (data->tests)) +return -EINVAL ; + +for (i =0 ; i < data->ntests; ++i) { + ct = &data->tests[i]; + +if (ct->nnums >ARRAY_SIZE (ct->location) || + ct->nvalues >ARRAY_SIZE (ct->value)) +return -EINVAL ; + } + +return 0 ; +} +static struct xt_match xt_u32_mt_reg__read_mostly = { .name ="u32" , .revision =0 , .family =NFPROTO_UNSPEC , .match = u32_mt, + .checkentry = u32_mt_checkentry, .matchsize =sizeof (struct xt_u32 ), .me =THIS_MODULE , };
Greg Kroah-Hartman
maintainerPATCH 271/406 netfilter: xt_sctp: validate the flag_info count
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wander Lairson Costa <[email protected]>
commit e99476497687ef9e850748fe6d232264f30bc8f9 upstream.
sctp_mt_check doesn't validate the flag_count field. An attacker can take advantage of that to trigger a OOB read and leak memory information.
Add the field validation in the checkentry function.
--- net/netfilter/xt_sctp.c | 2 ++ 1 file changed, 2 insertions(+)
net/netfilter/xt_sctp.c +2 -0
@@ -150,6 +150,8 @@ static int sctp_mt_check(const struct xt {const struct xt_sctp_info *info = par->matchinfo; +if (info->flag_count >ARRAY_SIZE (info->flag_info)) +return -EINVAL ;if (info->flags & ~XT_SCTP_VALID_FLAGS )return -EINVAL ;if (info->invflags & ~XT_SCTP_VALID_FLAGS )
Greg Kroah-Hartman
maintainerPATCH 272/406 skbuff: skb_segment, Call zero copy functions before using skbuff frags
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohamed Khalfella <[email protected]>
commit 2ea35288c83b3d501a88bc17f2df8f176b5cc96f upstream.
Commit bf5c25d60861 ("skbuff: in skb_segment, call zerocopy functions once per nskb") added the call to zero copy functions in skb_segment(). The change introduced a bug in skb_segment() because skb_orphan_frags() may possibly change the number of fragments or allocate new fragments altogether leaving nrfrags and frag to point to the old values. This can cause a panic with stacktrace like the one below.
[ 193.894380] BUG: kernel NULL pointer dereference, address: 00000000000000bc [ 193.895273] CPU: 13 PID: 18164 Comm: vh-net-17428 Kdump: loaded Tainted: G O 5.15.123+ #26 [ 193.903919] RIP: 0010:skb_segment+0xb0e/0x12f0 [ 194.021892] Call Trace: [ 194.027422] <TASK> [ 194.072861] tcp_gso_segment+0x107/0x540 [ 194.082031] inet_gso_segment+0x15c/0x3d0 [ 194.090783] skb_mac_gso_segment+0x9f/0x110 [ 194.095016] __skb_gso_segment+0xc1/0x190 [ 194.103131] netem_enqueue+0x290/0xb10 [sch_netem] [ 194.107071] dev_qdisc_enqueue+0x16/0x70 [ 194.110884] __dev_queue_xmit+0x63b/0xb30 [ 194.121670] bond_start_xmit+0x159/0x380 [bonding] [ 194.128506] dev_hard_start_xmit+0xc3/0x1e0 [ 194.131787] __dev_queue_xmit+0x8a0/0xb30 [ 194.138225] macvlan_start_xmit+0x4f/0x100 [macvlan] [ 194.141477] dev_hard_start_xmit+0xc3/0x1e0 [ 194.144622] sch_direct_xmit+0xe3/0x280 [ 194.147748] __dev_queue_xmit+0x54a/0xb30 [ 194.154131] tap_get_user+0x2a8/0x9c0 [tap] [ 194.157358] tap_sendmsg+0x52/0x8e0 [tap] [ 194.167049] handle_tx_zerocopy+0x14e/0x4c0 [vhost_net] [ 194.173631] handle_tx+0xcd/0xe0 [vhost_net] [ 194.176959] vhost_worker+0x76/0xb0 [vhost] [ 194.183667] kthread+0x118/0x140 [ 194.190358] ret_from_fork+0x1f/0x30 [ 194.193670] </TASK>
In this case calling skb_orphan_frags() updated nr_frags leaving nrfrags local variable in skb_segment() stale. This resulted in the code hitting i >= nrfrags prematurely and trying to move to next frag_skb using list_skb pointer, which was NULL, and caused kernel panic. Move the call to zero copy functions before using frags and nr_frags.
--- net/core/skbuff.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)
net/core/skbuff.c +20 -14
@@ -3799,21 +3799,20 @@ struct sk_buff *skb_segment(struct sk_bustruct sk_buff *segs =NULL ;struct sk_buff *tail =NULL ;struct sk_buff *list_skb =skb_shinfo (head_skb)->frag_list; -skb_frag_t *frag =skb_shinfo (head_skb)->frags;unsigned int mss =skb_shinfo (head_skb)->gso_size;unsigned int doffset = head_skb->data -skb_mac_header (head_skb); -struct sk_buff *frag_skb = head_skb;unsigned int offset = doffset;unsigned int tnl_hlen =skb_tnl_header_len (head_skb);unsigned int partial_segs =0 ;unsigned int headroom;unsigned int len = head_skb->len; +struct sk_buff *frag_skb; +skb_frag_t *frag;__be16 proto;bool csum, sg; -int nfrags =skb_shinfo (head_skb)->nr_frags;int err = -ENOMEM ;int i =0 ; -int pos; +int nfrags, pos;if ((skb_shinfo (head_skb)->gso_type &SKB_GSO_DODGY ) && mss !=GSO_BY_FRAGS && mss !=skb_headlen (head_skb)) {
@@ -3890,6 +3889,13 @@ normal: headroom =skb_headroom (head_skb); pos =skb_headlen (head_skb); +if (skb_orphan_frags (head_skb,GFP_ATOMIC )) +return ERR_PTR (-ENOMEM ); + + nfrags =skb_shinfo (head_skb)->nr_frags; + frag =skb_shinfo (head_skb)->frags; + frag_skb = head_skb; + do { struct sk_buff *nskb; skb_frag_t *nskb_frag;
@@ -3914,6 +3920,10 @@ normal: (skb_headlen(list_skb) == len || sg)) {BUG_ON (skb_headlen (list_skb) > len); + nskb =skb_clone (list_skb,GFP_ATOMIC ); +if (unlikely (!nskb)) + goto err; + i =0 ; nfrags =skb_shinfo (list_skb)->nr_frags; frag =skb_shinfo (list_skb)->frags;
@@ -3932,12 +3942,8 @@ normal: frag++; } - nskb =skb_clone (list_skb,GFP_ATOMIC ); list_skb = list_skb->next; -if (unlikely (!nskb)) - goto err; -if (unlikely (pskb_trim (nskb, len))) {kfree_skb (nskb); goto err;
@@ -4008,12 +4014,16 @@ normal:skb_shinfo (nskb)->tx_flags |=skb_shinfo (head_skb)->tx_flags &SKBTX_SHARED_FRAG ; -if (skb_orphan_frags (frag_skb,GFP_ATOMIC ) || -skb_zerocopy_clone (nskb, frag_skb,GFP_ATOMIC )) +if (skb_zerocopy_clone (nskb, frag_skb,GFP_ATOMIC )) goto err;while (pos < offset + len) {if (i >= nfrags) { +if (skb_orphan_frags (list_skb,GFP_ATOMIC ) || +skb_zerocopy_clone (nskb, list_skb, +GFP_ATOMIC )) + goto err; + i =0 ; nfrags =skb_shinfo (list_skb)->nr_frags; frag =skb_shinfo (list_skb)->frags;
@@ -4027,10 +4037,6 @@ normal: i--; frag--; } -if (skb_orphan_frags (frag_skb,GFP_ATOMIC ) || -skb_zerocopy_clone (nskb, frag_skb, -GFP_ATOMIC )) - goto err; list_skb = list_skb->next; }
Greg Kroah-Hartman
maintainerPATCH 273/406 igb: set max size RX buffer when store bad packet is enabled
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radoslaw Tyl <[email protected]>
commit bb5ed01cd2428cd25b1c88a3a9cba87055eb289f upstream.
Increase the RX buffer size to 3K when the SBP bit is on. The size of the RX buffer determines the number of pages allocated which may not be sufficient for receive frames larger than the set MTU size.
--- drivers/net/ethernet/intel/igb/igb_main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +7 -4
@@ -4731,6 +4731,10 @@ void igb_configure_rx_ring(struct igb_adstatic void igb_set_rx_buffer_len (struct igb_adapter *adapter,struct igb_ring *rx_ring) { +#if (PAGE_SIZE <8192 ) +struct e1000_hw *hw = &adapter->hw; +#endif +/* set build_skb and buffer size flags */ clear_ring_build_skb_enabled (rx_ring);clear_ring_uses_large_buffer (rx_ring);
@@ -4741,10 +4745,9 @@ static void igb_set_rx_buffer_len(structset_ring_build_skb_enabled (rx_ring);#if (PAGE_SIZE <8192 ) -if (adapter->max_frame_size <=IGB_MAX_FRAME_BUILD_SKB ) -return ; - -set_ring_uses_large_buffer (rx_ring); +if (adapter->max_frame_size >IGB_MAX_FRAME_BUILD_SKB || +rd32 (E1000_RCTL ) &E1000_RCTL_SBP ) +set_ring_uses_large_buffer (rx_ring);#endif }
Greg Kroah-Hartman
maintainerPATCH 274/406 PM / devfreq: Fix leak in devfreq_dev_release()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Brezillon <[email protected]>
commit 5693d077595de721f9ddbf9d37f40e5409707dfe upstream.
srcu_init_notifier_head() allocates resources that need to be released with a srcu_cleanup_notifier_head() call.
Reported by kmemleak.
--- drivers/devfreq/devfreq.c | 1 + 1 file changed, 1 insertion(+)
drivers/devfreq/devfreq.c +1 -0
@@ -732,6 +732,7 @@ static void devfreq_dev_release(struct d devfreq->profile->exit (devfreq->dev.parent);mutex_destroy (&devfreq->lock); +srcu_cleanup_notifier_head (&devfreq->transition_notifier_list);kfree (devfreq); }
Greg Kroah-Hartman
maintainerPATCH 275/406 ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 358040e3807754944dbddf948a23c6d914297ed7 upstream.
The update of rate_num/den and msbits were factored out to fixup_unreferenced_params() function to be called explicitly after the hw_refine or hw_params procedure. It's called from snd_pcm_hw_refine_user(), but it's forgotten in the PCM compat ioctl. This ended up with the incomplete rate_num/den and msbits parameters when 32bit compat ioctl is used.
This patch adds the missing call in snd_pcm_ioctl_hw_params_compat().
--- sound/core/pcm_compat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/core/pcm_compat.c +6 -2
@@ -252,10 +252,14 @@ static int snd_pcm_ioctl_hw_params_compa goto error; } -if (refine) +if (refine) { err =snd_pcm_hw_refine (substream, data); -else +if (err <0 ) + goto error; + err =fixup_unreferenced_params (substream, data); + }else { err =snd_pcm_hw_params (substream, data); + }if (err <0 ) goto error; if (copy_to_user(data32, data, sizeof(*data32)) ||
Greg Kroah-Hartman
maintainerPATCH 276/406 printk: ringbuffer: Fix truncating buffer size min_t cast
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit 53e9e33ede37a247d926db5e4a9e56b55204e66c upstream.
If an output buffer size exceeded U16_MAX, the min_t(u16, ...) cast in copy_data() was causing writes to truncate. This manifested as output bytes being skipped, seen as %NUL bytes in pstore dumps when the available record size was larger than 65536. Fix the cast to no longer truncate the calculation.
--- kernel/printk/printk_ringbuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk/printk_ringbuffer.c +1 -1
@@ -1726,7 +1726,7 @@ static bool copy_data(struct prb_data_riif (!buf || !buf_size)return true; - data_size =min_t (u16, buf_size, len); + data_size = min_t(unsigned int, buf_size, len);memcpy (&buf[0 ], data, data_size);/* LMM(copy_data:A) */ return true;
Greg Kroah-Hartman
maintainerPATCH 277/406 scsi: core: Fix the scsi_set_resid() documentation
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit f669b8a683e4ee26fa5cafe19d71cec1786b556a upstream.
Because scsi_finish_command() subtracts the residual from the buffer length, residual overflows must not be reported. Reflect this in the SCSI documentation. See also commit 9237f04e12cc ("scsi: core: Fix scsi_get/set_resid() interface")
--- Documentation/scsi/scsi_mid_low_api.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/scsi/scsi_mid_low_api.rst +2 -2
@@ -1195,11 +1195,11 @@ Members of interest: - pointer to scsi_device object that this command is associated with. resid - - an LLD should set this signed integer to the requested + - an LLD should set this unsigned integer to the requested transfer length (i.e. 'request_bufflen') less the number of bytes that are actually transferred. 'resid' is preset to 0 so an LLD can ignore it if it cannot detect - underruns (overruns should be rare). If possible an LLD + underruns (overruns should not be reported). An LLD should set 'resid' prior to invoking 'done'. The most interesting case is data transfers from a SCSI target device (e.g. READs) that underrun.
Greg Kroah-Hartman
maintainerPATCH 278/406 ipmi_si: fix a memleak in try_smi_init()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yi Yang <[email protected]>
commit 6cf1a126de2992b4efe1c3c4d398f8de4aed6e3f upstream.
Kmemleak reported the following leak info in try_smi_init():
unreferenced object 0xffff00018ecf9400 (size 1024):
comm "modprobe", pid 2707763, jiffies 4300851415 (age 773.308s) backtrace:
[<000000004ca5b312>] __kmalloc+0x4b8/0x7b0
[<00000000953b1072>] try_smi_init+0x148/0x5dc [ipmi_si]
[<000000006460d325>] 0xffff800081b10148
[<0000000039206ea5>] do_one_initcall+0x64/0x2a4
[<00000000601399ce>] do_init_module+0x50/0x300
[<000000003c12ba3c>] load_module+0x7a8/0x9e0
[<00000000c246fffe>] __se_sys_init_module+0x104/0x180
[<00000000eea99093>] __arm64_sys_init_module+0x24/0x30
[<0000000021b1ef87>] el0_svc_common.constprop.0+0x94/0x250
[<0000000070f4f8b7>] do_el0_svc+0x48/0xe0
[<000000005a05337f>] el0_svc+0x24/0x3c
[<000000005eb248d6>] el0_sync_handler+0x160/0x164
[<0000000030a59039>] el0_sync+0x160/0x180The problem was that when an error occurred before handlers registration and after allocating new_smi->si_sm, the variable wouldn't be freed in the error handling afterwards since shutdown_smi() hadn't been registered yet. Fix it by adding a kfree() in the error handling path in try_smi_init().
Message-Id: <[email protected]>
--- drivers/char/ipmi/ipmi_si_intf.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/char/ipmi/ipmi_si_intf.c +5 -0
@@ -2089,6 +2089,11 @@ static int try_smi_init(struct smi_info new_smi->io.io_cleanup =NULL ; } +if (rv && new_smi->si_sm) { +kfree (new_smi->si_sm); + new_smi->si_sm =NULL ; + } +return rv; }
Greg Kroah-Hartman
maintainerPATCH 279/406 ARM: OMAP2+: Fix -Warray-bounds warning in _pwrdm_state_switch()
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit 847fb80cc01a54bc827b02547bb8743bdb59ddab upstream.
If function pwrdm_read_prev_pwrst() returns -EINVAL, we will end up accessing array pwrdm->state_counter through negative index -22. This is wrong and the compiler is legitimately warning us about this potential problem.
Fix this by sanity checking the value stored in variable _prev_ before accessing array pwrdm->state_counter.
Address the following -Warray-bounds warning:arch/arm/mach-omap2/powerdomain.c:178:45: warning: array subscript -22 is below array bounds of 'unsigned int[4]' [-Warray-bounds]
Message-ID: <ZIFVGwImU3kpaGeH@work>
--- arch/arm/mach-omap2/powerdomain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/powerdomain.c +1 -1
@@ -174,7 +174,7 @@ static int _pwrdm_state_switch(struct pobreak ;case PWRDM_STATE_PREV : prev =pwrdm_read_prev_pwrst (pwrdm); -if (pwrdm->state != prev) +if (prev >=0 && pwrdm->state != prev) pwrdm->state_counter[prev]++;if (prev ==PWRDM_POWER_RET )_update_logic_membank_counters (pwrdm);
Greg Kroah-Hartman
maintainerPATCH 280/406 backlight/gpio_backlight: Compare against struct fb_info.device
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit 7b91d017f77c1bda56f27c2f4bbb70de7c6eca08 upstream.
Struct gpio_backlight_platform_data refers to a platform device within the Linux device hierarchy. The test in gpio_backlight_check_fb() compares it against the fbdev device in struct fb_info.dev, which is different. Fix the test by comparing to struct fb_info.device.
Fixes a bug in the backlight driver and prepares fbdev for making struct fb_info.dev optional.
v2:
* move renames into separate patch (Javier, Sam, Michael)
--- drivers/video/backlight/gpio_backlight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/backlight/gpio_backlight.c +1 -1
@@ -35,7 +35,7 @@ static int gpio_backlight_check_fb(struc {struct gpio_backlight *gbl =bl_get_data (bl); -return gbl->fbdev ==NULL || gbl->fbdev == info->dev; +return gbl->fbdev ==NULL || gbl->fbdev == info->device; }static const struct backlight_ops gpio_backlight_ops = {
Greg Kroah-Hartman
maintainerPATCH 281/406 backlight/bd6107: Compare against struct fb_info.device
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit 992bdddaabfba19bdc77c1c7a4977b2aa41ec891 upstream.
Struct bd6107_platform_data refers to a platform device within the Linux device hierarchy. The test in bd6107_backlight_check_fb() compares it against the fbdev device in struct fb_info.dev, which is different. Fix the test by comparing to struct fb_info.device.
Fixes a bug in the backlight driver and prepares fbdev for making struct fb_info.dev optional.
v2:
* move renames into separate patch (Javier, Sam, Michael)
--- drivers/video/backlight/bd6107.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/backlight/bd6107.c +1 -1
@@ -104,7 +104,7 @@ static int bd6107_backlight_check_fb(str {struct bd6107 *bd =bl_get_data (backlight); -return bd->pdata->fbdev ==NULL || bd->pdata->fbdev == info->dev; +return bd->pdata->fbdev ==NULL || bd->pdata->fbdev == info->device; }static const struct backlight_ops bd6107_backlight_ops = {
Greg Kroah-Hartman
maintainerPATCH 282/406 backlight/lv5207lp: Compare against struct fb_info.device
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit 1ca8819320fd84e7d95b04e7668efc5f9fe9fa5c upstream.
Struct lv5207lp_platform_data refers to a platform device within the Linux device hierarchy. The test in lv5207lp_backlight_check_fb() compares it against the fbdev device in struct fb_info.dev, which is different. Fix the test by comparing to struct fb_info.device.
Fixes a bug in the backlight driver and prepares fbdev for making struct fb_info.dev optional.
v2:
* move renames into separate patch (Javier, Sam, Michael)
--- drivers/video/backlight/lv5207lp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/backlight/lv5207lp.c +1 -1
@@ -67,7 +67,7 @@ static int lv5207lp_backlight_check_fb(s {struct lv5207lp *lv =bl_get_data (backlight); -return lv->pdata->fbdev ==NULL || lv->pdata->fbdev == info->dev; +return lv->pdata->fbdev ==NULL || lv->pdata->fbdev == info->device; }static const struct backlight_ops lv5207lp_backlight_ops = {
Greg Kroah-Hartman
maintainerPATCH 283/406 xtensa: PMU: fix base address for the newer hardware
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
commit 687eb3c42f4ad81e7c947c50e2d865f692064291 upstream.
With introduction of ERI access control in RG.0 base address of the PMU unit registers has changed. Add support for the new PMU configuration.
--- arch/xtensa/include/asm/core.h | 9 +++++++++ arch/xtensa/kernel/perf_event.c | 17 +++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-)
arch/xtensa/include/asm/core.h +9 -0
@@ -26,4 +26,13 @@#define XCHAL_SPANNING_WAY 0#endif +#ifndef XCHAL_HW_MIN_VERSION +#if defined(XCHAL_HW_MIN_VERSION_MAJOR ) && defined(XCHAL_HW_MIN_VERSION_MINOR ) +#define XCHAL_HW_MIN_VERSION (XCHAL_HW_MIN_VERSION_MAJOR * 100 + \ + XCHAL_HW_MIN_VERSION_MINOR) +#else +#define XCHAL_HW_MIN_VERSION 0 +#endif +#endif +#endif
arch/xtensa/kernel/perf_event.c +13 -4
@@ -13,17 +13,26 @@#include <linux/perf_event.h> #include <linux/platform_device.h> +#include <asm/core.h> #include <asm/processor.h> #include <asm/stacktrace.h> +#define XTENSA_HWVERSION_RG_2015_0 260000 + +#if XCHAL_HW_MIN_VERSION >=XTENSA_HWVERSION_RG_2015_0 +#define XTENSA_PMU_ERI_BASE 0x00101000 +#else +#define XTENSA_PMU_ERI_BASE 0x00001000 +#endif +/* Global control/status for all perf counters */ -#define XTENSA_PMU_PMG 0x1000 +#define XTENSA_PMU_PMG XTENSA_PMU_ERI_BASE/* Perf counter values */ -#define XTENSA_PMU_PM (i) (0x1080 + (i) * 4) +#define XTENSA_PMU_PM (i) (XTENSA_PMU_ERI_BASE + 0x80 + (i) * 4)/* Perf counter control registers */ -#define XTENSA_PMU_PMCTRL (i) (0x1100 + (i) * 4) +#define XTENSA_PMU_PMCTRL (i) (XTENSA_PMU_ERI_BASE + 0x100 + (i) * 4)/* Perf counter status registers */ -#define XTENSA_PMU_PMSTAT (i) (0x1180 + (i) * 4) +#define XTENSA_PMU_PMSTAT (i) (XTENSA_PMU_ERI_BASE + 0x180 + (i) * 4)#define XTENSA_PMU_PMG_PMEN 0x1
Greg Kroah-Hartman
maintainerPATCH 284/406 arm64: csum: Fix OoB access in IP checksum code for negative lengths
In reply to Greg Kroah-Hartman5.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 8bd795fedb8450ecbef18eeadbd23ed8fc7630f5 upstream.
Although commit c2c24edb1d9c ("arm64: csum: Fix pathological zero-length calls") added an early return for zero-length input, syzkaller has popped up with an example of a _negative_ length which causes an undefined shift and an out-of-bounds read:
| BUG: KASAN: slab-out-of-bounds in do_csum+0x44/0x254 arch/arm64/lib/csum.c:39 | Read of size 4294966928 at addr ffff0000d7ac0170 by task syz-executor412/5975 | | CPU: 0 PID: 5975 Comm: syz-executor412 Not tainted 6.4.0-rc4-syzkaller-g908f31f2a05b #0 | Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023 | Call trace: | dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:233 | show_stack+0x2c/0x44 arch/arm64/kernel/stacktrace.c:240 | __dump_stack lib/dump_stack.c:88 [inline] | dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106 | print_address_description mm/kasan/report.c:351 [inline] | print_report+0x174/0x514 mm/kasan/report.c:462 | kasan_report+0xd4/0x130 mm/kasan/report.c:572 | kasan_check_range+0x264/0x2a4 mm/kasan/generic.c:187 | __kasan_check_read+0x20/0x30 mm/kasan/shadow.c:31 | do_csum+0x44/0x254 arch/arm64/lib/csum.c:39 | csum_partial+0x30/0x58 lib/checksum.c:128 | gso_make_checksum include/linux/skbuff.h:4928 [inline] | __udp_gso_segment+0xaf4/0x1bc4 net/ipv4/udp_offload.c:332 | udp6_ufo_fragment+0x540/0xca0 net/ipv6/udp_offload.c:47 | ipv6_gso_segment+0x5cc/0x1760 net/ipv6/ip6_offload.c:119 | skb_mac_gso_segment+0x2b4/0x5b0 net/core/gro.c:141 | __skb_gso_segment+0x250/0x3d0 net/core/dev.c:3401 | skb_gso_segment include/linux/netdevice.h:4859 [inline] | validate_xmit_skb+0x364/0xdbc net/core/dev.c:3659 | validate_xmit_skb_list+0x94/0x130 net/core/dev.c:3709 | sch_direct_xmit+0xe8/0x548 net/sched/sch_generic.c:327 | __dev_xmit_skb net/core/dev.c:3805 [inline] | __dev_queue_xmit+0x147c/0x3318 net/core/dev.c:4210 | dev_queue_xmit include/linux/netdevice.h:3085 [inline] | packet_xmit+0x6c/0x318 net/packet/af_packet.c:276 | packet_snd net/packet/af_packet.c:3081 [inline] | packet_sendmsg+0x376c/0x4c98 net/packet/af_packet.c:3113 | sock_sendmsg_nosec net/socket.c:724 [inline] | sock_sendmsg net/socket.c:747 [inline] | __sys_sendto+0x3b4/0x538 net/socket.c:2144
Extend the early return to reject negative lengths as well, aligning our implementation with the generic code in lib/checksum.c
--- arch/arm64/lib/csum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/lib/csum.c +1 -1
@@ -24,7 +24,7 @@ unsigned int __no_sanitize_address do_csconst u64 *ptr;u64 data, sum64 =0 ; -if (unlikely (len ==0 )) +if (unlikely (len <=0 ))return 0 ; offset = (unsigned long )buff &7 ;