5.19.17-rc1 review
Subsystems (9)
Greg Kroah-Hartman
maintainerPATCH 306/717 drm/msm: Make .remove and .shutdown HW shutdown consistent
In reply to Greg Kroah-HartmanFrom: Javier Martinez Canillas <[email protected]>
[ Upstream commit 0a58d2ae572adaec8d046f8d35b40c2c32ac7468 ]
Drivers' .remove and .shutdown callbacks are executed on different code paths. The former is called when a device is removed from the bus, while the latter is called at system shutdown time to quiesce the device.
This means that some overlap exists between the two, because both have to take care of properly shutting down the hardware. But currently the logic used in these two callbacks isn't consistent in msm drivers, which could lead to kernel panic.
For example, on .remove the component is deleted and its .unbind callback leads to the hardware being shutdown but only if the DRM device has been marked as registered.
That check doesn't exist in the .shutdown logic and this can lead to the driver calling drm_atomic_helper_shutdown() for a DRM device that hasn't been properly initialized.
A situation like this can happen if drivers for expected sub-devices fail to probe, since the .bind callback will never be executed. If that is the case, drm_atomic_helper_shutdown() will attempt to take mutexes that are only initialized if drm_mode_config_init() is called during a device bind.
This bug was attempted to be fixed in commit 623f279c7781 ("drm/msm: fix shutdown hook in case GPU components failed to bind"), but unfortunately it still happens in some cases as the one mentioned above, i.e:
systemd-shutdown[1]: Powering off.
kvm: exiting hardware virtualization
platform wifi-firmware.0: Removing from iommu group 12 platform video-firmware.0: Removing from iommu group 10
------------[ cut here ]------------
WARNING: CPU: 6 PID: 1 at drivers/gpu/drm/drm_modeset_lock.c:317 drm_modeset_lock_all_ctx+0x3c4/0x3d0
...
Hardware name: Google CoachZ (rev3+) (DT)
pstate: a0400009 (NzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : drm_modeset_lock_all_ctx+0x3c4/0x3d0
lr : drm_modeset_lock_all_ctx+0x48/0x3d0
sp : ffff80000805bb80
x29: ffff80000805bb80 x28: ffff327c00128000 x27: 0000000000000000
x26: 0000000000000000 x25: 0000000000000001 x24: ffffc95d820ec030
x23: ffff327c00bbd090 x22: ffffc95d8215eca0 x21: ffff327c039c5800
x20: ffff327c039c5988 x19: ffff80000805bbe8 x18: 0000000000000034
x17: 000000040044ffff x16: ffffc95d80cac920 x15: 0000000000000000
x14: 0000000000000315 x13: 0000000000000315 x12: 0000000000000000
x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
x8 : ffff80000805bc28 x7 : 0000000000000000 x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000
x2 : ffff327c00128000 x1 : 0000000000000000 x0 : ffff327c039c59b0
Call trace:
drm_modeset_lock_all_ctx+0x3c4/0x3d0
drm_atomic_helper_shutdown+0x70/0x134
msm_drv_shutdown+0x30/0x40
platform_shutdown+0x28/0x40
device_shutdown+0x148/0x350
kernel_power_off+0x38/0x80
__do_sys_reboot+0x288/0x2c0
__arm64_sys_reboot+0x28/0x34
invoke_syscall+0x48/0x114
el0_svc_common.constprop.0+0x44/0xec
do_el0_svc+0x2c/0xc0
el0_svc+0x2c/0x84
el0t_64_sync_handler+0x11c/0x150
el0t_64_sync+0x18c/0x190
---[ end trace 0000000000000000 ]---
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000018
Mem abort info:
ESR = 0x0000000096000004
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x04: level 0 translation fault
Data abort info:
ISV = 0, ISS = 0x00000004
CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=000000010eab1000
[0000000000000018] pgd=0000000000000000, p4d=0000000000000000
Internal error: Oops: 96000004 [#1] PREEMPT SMP
...
Hardware name: Google CoachZ (rev3+) (DT)
pstate: a0400009 (NzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : ww_mutex_lock+0x28/0x32c
lr : drm_modeset_lock_all_ctx+0x1b0/0x3d0
sp : ffff80000805bb50
x29: ffff80000805bb50 x28: ffff327c00128000 x27: 0000000000000000
x26: 0000000000000000 x25: 0000000000000001 x24: 0000000000000018
x23: ffff80000805bc10 x22: ffff327c039c5ad8 x21: ffff327c039c5800
x20: ffff80000805bbe8 x19: 0000000000000018 x18: 0000000000000034
x17: 000000040044ffff x16: ffffc95d80cac920 x15: 0000000000000000
x14: 0000000000000315 x13: 0000000000000315 x12: 0000000000000000
x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
x8 : ffff80000805bc28 x7 : 0000000000000000 x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000
x2 : ffff327c00128000 x1 : 0000000000000000 x0 : 0000000000000018
Call trace:
ww_mutex_lock+0x28/0x32c
drm_modeset_lock_all_ctx+0x1b0/0x3d0
drm_atomic_helper_shutdown+0x70/0x134
msm_drv_shutdown+0x30/0x40
platform_shutdown+0x28/0x40
device_shutdown+0x148/0x350
kernel_power_off+0x38/0x80
__do_sys_reboot+0x288/0x2c0
__arm64_sys_reboot+0x28/0x34
invoke_syscall+0x48/0x114
el0_svc_common.constprop.0+0x44/0xec
do_el0_svc+0x2c/0xc0
el0_svc+0x2c/0x84
el0t_64_sync_handler+0x11c/0x150
el0t_64_sync+0x18c/0x190
Code: aa0103f4 d503201f d2800001 aa0103e3 (c8e37c02)
---[ end trace 0000000000000000 ]---
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
Kernel Offset: 0x495d77c00000 from 0xffff800008000000
PHYS_OFFSET: 0xffffcd8500000000
CPU features: 0x800,00c2a015,19801c82
Memory Limit: none
---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]------ drivers/gpu/drm/msm/msm_drv.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +9 -4
@@ -1169,10 +1169,15 @@ void msm_drv_shutdown(struct platform_device *pdev)struct msm_drm_private *priv =platform_get_drvdata (pdev);struct drm_device *drm = priv ? priv->dev :NULL ; -if (!priv || !priv->kms) -return ; - -drm_atomic_helper_shutdown (drm); +/* +* Shutdown the hw if we're far enough along where things might be on. +* If we run this too early, we'll end up panicking in any variety of +* places. Since we don't register the drm device until late in +* msm_drm_init, drm_dev->registered is used as an indicator that the +* shutdown will be successful. +*/ +if (drm && drm->registered) +drm_atomic_helper_shutdown (drm); }static struct platform_driver msm_platform_driver = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 354/717 ARM: dts: imx6qdl-kontron-samx6i: hook up DDC i2c bus
In reply to Greg Kroah-HartmanFrom: Lucas Stach <[email protected]>
[ Upstream commit afd8f77957e3e83adf21d9229c61ff37f44a177a ]
i2c2 is routed to the pins dedicated as DDC in the module standard. Reduce clock rate to 100kHz to be in line with VESA standard and hook this bus up to the HDMI node.
--- arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi +5 -1
@@ -263,6 +263,10 @@ phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; }; +&hdmi { + ddc-i2c-bus = <&i2c2>; +}; + &i2c_intern { pmic@8 { compatible = "fsl,pfuze100";
@@ -387,7 +391,7 @@ /* HDMI_CTRL */ &i2c2 { - clock-frequency = <375000>; + clock-frequency = <100000>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c2>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 322/717 ALSA: hda: beep: Simplify keep-power-at-enable behavior
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 4c8d695cb9bc5f6fd298a586602947b2fc099a64 ]
The recent fix for IDT codecs to keep the power up while the beep is enabled can be better integrated into the beep helper code. This patch cleans up the code with refactoring.
--- sound/pci/hda/hda_beep.c | 15 +++++++++++++-- sound/pci/hda/hda_beep.h | 1 + sound/pci/hda/patch_sigmatel.c | 25 ++----------------------- 3 files changed, 16 insertions(+), 25 deletions(-)
sound/pci/hda/hda_beep.c +13 -2
@@ -118,6 +118,12 @@ static int snd_hda_beep_event(struct input_dev *dev, unsigned int type,return 0 ; } +static void turn_on_beep (struct hda_beep *beep) +{ +if (beep->keep_power_at_enable) +snd_hda_power_up_pm (beep->codec); +} +static void turn_off_beep (struct hda_beep *beep) {cancel_work_sync (&beep->beep_work);
@@ -125,6 +131,8 @@ static void turn_off_beep(struct hda_beep *beep)/* turn off beep */ generate_tone (beep,0 ); } +if (beep->keep_power_at_enable) +snd_hda_power_down_pm (beep->codec); }/**
@@ -140,7 +148,9 @@ int snd_hda_enable_beep_device(struct hda_codec *codec, int enable) enable = !!enable;if (beep->enabled != enable) { beep->enabled = enable; -if (!enable) +if (enable) +turn_on_beep (beep); +else turn_off_beep (beep);return 1 ; }
@@ -167,7 +177,8 @@ static int beep_dev_disconnect(struct snd_device *device)input_unregister_device (beep->dev); else input_free_device(beep->dev); -turn_off_beep (beep); +if (beep->enabled) +turn_off_beep (beep);return 0 ; }
sound/pci/hda/hda_beep.h +1 -0
@@ -25,6 +25,7 @@ struct hda_beep { unsigned int enabled:1; unsigned int linear_tone:1; /* linear tone for IDT/STAC codec */ unsigned int playing:1; + unsigned int keep_power_at_enable:1; /* set by driver */struct work_struct beep_work;/* scheduled task for beep event */ struct mutex mutex;void (*power_hook)(struct hda_beep *beep,bool on);
sound/pci/hda/patch_sigmatel.c +2 -23
@@ -4311,6 +4311,8 @@ static int stac_parse_auto_config(struct hda_codec *codec)if (codec->beep) {/* IDT/STAC codecs have linear beep tone parameter */ codec->beep->linear_tone = spec->linear_tone_beep; +/* keep power up while beep is enabled */ + codec->beep->keep_power_at_enable =1 ;/* if no beep switch is available, make its own one */ caps =query_amp_caps (codec, nid,HDA_OUTPUT );if (!(caps &AC_AMPCAP_MUTE )) {
@@ -4444,28 +4446,6 @@ static int stac_suspend(struct hda_codec *codec) return 0; } - -static int stac_check_power_status (struct hda_codec *codec,hda_nid_t nid) -{ -#ifdef CONFIG_SND_HDA_INPUT_BEEP -struct sigmatel_spec *spec = codec->spec; -#endif -int ret =snd_hda_gen_check_power_status (codec, nid); - -#ifdef CONFIG_SND_HDA_INPUT_BEEP -if (nid == spec->gen.beep_nid && codec->beep) { -if (codec->beep->enabled != spec->beep_power_on) { - spec->beep_power_on = codec->beep->enabled; -if (spec->beep_power_on) -snd_hda_power_up_pm (codec); -else -snd_hda_power_down_pm (codec); - } - ret |= spec->beep_power_on; - } -#endif -return ret; -}#else #define stac_suspend NULL#endif /* CONFIG_PM */
@@ -4478,7 +4458,6 @@ static const struct hda_codec_ops stac_patch_ops = { .unsol_event = snd_hda_jack_unsol_event, #ifdef CONFIG_PM .suspend = stac_suspend, - .check_power_status = stac_check_power_status,#endif };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 328/717 mmc: au1xmmc: Fix an error handling path in au1xmmc_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 5cbedf52608cc3cbc1c2a9a861fb671620427a20 ]
If clk_prepare_enable() fails, there is no point in calling clk_disable_unprepare() in the error handling path.
Move the out_clk label at the right place.
--- drivers/mmc/host/au1xmmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/au1xmmc.c +2 -1
@@ -1097,8 +1097,9 @@ static int au1xmmc_probe(struct platform_device *pdev)if (host->platdata && host->platdata->cd_setup && !(mmc->caps &MMC_CAP_NEEDS_POLL )) host->platdata->cd_setup (mmc,0 ); -out_clk: +clk_disable_unprepare (host->clk); +out_clk:clk_put (host->clk); out_irq:free_irq (host->irq, host);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 299/717 drm/bridge: it6505: Power on downstream device in .atomic_enable
In reply to Greg Kroah-HartmanFrom: Pin-Yen Lin <[email protected]>
[ Upstream commit fbc1fdaa8338ec4ebd862d918a0ce3e12033e8a3 ]
Send DPCD DP_SET_POWER_D0 command to the monitor in .atomic_enable callback. Without this command, some monitors won't show up again after changing the resolution.
--- drivers/gpu/drm/bridge/ite-it6505.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/bridge/ite-it6505.c +3 -0
@@ -2945,6 +2945,9 @@ static void it6505_bridge_atomic_enable(struct drm_bridge *bridge,if (ret)dev_err (dev,"Failed to setup AVI infoframe: %d" , ret); +it6505_drm_dp_link_set_power (&it6505->aux, &it6505->link, +DP_SET_POWER_D0 ); +it6505_update_video_parameter (it6505, mode); ret =it6505_send_video_infoframe (it6505, &frame);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 315/717 platform/x86: msi-laptop: Fix resource cleanup
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 5523632aa10f906dfe2eb714ee748590dc7fc6b1 ]
Fix the input-device not getting free-ed on probe-errors and fix the msi_touchpad_dwork not getting cancelled on neither probe-errors nor on remove.
--- drivers/platform/x86/msi-laptop.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/platform/x86/msi-laptop.c +3 -0
@@ -1116,6 +1116,8 @@ static int __init msi_init(void) fail_create_group:if (quirks->load_scm_model) {i8042_remove_filter (msi_laptop_i8042_filter); +cancel_delayed_work_sync (&msi_touchpad_dwork); +input_unregister_device (msi_laptop_input_dev);cancel_delayed_work_sync (&msi_rfkill_dwork);cancel_work_sync (&msi_rfkill_work);rfkill_cleanup ();
@@ -1136,6 +1138,7 @@ static void __exit msi_cleanup(void) {if (quirks->load_scm_model) {i8042_remove_filter (msi_laptop_i8042_filter); +cancel_delayed_work_sync (&msi_touchpad_dwork);input_unregister_device (msi_laptop_input_dev);cancel_delayed_work_sync (&msi_rfkill_dwork);cancel_work_sync (&msi_rfkill_work);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 308/717 platform/chrome: fix memory corruption in ioctl
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 8a07b45fd3c2dda24fad43639be5335a4595196a ]
If "s_mem.bytes" is larger than the buffer size it leads to memory corruption.
--- drivers/platform/chrome/cros_ec_chardev.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/platform/chrome/cros_ec_chardev.c +3 -0
@@ -327,6 +327,9 @@ static long cros_ec_chardev_ioctl_readmem(struct cros_ec_dev *ec,if (copy_from_user (&s_mem, arg,sizeof (s_mem)))return -EFAULT ; +if (s_mem.bytes >sizeof (s_mem.buffer)) +return -EINVAL ; + num = ec_dev->cmd_readmem (ec_dev, s_mem.offset, s_mem.bytes, s_mem.buffer);if (num <=0 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 331/717 drm/msm/dpu: index dpu_kms->hw_vbif using vbif_idx
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 7538f80ae0d98bf51eb89eee5344aec219902d42 ]
Remove loops over hw_vbif. Instead always VBIF's idx as an index in the array. This fixes an error in dpu_kms_hw_init(), where we fill dpu_kms->hw_vbif[i], but check for an error pointer at dpu_kms->hw_vbif[vbif_idx].
Patchwork: https://patchwork.freedesktop.org/patch/489569/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 12 ++++------ drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c | 29 +++++++++++------------- 2 files changed, 18 insertions(+), 23 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +5 -7
@@ -825,12 +825,10 @@ static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms)_dpu_kms_mmu_destroy (dpu_kms);if (dpu_kms->catalog) { -for (i =0 ; i < dpu_kms->catalog->vbif_count; i++) { -u32 vbif_idx = dpu_kms->catalog->vbif[i].id; - -if ((vbif_idx <VBIF_MAX ) && dpu_kms->hw_vbif[vbif_idx]) { -dpu_hw_vbif_destroy (dpu_kms->hw_vbif[vbif_idx]); - dpu_kms->hw_vbif[vbif_idx] =NULL ; +for (i =0 ; i <ARRAY_SIZE (dpu_kms->hw_vbif); i++) { +if (dpu_kms->hw_vbif[i]) { +dpu_hw_vbif_destroy (dpu_kms->hw_vbif[i]); + dpu_kms->hw_vbif[i] =NULL ; } } }
@@ -1132,7 +1130,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)for (i =0 ; i < dpu_kms->catalog->vbif_count; i++) {u32 vbif_idx = dpu_kms->catalog->vbif[i].id; - dpu_kms->hw_vbif[i] =dpu_hw_vbif_init (vbif_idx, + dpu_kms->hw_vbif[vbif_idx] =dpu_hw_vbif_init (vbif_idx, dpu_kms->vbif[vbif_idx], dpu_kms->catalog);if (IS_ERR_OR_NULL (dpu_kms->hw_vbif[vbif_idx])) { rc =PTR_ERR (dpu_kms->hw_vbif[vbif_idx]);
drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c +13 -16
@@ -11,6 +11,14 @@#include "dpu_hw_vbif.h" #include "dpu_trace.h" +static struct dpu_hw_vbif *dpu_get_vbif (struct dpu_kms *dpu_kms,enum dpu_vbif vbif_idx) +{ +if (vbif_idx <ARRAY_SIZE (dpu_kms->hw_vbif)) +return dpu_kms->hw_vbif[vbif_idx]; + +return NULL ; +} +/** * _dpu_vbif_wait_for_xin_halt - wait for the xin to halt * @vbif: Pointer to hardware vbif driver
@@ -148,20 +156,15 @@ static u32 _dpu_vbif_get_ot_limit(struct dpu_hw_vbif *vbif,void dpu_vbif_set_ot_limit (struct dpu_kms *dpu_kms,struct dpu_vbif_set_ot_params *params) { -struct dpu_hw_vbif *vbif =NULL ; +struct dpu_hw_vbif *vbif;struct dpu_hw_mdp *mdp;bool forced_on = false;u32 ot_lim; -int ret, i; +int ret; mdp = dpu_kms->hw_mdp; -for (i =0 ; i <ARRAY_SIZE (dpu_kms->hw_vbif); i++) { -if (dpu_kms->hw_vbif[i] && - dpu_kms->hw_vbif[i]->idx == params->vbif_idx) - vbif = dpu_kms->hw_vbif[i]; - } - + vbif =dpu_get_vbif (dpu_kms, params->vbif_idx);if (!vbif || !mdp) {DRM_DEBUG_ATOMIC ("invalid arguments vbif %d mdp %d\n" , vbif !=NULL , mdp !=NULL );
@@ -204,7 +207,7 @@ void dpu_vbif_set_ot_limit(struct dpu_kms *dpu_kms,void dpu_vbif_set_qos_remap (struct dpu_kms *dpu_kms,struct dpu_vbif_set_qos_params *params) { -struct dpu_hw_vbif *vbif =NULL ; +struct dpu_hw_vbif *vbif;struct dpu_hw_mdp *mdp;bool forced_on = false;const struct dpu_vbif_qos_tbl *qos_tbl;
@@ -216,13 +219,7 @@ void dpu_vbif_set_qos_remap(struct dpu_kms *dpu_kms, } mdp = dpu_kms->hw_mdp; -for (i =0 ; i <ARRAY_SIZE (dpu_kms->hw_vbif); i++) { -if (dpu_kms->hw_vbif[i] && - dpu_kms->hw_vbif[i]->idx == params->vbif_idx) { - vbif = dpu_kms->hw_vbif[i]; -break ; - } - } + vbif =dpu_get_vbif (dpu_kms, params->vbif_idx);if (!vbif || !vbif->cap) {DPU_ERROR ("invalid vbif %d\n" , params->vbif_idx);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 358/717 dt-bindings: clock: exynosautov9: correct clock numbering of peric0/c1
In reply to Greg Kroah-HartmanFrom: Chanho Park <[email protected]>
[ Upstream commit b6740089b740b842d5e6ff55b4b2c3bf5961c69a ]
There are duplicated definitions of peric0 and peric1 cmu blocks. Thus, they should be defined correctly as numerical order.
--- .../dt-bindings/clock/samsung,exynosautov9.h | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-)
include/dt-bindings/clock/samsung,exynosautov9.h +28 -28
@@ -226,21 +226,21 @@#define CLK_GOUT_PERIC0_IPCLK_8 28#define CLK_GOUT_PERIC0_IPCLK_9 29#define CLK_GOUT_PERIC0_IPCLK_10 30 -#define CLK_GOUT_PERIC0_IPCLK_11 30 -#define CLK_GOUT_PERIC0_PCLK_0 31 -#define CLK_GOUT_PERIC0_PCLK_1 32 -#define CLK_GOUT_PERIC0_PCLK_2 33 -#define CLK_GOUT_PERIC0_PCLK_3 34 -#define CLK_GOUT_PERIC0_PCLK_4 35 -#define CLK_GOUT_PERIC0_PCLK_5 36 -#define CLK_GOUT_PERIC0_PCLK_6 37 -#define CLK_GOUT_PERIC0_PCLK_7 38 -#define CLK_GOUT_PERIC0_PCLK_8 39 -#define CLK_GOUT_PERIC0_PCLK_9 40 -#define CLK_GOUT_PERIC0_PCLK_10 41 -#define CLK_GOUT_PERIC0_PCLK_11 42 +#define CLK_GOUT_PERIC0_IPCLK_11 31 +#define CLK_GOUT_PERIC0_PCLK_0 32 +#define CLK_GOUT_PERIC0_PCLK_1 33 +#define CLK_GOUT_PERIC0_PCLK_2 34 +#define CLK_GOUT_PERIC0_PCLK_3 35 +#define CLK_GOUT_PERIC0_PCLK_4 36 +#define CLK_GOUT_PERIC0_PCLK_5 37 +#define CLK_GOUT_PERIC0_PCLK_6 38 +#define CLK_GOUT_PERIC0_PCLK_7 39 +#define CLK_GOUT_PERIC0_PCLK_8 40 +#define CLK_GOUT_PERIC0_PCLK_9 41 +#define CLK_GOUT_PERIC0_PCLK_10 42 +#define CLK_GOUT_PERIC0_PCLK_11 43 -#define PERIC0_NR_CLK 43 +#define PERIC0_NR_CLK 44/* CMU_PERIC1 */ #define CLK_MOUT_PERIC1_BUS_USER 1
@@ -272,21 +272,21 @@#define CLK_GOUT_PERIC1_IPCLK_8 28#define CLK_GOUT_PERIC1_IPCLK_9 29#define CLK_GOUT_PERIC1_IPCLK_10 30 -#define CLK_GOUT_PERIC1_IPCLK_11 30 -#define CLK_GOUT_PERIC1_PCLK_0 31 -#define CLK_GOUT_PERIC1_PCLK_1 32 -#define CLK_GOUT_PERIC1_PCLK_2 33 -#define CLK_GOUT_PERIC1_PCLK_3 34 -#define CLK_GOUT_PERIC1_PCLK_4 35 -#define CLK_GOUT_PERIC1_PCLK_5 36 -#define CLK_GOUT_PERIC1_PCLK_6 37 -#define CLK_GOUT_PERIC1_PCLK_7 38 -#define CLK_GOUT_PERIC1_PCLK_8 39 -#define CLK_GOUT_PERIC1_PCLK_9 40 -#define CLK_GOUT_PERIC1_PCLK_10 41 -#define CLK_GOUT_PERIC1_PCLK_11 42 +#define CLK_GOUT_PERIC1_IPCLK_11 31 +#define CLK_GOUT_PERIC1_PCLK_0 32 +#define CLK_GOUT_PERIC1_PCLK_1 33 +#define CLK_GOUT_PERIC1_PCLK_2 34 +#define CLK_GOUT_PERIC1_PCLK_3 35 +#define CLK_GOUT_PERIC1_PCLK_4 36 +#define CLK_GOUT_PERIC1_PCLK_5 37 +#define CLK_GOUT_PERIC1_PCLK_6 38 +#define CLK_GOUT_PERIC1_PCLK_7 39 +#define CLK_GOUT_PERIC1_PCLK_8 40 +#define CLK_GOUT_PERIC1_PCLK_9 41 +#define CLK_GOUT_PERIC1_PCLK_10 42 +#define CLK_GOUT_PERIC1_PCLK_11 43 -#define PERIC1_NR_CLK 43 +#define PERIC1_NR_CLK 44/* CMU_PERIS */ #define CLK_MOUT_PERIS_BUS_USER 1
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 332/717 drm/msm/dp: correct 1.62G link rate at dp_catalog_ctrl_config_msa()
In reply to Greg Kroah-HartmanFrom: Kuogee Hsieh <[email protected]>
[ Upstream commit aa0bff10af1c4b92e6b56e3e1b7f81c660d3ba78 ]
At current implementation there is an extra 0 at 1.62G link rate which cause no correct pixel_div selected for 1.62G link rate to calculate mvid and nvid. This patch delete the extra 0 to have mvid and nvid be calculated correctly.
Changes in v2:
-- fix Fixes tag's text
Changes in v3:
-- fix misspelling of "Reviewed-by"
Patchwork: https://patchwork.freedesktop.org/patch/499328/
--- drivers/gpu/drm/msm/dp/dp_catalog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/dp/dp_catalog.c +1 -1
@@ -431,7 +431,7 @@ void dp_catalog_ctrl_config_msa(struct dp_catalog *dp_catalog,if (rate == link_rate_hbr3) pixel_div =6 ; -else if (rate ==1620000 || rate ==270000 ) +else if (rate ==162000 || rate ==270000 ) pixel_div =2 ;else if (rate == link_rate_hbr2) pixel_div =4 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 323/717 drm/virtio: set fb_modifiers_not_supported
In reply to Greg Kroah-HartmanFrom: Chia-I Wu <[email protected]>
[ Upstream commit 85faca8ca0f659263b5fb2385e4c231cc075bd84 ]
Without this, the drm core advertises LINEAR modifier which is incorrect.
Also userspace virgl does not support modifiers. For example, it causes chrome on ozone/drm to fail with "Failed to create scanout buffer".
--- drivers/gpu/drm/virtio/virtgpu_display.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/virtio/virtgpu_display.c +2 -0
@@ -348,6 +348,8 @@ int virtio_gpu_modeset_init(struct virtio_gpu_device *vgdev) vgdev->ddev->mode_config.max_width =XRES_MAX ; vgdev->ddev->mode_config.max_height =YRES_MAX ; + vgdev->ddev->mode_config.fb_modifiers_not_supported = true; +for (i =0 ; i < vgdev->num_scanouts; ++i)vgdev_output_init (vgdev, i);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 372/717 iio: adc: at91-sama5d2_adc: check return status for pressure and touch
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit d84ace944a3b24529798dbae1340dea098473155 ]
Check return status of at91_adc_read_position() and at91_adc_read_pressure() in at91_adc_read_info_raw().
--- drivers/iio/adc/at91-sama5d2_adc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/iio/adc/at91-sama5d2_adc.c +6 -2
@@ -1544,8 +1544,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, *val = tmp_val;mutex_unlock (&st->lock);iio_device_release_direct_mode (indio_dev); +if (ret >0 ) + ret =at91_adc_adjust_val_osr (st, val); -return at91_adc_adjust_val_osr (st, val); +return ret; }if (chan->type ==IIO_PRESSURE ) { ret =iio_device_claim_direct_mode (indio_dev);
@@ -1558,8 +1560,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, *val = tmp_val;mutex_unlock (&st->lock);iio_device_release_direct_mode (indio_dev); +if (ret >0 ) + ret =at91_adc_adjust_val_osr (st, val); -return at91_adc_adjust_val_osr (st, val); +return ret; }/* in this case we have a voltage channel */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 368/717 arm64: ftrace: fix module PLTs with mcount
In reply to Greg Kroah-HartmanFrom: Mark Rutland <[email protected]>
[ Upstream commit 8cfb08575c6d4585f1ce0deeb189e5c824776b04 ]
Li Huafei reports that mcount-based ftrace with module PLTs was broken by commit:
a6253579977e4c6f ("arm64: ftrace: consistently handle PLTs.")
When a module PLTs are used and a module is loaded sufficiently far away from the kernel, we'll create PLTs for any branches which are out-of-range. These are separate from the special ftrace trampoline PLTs, which the module PLT code doesn't directly manipulate.
When mcount is in use this is a problem, as each mcount callsite in a module will be initialized to point to a module PLT, but since commit a6253579977e4c6f ftrace_make_nop() will assume that the callsite has been initialized to point to the special ftrace trampoline PLT, and ftrace_find_callable_addr() rejects other cases.
This means that when ftrace tries to initialize a callsite via ftrace_make_nop(), the call to ftrace_find_callable_addr() will find that the _mcount stub is out-of-range and is not handled by the ftrace PLT, resulting in a splat:
| ftrace_test: loading out-of-tree module taints kernel. | ftrace: no module PLT for _mcount | ------------[ ftrace bug ]------------ | ftrace failed to modify | [<ffff800029180014>] 0xffff800029180014 | actual: 44:00:00:94 | Initializing ftrace call sites | ftrace record flags: 2000000 | (0) | expected tramp: ffff80000802eb3c | ------------[ cut here ]------------ | WARNING: CPU: 3 PID: 157 at kernel/trace/ftrace.c:2120 ftrace_bug+0x94/0x270 | Modules linked in: | CPU: 3 PID: 157 Comm: insmod Tainted: G O 6.0.0-rc6-00151-gcd722513a189-dirty #22 | Hardware name: linux,dummy-virt (DT) | pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) | pc : ftrace_bug+0x94/0x270 | lr : ftrace_bug+0x21c/0x270 | sp : ffff80000b2bbaf0 | x29: ffff80000b2bbaf0 x28: 0000000000000000 x27: ffff0000c4d38000 | x26: 0000000000000001 x25: ffff800009d7e000 x24: ffff0000c4d86e00 | x23: 0000000002000000 x22: ffff80000a62b000 x21: ffff8000098ebea8 | x20: ffff0000c4d38000 x19: ffff80000aa24158 x18: ffffffffffffffff | x17: 0000000000000000 x16: 0a0d2d2d2d2d2d2d x15: ffff800009aa9118 | x14: 0000000000000000 x13: 6333626532303830 x12: 3030303866666666 | x11: 203a706d61727420 x10: 6465746365707865 x9 : 3362653230383030 | x8 : c0000000ffffefff x7 : 0000000000017fe8 x6 : 000000000000bff4 | x5 : 0000000000057fa8 x4 : 0000000000000000 x3 : 0000000000000001 | x2 : ad2cb14bb5438900 x1 : 0000000000000000 x0 : 0000000000000022 | Call trace: | ftrace_bug+0x94/0x270 | ftrace_process_locs+0x308/0x430 | ftrace_module_init+0x44/0x60 | load_module+0x15b4/0x1ce8 | __do_sys_init_module+0x1ec/0x238 | __arm64_sys_init_module+0x24/0x30 | invoke_syscall+0x54/0x118 | el0_svc_common.constprop.4+0x84/0x100 | do_el0_svc+0x3c/0xd0 | el0_svc+0x1c/0x50 | el0t_64_sync_handler+0x90/0xb8 | el0t_64_sync+0x15c/0x160 | ---[ end trace 0000000000000000 ]--- | ---------test_init-----------
Fix this by reverting to the old behaviour of ignoring the old instruction when initialising an mcount callsite in a module, which was the behaviour prior to commit a6253579977e4c6f.
--- arch/arm64/kernel/ftrace.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
arch/arm64/kernel/ftrace.c +16 -1
@@ -217,11 +217,26 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec,unsigned long pc = rec->ip;u32 old =0 , new; + new =aarch64_insn_gen_nop (); + +/* +* When using mcount, callsites in modules may have been initalized to +* call an arbitrary module PLT (which redirects to the _mcount stub) +* rather than the ftrace PLT we'll use at runtime (which redirects to +* the ftrace trampoline). We can ignore the old PLT when initializing +* the callsite. +* +* Note: 'mod' is only set at module load time. +*/ +if (!IS_ENABLED (CONFIG_DYNAMIC_FTRACE_WITH_REGS ) && +IS_ENABLED (CONFIG_ARM64_MODULE_PLTS ) && mod) { +return aarch64_insn_patch_text_nosync ((void *)pc, new); + } +if (!ftrace_find_callable_addr (rec, mod, &addr))return -EINVAL ; old =aarch64_insn_gen_branch_imm (pc, addr,AARCH64_INSN_BRANCH_LINK ); - new =aarch64_insn_gen_nop ();return ftrace_modify_code (pc, old, new, true); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 337/717 ASoC: da7219: Fix an error handling path in da7219_register_dai_clks()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit abb4e4349afe7eecdb0499582f1c777031e3a7c8 ]
If clk_hw_register() fails, the corresponding clk should not be unregistered.
To handle errors from loops, clean up partial iterations before doing the goto. So add a clk_hw_unregister().
Then use a while (--i >= 0) loop in the unwind section.
--- sound/soc/codecs/da7219.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/codecs/da7219.c +3 -2
@@ -2196,6 +2196,7 @@ static int da7219_register_dai_clks(struct snd_soc_component *component) dai_clk_lookup =clkdev_hw_create (dai_clk_hw, init.name,"%s" ,dev_name (dev));if (!dai_clk_lookup) { +clk_hw_unregister (dai_clk_hw); ret = -ENOMEM ; goto err; }else {
@@ -2217,12 +2218,12 @@ static int da7219_register_dai_clks(struct snd_soc_component *component)return 0 ; err: -do { +while (--i >=0 ) {if (da7219->dai_clks_lookup[i])clkdev_drop (da7219->dai_clks_lookup[i]);clk_hw_unregister (&da7219->dai_clks_hw[i]); - }while (i-- >0 ); + }if (np)kfree (da7219->clk_hw_data);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 375/717 iio: inkern: only release the device node when done with it
In reply to Greg Kroah-HartmanFrom: Nuno Sá <[email protected]>
[ Upstream commit 79c3e84874c7d14f04ad58313b64955a0d2e9437 ]
'of_node_put()' can potentially release the memory pointed to by 'iiospec.np' which would leave us with an invalid pointer (and we would still pass it in 'of_xlate()'). Note that it is not guaranteed for the of_node lifespan to be attached to the device (to which is attached) lifespan so that there is (even though very unlikely) the possibility for the node to be freed while the device is still around. Thus, as there are indeed some of_xlate users which do access the node, a race is indeed possible.
As such, we can only release the node after we are done with it.
--- drivers/iio/inkern.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iio/inkern.c +4 -2
@@ -165,9 +165,10 @@ static int __of_iio_channel_get(struct iio_channel *channel, idev =bus_find_device (&iio_bus_type,NULL , iiospec.np, iio_dev_node_match); -of_node_put (iiospec.np); -if (idev ==NULL ) +if (idev ==NULL ) { +of_node_put (iiospec.np);return -EPROBE_DEFER ; + } indio_dev =dev_to_iio_dev (idev); channel->indio_dev = indio_dev;
@@ -175,6 +176,7 @@ static int __of_iio_channel_get(struct iio_channel *channel, index = indio_dev->info->of_xlate (indio_dev, &iiospec); else index =__of_iio_simple_xlate (indio_dev, &iiospec); +of_node_put (iiospec.np);if (index <0 ) goto err_put; channel->channel = &indio_dev->channels[index];
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 336/717 ASoC: codecs: tx-macro: fix kcontrol put
In reply to Greg Kroah-HartmanFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit c1057a08af438e0cf5450c1d977a3011198ed2f8 ]
tx_macro_tx_mixer_put() and tx_macro_dec_mode_put() currently returns zero eventhough it changes the value.
Fix this, so that change notifications are sent correctly.
--- sound/soc/codecs/lpass-tx-macro.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
sound/soc/codecs/lpass-tx-macro.c +11 -2
@@ -823,17 +823,23 @@ static int tx_macro_tx_mixer_put(struct snd_kcontrol *kcontrol,struct tx_macro *tx =snd_soc_component_get_drvdata (component);if (enable) { +if (tx->active_decimator[dai_id] == dec_id) +return 0 ; +set_bit (dec_id, &tx->active_ch_mask[dai_id]); tx->active_ch_cnt[dai_id]++; tx->active_decimator[dai_id] = dec_id; }else { +if (tx->active_decimator[dai_id] ==-1 ) +return 0 ; + tx->active_ch_cnt[dai_id]--;clear_bit (dec_id, &tx->active_ch_mask[dai_id]); tx->active_decimator[dai_id] =-1 ; }snd_soc_dapm_mixer_update_power (widget->dapm, kcontrol, enable, update); -return 0 ; +return 1 ; } static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w,
@@ -1019,9 +1025,12 @@ static int tx_macro_dec_mode_put(struct snd_kcontrol *kcontrol,int path = e->shift_l;struct tx_macro *tx =snd_soc_component_get_drvdata (component); +if (tx->dec_mode[path] == value) +return 0 ; + tx->dec_mode[path] = value; -return 0 ; +return 1 ; } static int tx_macro_get_bcs(struct snd_kcontrol *kcontrol,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 344/717 ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit 86b46bf1feb83898d89a2b4a8d08d21e9ea277a7 ]
The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context. We fix it by moving pm_runtime_enable to the endding of wm5110_probe.
--- sound/soc/codecs/wm5110.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/wm5110.c +3 -3
@@ -2458,9 +2458,6 @@ static int wm5110_probe(struct platform_device *pdev)regmap_update_bits (arizona->regmap, wm5110_digital_vu[i],WM5110_DIG_VU ,WM5110_DIG_VU ); -pm_runtime_enable (&pdev->dev); -pm_runtime_idle (&pdev->dev); - ret =arizona_request_irq (arizona,ARIZONA_IRQ_DSP_IRQ1 ,"ADSP2 Compressed IRQ" , wm5110_adsp2_irq, wm5110);
@@ -2493,6 +2490,9 @@ static int wm5110_probe(struct platform_device *pdev) goto err_spk_irqs; } +pm_runtime_enable (&pdev->dev); +pm_runtime_idle (&pdev->dev); +return ret; err_spk_irqs:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 97/717 gpio: rockchip: request GPIO mux to pinctrl when setting direction
In reply to Greg Kroah-HartmanFrom: Quentin Schulz <[email protected]>
commit 8ea8af6c8469156ac2042d83d73f6b74eb4b4b45 upstream.
Before the split of gpio and pinctrl sections in their own driver, rockchip_set_mux was called in pinmux_ops.gpio_set_direction for configuring a pin in its GPIO function.
This is essential for cases where pinctrl is "bypassed" by gpio consumers otherwise the GPIO function is not configured for the pin and it does not work. Such was the case for the sysfs/libgpiod userspace GPIO handling.
Let's call pinctrl_gpio_direction_input/output when setting the direction of a GPIO so that the pinctrl core requests from the rockchip pinctrl driver to put the pin in its GPIO function.
--- drivers/gpio/gpio-rockchip.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpio/gpio-rockchip.c +7 -0
@@ -19,6 +19,7 @@#include <linux/of_address.h> #include <linux/of_device.h> #include <linux/of_irq.h> +#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/pinconf-generic.h> #include <linux/regmap.h>
@@ -155,6 +156,12 @@ static int rockchip_gpio_set_direction(sunsigned long flags;u32 data = input ?0 :1 ; + +if (input) +pinctrl_gpio_direction_input (bank->pin_base + offset); +else +pinctrl_gpio_direction_output (bank->pin_base + offset); +raw_spin_lock_irqsave (&bank->slock, flags);rockchip_gpio_writel_bit (bank, offset, data, bank->gpio_regs->port_ddr);raw_spin_unlock_irqrestore (&bank->slock, flags);
Greg Kroah-Hartman
maintainerPATCH 378/717 iio: magnetometer: yas530: Change data type of hard_offsets to signed
In reply to Greg Kroah-HartmanFrom: Jakob Hauser <[email protected]>
[ Upstream commit e137fafc8985cf152a4bb6f18ae83ebb06816df1 ]
The "hard_offsets" are currently unsigned u8 but they should be signed as they can get negative. They are signed in function yas5xx_meaure_offsets() and in the Yamaha drivers [1][2].
[1] https://github.com/NovaFusion/android_kernel_samsung_golden/blob/cm-12.1/drivers/sensor/compass/yas.h#L156
[2] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/GT-I9195I/drivers/iio/magnetometer/yas_mag_drv-yas532.c#L91
--- drivers/iio/magnetometer/yamaha-yas530.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/magnetometer/yamaha-yas530.c +1 -1
@@ -132,7 +132,7 @@ struct yas5xx {unsigned int version;char name[16 ];struct yas5xx_calibration calibration; -u8 hard_offsets[3 ]; +s8 hard_offsets[3 ];struct iio_mount_matrix orientation;struct regmap *map;struct regulator_bulk_data regs[2 ];
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 181/717 cpufreq: amd-pstate: Fix initial highest_perf value
In reply to Greg Kroah-HartmanFrom: Perry Yuan <[email protected]>
[ Upstream commit bedadcfb011fef55273bd686e8893fdd8911dcdb ]
To avoid some new AMD processors use wrong highest perf when amd pstate driver loaded, this fix will query the highest perf from MSR register MSR_AMD_CPPC_CAP1 and cppc_acpi interface firstly, then compare with the highest perf value got by calling amd_get_highest_perf() function.
The lower value will be the correct highest perf we need to use. Otherwise the CPU max MHz will be incorrect if the amd_get_highest_perf() did not cover the new process family and model ID.
Like this lscpu info, the max frequency is incorrect.
Vendor ID: AuthenticAMD
Socket(s): 1
Stepping: 2
CPU max MHz: 5410.0000
CPU min MHz: 400.0000
BogoMIPS: 5600.54--- drivers/cpufreq/amd-pstate.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/cpufreq/amd-pstate.c +12 -2
@@ -152,6 +152,7 @@ static inline int amd_pstate_enable(bool enable)static int pstate_init_perf (struct amd_cpudata *cpudata) {u64 cap1; +u32 highest_perf;int ret =rdmsrl_safe_on_cpu (cpudata->cpu,MSR_AMD_CPPC_CAP1 , &cap1);
@@ -163,7 +164,11 @@ static int pstate_init_perf(struct amd_cpudata *cpudata)* * CPPC entry doesn't indicate the highest performance in some ASICs. */ -WRITE_ONCE (cpudata->highest_perf,amd_get_highest_perf ()); + highest_perf =amd_get_highest_perf (); +if (highest_perf >AMD_CPPC_HIGHEST_PERF (cap1)) + highest_perf =AMD_CPPC_HIGHEST_PERF (cap1); + +WRITE_ONCE (cpudata->highest_perf, highest_perf);WRITE_ONCE (cpudata->nominal_perf,AMD_CPPC_NOMINAL_PERF (cap1));WRITE_ONCE (cpudata->lowest_nonlinear_perf,AMD_CPPC_LOWNONLIN_PERF (cap1));
@@ -175,12 +180,17 @@ static int pstate_init_perf(struct amd_cpudata *cpudata)static int cppc_init_perf (struct amd_cpudata *cpudata) {struct cppc_perf_caps cppc_perf; +u32 highest_perf;int ret =cppc_get_perf_caps (cpudata->cpu, &cppc_perf);if (ret)return ret; -WRITE_ONCE (cpudata->highest_perf,amd_get_highest_perf ()); + highest_perf =amd_get_highest_perf (); +if (highest_perf > cppc_perf.highest_perf) + highest_perf = cppc_perf.highest_perf; + +WRITE_ONCE (cpudata->highest_perf, highest_perf);WRITE_ONCE (cpudata->nominal_perf, cppc_perf.nominal_perf); WRITE_ONCE(cpudata->lowest_nonlinear_perf,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 161/717 KVM: nVMX: Unconditionally purge queued/injected events on nested "exit"
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit d953540430c5af57f5de97ea9e36253908204027 upstream.
Drop pending exceptions and events queued for re-injection when leaving nested guest mode, even if the "exit" is due to VM-Fail, SMI, or forced by host userspace. Failure to purge events could result in an event belonging to L2 being injected into L1.
This _should_ never happen for VM-Fail as all events should be blocked by nested_run_pending, but it's possible if KVM, not the L1 hypervisor, is the source of VM-Fail when running vmcs02.
SMI is a nop (barring unknown bugs) as recognition of SMI and thus entry to SMM is blocked by pending exceptions and re-injected events.
Forced exit is definitely buggy, but has likely gone unnoticed because userspace probably follows the forced exit with KVM_SET_VCPU_EVENTS (or some other ioctl() that purges the queue).
--- arch/x86/kvm/vmx/nested.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
arch/x86/kvm/vmx/nested.c +11 -8
@@ -4264,14 +4264,6 @@ static void prepare_vmcs12(struct kvm_vcnested_vmx_abort (vcpu,VMX_ABORT_SAVE_GUEST_MSR_FAIL ); } - -/* -* Drop what we picked up for L2 via vmx_complete_interrupts. It is -* preserved above and would only end up incorrectly in L1. -*/ - vcpu->arch.nmi_injected = false; -kvm_clear_exception_queue (vcpu); -kvm_clear_interrupt_queue (vcpu); }/*
@@ -4611,6 +4603,17 @@ void nested_vmx_vmexit(struct kvm_vcpu *WARN_ON_ONCE (nested_early_check); } +/* +* Drop events/exceptions that were queued for re-injection to L2 +* (picked up via vmx_complete_interrupts()), as well as exceptions +* that were pending for L2. Note, this must NOT be hoisted above +* prepare_vmcs12(), events/exceptions queued for re-injection need to +* be captured in vmcs12 (see vmcs12_save_pending_event()). +*/ + vcpu->arch.nmi_injected = false; +kvm_clear_exception_queue (vcpu); +kvm_clear_interrupt_queue (vcpu); +vmx_switch_vmcs (vcpu, &vmx->vmcs01);/* Update any VMCS fields that might have changed while L2 ran */
Greg Kroah-Hartman
maintainerPATCH 359/717 ARM: dts: turris-omnia: Fix mpp26 pin name and comment
In reply to Greg Kroah-HartmanFrom: Marek Behún <[email protected]>
[ Upstream commit 49e93898f0dc177e645c22d0664813567fd9ec00 ]
There is a bug in Turris Omnia's schematics, whereupon the MPP[26] pin, which is routed to CN11 pin header, is documented as SPI CS1, but MPP[26] pin does not support this function. Instead it controls chip select 2 if in "spi0" mode.
Fix the name of the pin node in pinctrl node and fix the comment in SPI node.
--- arch/arm/boot/dts/armada-385-turris-omnia.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/armada-385-turris-omnia.dts +2 -2
@@ -478,7 +478,7 @@ marvell,function = "spi0"; }; - spi0cs1_pins: spi0cs1-pins { + spi0cs2_pins: spi0cs2-pins { marvell,pins = "mpp26"; marvell,function = "spi0"; };
@@ -513,7 +513,7 @@ }; }; - /* MISO, MOSI, SCLK and CS1 are routed to pin header CN11 */ + /* MISO, MOSI, SCLK and CS2 are routed to pin header CN11 */ }; &uart0 {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 162/717 KVM: nVMX: Dont propagate vmcs12s PERF_GLOBAL_CTRL settings to vmcs02
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit def9d705c05eab3fdedeb10ad67907513b12038e upstream.
Don't propagate vmcs12's VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL to vmcs02. KVM doesn't disallow L1 from using VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL even when KVM itself doesn't use the control, e.g. due to the various CPU errata that where the MSR can be corrupted on VM-Exit.
Preserve KVM's (vmcs01) setting to hopefully avoid having to toggle the bit in vmcs02 at a later point. E.g. if KVM is loading PERF_GLOBAL_CTRL when running L1, then odds are good KVM will also load the MSR when running L2.
--- arch/x86/kvm/vmx/nested.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/kvm/vmx/nested.c +6 -1
@@ -2322,9 +2322,14 @@ static void prepare_vmcs02_early(struct* are emulated by vmx_set_efer() in prepare_vmcs02(), but speculate * on the related bits (if supported by the CPU) in the hope that * we can avoid VMWrites during vmx_set_efer(). +* +* Similarly, take vmcs01's PERF_GLOBAL_CTRL in the hope that if KVM is +* loading PERF_GLOBAL_CTRL via the VMCS for L1, then KVM will want to +* do the same for L2. */ exec_control =__vm_entry_controls_get (vmcs01); - exec_control |= vmcs12->vm_entry_controls; + exec_control |= (vmcs12->vm_entry_controls & + ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL ); exec_control &= ~(VM_ENTRY_IA32E_MODE |VM_ENTRY_LOAD_IA32_EFER );if (cpu_has_load_ia32_efer ()) {if (guest_efer &EFER_LMA )
Greg Kroah-Hartman
maintainerPATCH 132/717 ext4: fix dir corruption when ext4_dx_add_entry() fails
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit 7177dd009c7c04290891e9a534cd47d1b620bd04 upstream.
Following process may lead to fs corruption:
1. ext4_create(dir/foo)
ext4_add_nondir
ext4_add_entry
ext4_dx_add_entry
a. add_dirent_to_buf
ext4_mark_inode_dirty
ext4_handle_dirty_metadata // dir inode bh is recorded into journal
b. ext4_append // dx_get_count(entries) == dx_get_limit(entries)
ext4_bread(EXT4_GET_BLOCKS_CREATE)
ext4_getblk
ext4_map_blocks
ext4_ext_map_blocks
ext4_mb_new_blocks
dquot_alloc_block
dquot_alloc_space_nodirty
inode_add_bytes // update dir's i_blocks
ext4_ext_insert_extent
ext4_ext_dirty // record extent bh into journal
ext4_handle_dirty_metadata(bh)
// record new block into journal
inode->i_size += inode->i_sb->s_blocksize // new size(in mem)
c. ext4_handle_dirty_dx_node(bh2)
// record dir's new block(dx_node) into journal
d. ext4_handle_dirty_dx_node((frame - 1)->bh)
e. ext4_handle_dirty_dx_node(frame->bh)
f. do_split // ret err!
g. add_dirent_to_buf
ext4_mark_inode_dirty(dir) // update raw_inode on disk(skipped)2. fsck -a /dev/sdb
drop last block(dx_node) which beyonds dir's i_size.
/dev/sdb: recovering journal
/dev/sdb contains a file system with errors, check forced. /dev/sdb: Inode 12, end of extent exceeds allowed value
(logical block 128, physical block 3938, len 1)
3. fsck -fn /dev/sdb
dx_node->entry[i].blk > dir->i_size
Pass 2: Checking directory structure
Problem in HTREE directory inode 12 (/dir): bad block number 128. Clear HTree index? no
Problem in HTREE directory inode 12: block #3 has invalid depth (2) Problem in HTREE directory inode 12: block #3 has bad max hash Problem in HTREE directory inode 12: block #3 not referenced
Fix it by marking inode dirty directly inside ext4_append(). Fetch a reproducer in [Link].
--- fs/ext4/namei.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
fs/ext4/namei.c +10 -5
@@ -85,15 +85,20 @@ static struct buffer_head *ext4_append(hreturn bh; inode->i_size += inode->i_sb->s_blocksize;EXT4_I (inode)->i_disksize = inode->i_size; + err =ext4_mark_inode_dirty (handle, inode); +if (err) + goto out;BUFFER_TRACE (bh,"get_write_access" ); err =ext4_journal_get_write_access (handle, inode->i_sb, bh,EXT4_JTR_NONE ); -if (err) { -brelse (bh); -ext4_std_error (inode->i_sb, err); -return ERR_PTR (err); - } +if (err) + goto out;return bh; + +out: +brelse (bh); +ext4_std_error (inode->i_sb, err); +return ERR_PTR (err); } static int ext4_dx_csum_verify(struct inode *inode,
Greg Kroah-Hartman
maintainerPATCH 142/717 ring-buffer: Check pending waiters when doing wake ups as well
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (Google) <[email protected]>
commit ec0bbc5ec5664dcee344f79373852117dc672c86 upstream.
The wake up waiters only checks the "wakeup_full" variable and not the "full_waiters_pending". The full_waiters_pending is set when a waiter is added to the wait queue. The wakeup_full is only set when an event is triggered, and it clears the full_waiters_pending to avoid multiple calls to irq_work_queue().
The irq_work callback really needs to check both wakeup_full as well as full_waiters_pending such that this code can be used to wake up waiters when a file is closed that represents the ring buffer and the waiters need to be woken up.
--- kernel/trace/ring_buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/trace/ring_buffer.c +2 -1
@@ -917,8 +917,9 @@ static void rb_wake_up_waiters(struct ir struct rb_irq_work *rbwork = container_of(work, struct rb_irq_work, work);wake_up_all (&rbwork->waiters); -if (rbwork->wakeup_full) { +if (rbwork->full_waiters_pending || rbwork->wakeup_full) { rbwork->wakeup_full = false; + rbwork->full_waiters_pending = false;wake_up_all (&rbwork->full_waiters); } }
Greg Kroah-Hartman
maintainerPATCH 158/717 blk-throttle: fix that io throttle can only work for single bio
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
commit 320fb0f91e55ba248d4bad106b408e59099cfa89 upstream.
Test scripts:
cd /sys/fs/cgroup/blkio/
echo "8:0 1024" > blkio.throttle.write_bps_device echo $$ > cgroup.procs
dd if=/dev/zero of=/dev/sda bs=10k count=1 oflag=direct & dd if=/dev/zero of=/dev/sda bs=10k count=1 oflag=direct &
Test result:
10240 bytes (10 kB, 10 KiB) copied, 10.0134 s, 1.0 kB/s 10240 bytes (10 kB, 10 KiB) copied, 10.0135 s, 1.0 kB/s
The problem is that the second bio is finished after 10s instead of 20s.
Root cause:
1) second bio will be flagged:
__blk_throtl_bio
while (true) {
...
if (sq->nr_queued[rw]) -> some bio is throttled already
break
};
bio_set_flag(bio, BIO_THROTTLED); -> flag the bio
2) flagged bio will be dispatched without waiting:
throtl_dispatch_tg
tg_may_dispatch
tg_with_in_bps_limit
if (bps_limit == U64_MAX || bio_flagged(bio, BIO_THROTTLED))
*wait = 0; -> wait time is zero
return true;commit 9f5ede3c01f9 ("block: throttle split bio in case of iops limit") support to count split bios for iops limit, thus it adds flagged bio checking in tg_with_in_bps_limit() so that split bios will only count once for bps limit, however, it introduce a new problem that io throttle won't work if multiple bios are throttled.
In order to fix the problem, handle iops/bps limit in different ways:
1) for iops limit, there is no flag to record if the bio is throttled, and iops is always applied.
2) for bps limit, original bio will be flagged with BIO_BPS_THROTTLED, and io throttle will ignore bio with the flag.
Noted this patch also remove the code to set flag in __bio_clone(), it's introduced in commit 111be8839817 ("block-throttle: avoid double charge"), and author thinks split bio can be resubmited and throttled again, which is wrong because split bio will continue to dispatch from caller.
--- block/bio.c | 2 -- block/blk-throttle.c | 20 ++++++-------------- block/blk-throttle.h | 2 +- include/linux/bio.h | 2 +- include/linux/blk_types.h | 2 +- 5 files changed, 9 insertions(+), 19 deletions(-)
block/bio.c +0 -2
@@ -760,8 +760,6 @@ EXPORT_SYMBOL(bio_put);static int __bio_clone (struct bio *bio,struct bio *bio_src,gfp_t gfp) {bio_set_flag (bio,BIO_CLONED ); -if (bio_flagged (bio_src,BIO_THROTTLED )) -bio_set_flag (bio,BIO_THROTTLED ); bio->bi_ioprio = bio_src->bi_ioprio; bio->bi_iter = bio_src->bi_iter;
block/blk-throttle.c +6 -14
@@ -811,7 +811,7 @@ static bool tg_with_in_bps_limit(structunsigned int bio_size =throtl_bio_data_size (bio);/* no need to throttle if this bio's bytes have been accounted */ -if (bps_limit ==U64_MAX ||bio_flagged (bio,BIO_THROTTLED )) { +if (bps_limit ==U64_MAX ||bio_flagged (bio,BIO_BPS_THROTTLED )) {if (wait) *wait =0 ;return true;
@@ -921,22 +921,13 @@ static void throtl_charge_bio(struct thrunsigned int bio_size =throtl_bio_data_size (bio);/* Charge the bio to the group */ -if (!bio_flagged (bio,BIO_THROTTLED )) { +if (!bio_flagged (bio,BIO_BPS_THROTTLED )) { tg->bytes_disp[rw] += bio_size; tg->last_bytes_disp[rw] += bio_size; } tg->io_disp[rw]++; tg->last_io_disp[rw]++; - -/* -* BIO_THROTTLED is used to prevent the same bio to be throttled -* more than once as a throttled bio will go through blk-throtl the -* second time when it eventually gets issued. Set it when a bio -* is being charged to a tg. -*/ -if (!bio_flagged (bio,BIO_THROTTLED )) -bio_set_flag (bio,BIO_THROTTLED ); }/**
@@ -1026,6 +1017,7 @@ static void tg_dispatch_one_bio(struct t sq->nr_queued[rw]--;throtl_charge_bio (tg, bio); +bio_set_flag (bio,BIO_BPS_THROTTLED );/* * If our parent is another tg, we just need to transfer @bio to
@@ -2159,8 +2151,10 @@ again: qn = &tg->qnode_on_parent[rw]; sq = sq->parent_sq; tg =sq_to_tg (sq); -if (!tg) +if (!tg) { +bio_set_flag (bio,BIO_BPS_THROTTLED ); goto out_unlock; + } }/* out-of-limit, queue to @tg */
@@ -2189,8 +2183,6 @@ again: } out_unlock: -bio_set_flag (bio,BIO_THROTTLED ); -#ifdef CONFIG_BLK_DEV_THROTTLING_LOW if (throttled || !td->track_bio_latency) bio->bi_issue.value |=BIO_ISSUE_THROTL_SKIP_LATENCY ;
block/blk-throttle.h +1 -1
@@ -175,7 +175,7 @@ static inline bool blk_throtl_bio(structstruct throtl_grp *tg =blkg_to_tg (bio->bi_blkg);/* no need to throttle bps any more if the bio has been throttled */ -if (bio_flagged (bio,BIO_THROTTLED ) && +if (bio_flagged (bio,BIO_BPS_THROTTLED ) && !(tg->flags &THROTL_TG_HAS_IOPS_LIMIT ))return false;
include/linux/bio.h +1 -1
@@ -509,7 +509,7 @@ static inline void bio_set_dev(struct bi {bio_clear_flag (bio,BIO_REMAPPED );if (bio->bi_bdev != bdev) -bio_clear_flag (bio,BIO_THROTTLED ); +bio_clear_flag (bio,BIO_BPS_THROTTLED ); bio->bi_bdev = bdev;bio_associate_blkg (bio); }
include/linux/blk_types.h +1 -1
@@ -323,7 +323,7 @@ enum {BIO_QUIET ,/* Make BIO Quiet */ BIO_CHAIN ,/* chained bio, ->bi_remaining in effect */ BIO_REFFED ,/* bio has elevated ->bi_cnt */ -BIO_THROTTLED ,/* This bio has already been subjected to +BIO_BPS_THROTTLED ,/* This bio has already been subjected to * throttling rules. Don't do it again. */ BIO_TRACE_COMPLETION, /* bio_endio() should trace the final completion* of this bio. */
Greg Kroah-Hartman
maintainerPATCH 93/717 slimbus: qcom-ngd: use correct error in message of pdr_add_lookup() failure
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit 5038d21dde818fe74ba1fcb6f2cee35b8c2ebbf2 upstream.
Use correct error code, instead of previous 'ret' value, when printing error from pdr_add_lookup() failure.
--- drivers/slimbus/qcom-ngd-ctrl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/slimbus/qcom-ngd-ctrl.c +2 -1
@@ -1581,8 +1581,9 @@ static int qcom_slim_ngd_ctrl_probe(stru pds =pdr_add_lookup (ctrl->pdr,"avs/audio" ,"msm/adsp/audio_pd" );if (IS_ERR (pds) &&PTR_ERR (pds) != -EALREADY ) { + ret =PTR_ERR (pds);dev_err (dev,"pdr add lookup failed: %d\n" , ret); -return PTR_ERR (pds); +return ret; }platform_driver_register (&qcom_slim_ngd_driver);
Greg Kroah-Hartman
maintainerPATCH 348/717 memory: pl353-smc: Fix refcount leak bug in pl353_smc_probe()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 61b3c876c1cbdb1efd1f52a1f348580e6e14efb6 ]
The break of for_each_available_child_of_node() needs a corresponding of_node_put() when the reference 'child' is not used anymore. Here we do not need to call of_node_put() in fail path as '!match' means no break.
While the of_platform_device_create() will created a new reference by 'child' but it has considered the refcounting.
--- drivers/memory/pl353-smc.c | 1 + 1 file changed, 1 insertion(+)
drivers/memory/pl353-smc.c +1 -0
@@ -122,6 +122,7 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id) }of_platform_device_create (child,NULL , &adev->dev); +of_node_put (child);return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 330/717 drm/msm: lookup the ICC paths in both mdp5/dpu and mdss devices
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 5ccdcecaf8f732f593e359ebfb65de96b11bae66 ]
The commit 6874f48bb8b0 ("drm/msm: make mdp5/dpu devices master components") changed the MDP5 driver to look for the interconnect paths in the MDSS device rather than in the MDP5 device itself. This was left unnoticed since on my testing devices the interconnects probably didn't reach the sync state.
Rather than just using the MDP5 device for ICC path lookups for the MDP5 devices, introduce an additional helper to check both MDP5/DPU and MDSS nodes. This will be helpful for the MDP5->DPU conversion, since the driver will have to check both nodes.
Patchwork: https://patchwork.freedesktop.org/patch/496488/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 7 ++----- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 9 +++------ drivers/gpu/drm/msm/msm_drv.h | 2 ++ drivers/gpu/drm/msm/msm_io_utils.c | 22 ++++++++++++++++++++++ 4 files changed, 29 insertions(+), 11 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +2 -5
@@ -383,12 +383,9 @@ static int dpu_kms_parse_data_bus_icc_path(struct dpu_kms *dpu_kms)struct icc_path *path1;struct drm_device *dev = dpu_kms->dev;struct device *dpu_dev = dev->dev; -struct device *mdss_dev = dpu_dev->parent; -/* Interconnects are a part of MDSS device tree binding, not the -* MDP/DPU device. */ - path0 =of_icc_get (mdss_dev,"mdp0-mem" ); - path1 =of_icc_get (mdss_dev,"mdp1-mem" ); + path0 =msm_icc_get (dpu_dev,"mdp0-mem" ); + path1 =msm_icc_get (dpu_dev,"mdp1-mem" );if (IS_ERR_OR_NULL (path0))return PTR_ERR_OR_ZERO (path0);
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +3 -6
@@ -921,12 +921,9 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev)static int mdp5_setup_interconnect (struct platform_device *pdev) { -/* Interconnects are a part of MDSS device tree binding, not the -* MDP5 device. */ -struct device *mdss_dev = pdev->dev.parent; -struct icc_path *path0 =of_icc_get (mdss_dev,"mdp0-mem" ); -struct icc_path *path1 =of_icc_get (mdss_dev,"mdp1-mem" ); -struct icc_path *path_rot =of_icc_get (mdss_dev,"rotator-mem" ); +struct icc_path *path0 =msm_icc_get (&pdev->dev,"mdp0-mem" ); +struct icc_path *path1 =msm_icc_get (&pdev->dev,"mdp1-mem" ); +struct icc_path *path_rot =msm_icc_get (&pdev->dev,"rotator-mem" );if (IS_ERR (path0))return PTR_ERR (path0);
drivers/gpu/drm/msm/msm_drv.h +2 -0
@@ -442,6 +442,8 @@ void __iomem *msm_ioremap_size(struct platform_device *pdev, const char *name, phys_addr_t *size);void __iomem *msm_ioremap_quiet (struct platform_device *pdev,const char *name); +struct icc_path *msm_icc_get (struct device *dev,const char *name); +#define msm_writel (data, addr) writel((data), (addr))#define msm_readl (addr) readl((addr))
drivers/gpu/drm/msm/msm_io_utils.c +22 -0
@@ -5,6 +5,8 @@* Author: Rob Clark <[email protected]> */ +#include <linux/interconnect.h> +#include "msm_drv.h" /*
@@ -124,3 +126,23 @@ void msm_hrtimer_work_init(struct msm_hrtimer_work *work, work->worker = worker;kthread_init_work (&work->work, fn); } + +struct icc_path *msm_icc_get (struct device *dev,const char *name) +{ +struct device *mdss_dev = dev->parent; +struct icc_path *path; + + path =of_icc_get (dev, name); +if (path) +return path; + +/* +* If there are no interconnects attached to the corresponding device +* node, of_icc_get() will return NULL. +* +* If the MDP5/DPU device node doesn't have interconnects, lookup the +* path in the parent (MDSS) device. +*/ +return of_icc_get (mdss_dev, name); + +}
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 383/717 clk: oxnas: Hold reference returned by of_get_parent()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 1d6aa08c54cd0e005210ab8e3b1e92ede70f8a4f ]
In oxnas_stdclk_probe(), we need to hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance.
--- drivers/clk/clk-oxnas.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/clk/clk-oxnas.c +4 -2
@@ -207,7 +207,7 @@ static const struct of_device_id oxnas_stdclk_dt_ids[] = {static int oxnas_stdclk_probe (struct platform_device *pdev) { -struct device_node *np = pdev->dev.of_node; +struct device_node *np = pdev->dev.of_node, *parent_np;const struct oxnas_stdclk_data *data;struct regmap *regmap;int ret;
@@ -215,7 +215,9 @@ static int oxnas_stdclk_probe(struct platform_device *pdev) data =of_device_get_match_data (&pdev->dev); - regmap =syscon_node_to_regmap (of_get_parent (np)); + parent_np =of_get_parent (np); + regmap =syscon_node_to_regmap (parent_np); +of_node_put (parent_np);if (IS_ERR (regmap)) {dev_err (&pdev->dev,"failed to have parent regmap\n" );return PTR_ERR (regmap);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 73/717 arm64: errata: Add Cortex-A55 to the repeat tlbi list
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
commit 171df58028bf4649460fb146a56a58dcb0c8f75a upstream.
Cortex-A55 is affected by an erratum where in rare circumstances the CPUs may not handle a race between a break-before-make sequence on one CPU, and another CPU accessing the same page. This could allow a store to a page that has been unmapped.
Work around this by adding the affected CPUs to the list that needs TLB sequences to be done twice.
--- Documentation/arm64/silicon-errata.rst | 2 ++ arch/arm64/Kconfig | 17 +++++++++++++++++ arch/arm64/kernel/cpu_errata.c | 5 +++++ 3 files changed, 24 insertions(+)
Documentation/arm64/silicon-errata.rst +2 -0
@@ -76,6 +76,8 @@ stable kernels. +----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A55 | #1530923 | ARM64_ERRATUM_1530923 | +----------------+-----------------+-----------------+-----------------------------+ +| ARM | Cortex-A55 | #2441007 | ARM64_ERRATUM_2441007 | ++----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A57 | #832075 | ARM64_ERRATUM_832075 | +----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A57 | #852523 | N/A |
arch/arm64/Kconfig +17 -0
@@ -629,6 +629,23 @@ config ARM64_ERRATUM_1530923 config ARM64_WORKAROUND_REPEAT_TLBI bool +config ARM64_ERRATUM_2441007 + bool "Cortex-A55: Completion of affected memory accesses might not be guaranteed by completion of a TLBI" + default y + select ARM64_WORKAROUND_REPEAT_TLBI + help + This option adds a workaround for ARM Cortex-A55 erratum #2441007. + + Under very rare circumstances, affected Cortex-A55 CPUs + may not handle a race between a break-before-make sequence on one + CPU, and another CPU accessing the same page. This could allow a + store to a page that has been unmapped. + + Work around this by adding the affected CPUs to the list that needs + TLB sequences to be done twice. + + If unsure, say Y. + config ARM64_ERRATUM_1286807 bool "Cortex-A76: Modification of the translation table for a virtual address might lead to read-after-read ordering violation" default y
arch/arm64/kernel/cpu_errata.c +5 -0
@@ -214,6 +214,11 @@ static const struct arm64_cpu_capabiliti ERRATA_MIDR_RANGE(MIDR_QCOM_KRYO_4XX_GOLD, 0xc, 0xe, 0xf, 0xe), },#endif +#ifdef CONFIG_ARM64_ERRATUM_2441007 + { + ERRATA_MIDR_ALL_VERSIONS(MIDR_CORTEX_A55), + }, +#endif #ifdef CONFIG_ARM64_ERRATUM_2441009 {/* Cortex-A510 r0p0 -> r1p1. Fixed in r1p2 */
Greg Kroah-Hartman
maintainerPATCH 402/717 media: uvcvideo: Use entity get_cur in uvc_ctrl_set
In reply to Greg Kroah-HartmanFrom: Yunke Cao <[email protected]>
[ Upstream commit 5f36851c36b30f713f588ed2b60aa7b4512e2c76 ]
Entity controls should get_cur using an entity-defined function instead of via a query. Fix this in uvc_ctrl_set.
--- drivers/media/usb/uvc/uvc_ctrl.c | 83 ++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 37 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +46 -37
@@ -963,36 +963,56 @@ static s32 __uvc_ctrl_get_value(struct uvc_control_mapping *mapping,return value; } -static int __uvc_ctrl_get (struct uvc_video_chain *chain, -struct uvc_control *ctrl,struct uvc_control_mapping *mapping, -s32 *value) +static int __uvc_ctrl_load_cur (struct uvc_video_chain *chain, +struct uvc_control *ctrl) { +u8 *data;int ret; -if ((ctrl->info.flags &UVC_CTRL_FLAG_GET_CUR ) ==0 ) -return -EACCES ; +if (ctrl->loaded) +return 0 ; -if (!ctrl->loaded) { -if (ctrl->entity->get_cur) { - ret = ctrl->entity->get_cur (chain->dev, - ctrl->entity, - ctrl->info.selector, -uvc_ctrl_data (ctrl,UVC_CTRL_DATA_CURRENT ), - ctrl->info.size); - }else { - ret =uvc_query_ctrl (chain->dev,UVC_GET_CUR , - ctrl->entity->id, - chain->dev->intfnum, - ctrl->info.selector, -uvc_ctrl_data (ctrl,UVC_CTRL_DATA_CURRENT ), - ctrl->info.size); - } -if (ret <0 ) -return ret; + data =uvc_ctrl_data (ctrl,UVC_CTRL_DATA_CURRENT ); +if ((ctrl->info.flags &UVC_CTRL_FLAG_GET_CUR ) ==0 ) { +memset (data,0 , ctrl->info.size); ctrl->loaded =1 ; + +return 0 ; } +if (ctrl->entity->get_cur) + ret = ctrl->entity->get_cur (chain->dev, ctrl->entity, + ctrl->info.selector, data, + ctrl->info.size); +else + ret =uvc_query_ctrl (chain->dev,UVC_GET_CUR , + ctrl->entity->id, chain->dev->intfnum, + ctrl->info.selector, data, + ctrl->info.size); + +if (ret <0 ) +return ret; + + ctrl->loaded =1 ; + +return ret; +} + +static int __uvc_ctrl_get (struct uvc_video_chain *chain, +struct uvc_control *ctrl, +struct uvc_control_mapping *mapping, +s32 *value) +{ +int ret; + +if ((ctrl->info.flags &UVC_CTRL_FLAG_GET_CUR ) ==0 ) +return -EACCES ; + + ret =__uvc_ctrl_load_cur (chain, ctrl); +if (ret <0 ) +return ret; + *value =__uvc_ctrl_get_value (mapping,uvc_ctrl_data (ctrl,UVC_CTRL_DATA_CURRENT ));
@@ -1783,21 +1803,10 @@ int uvc_ctrl_set(struct uvc_fh *handle,* needs to be loaded from the device to perform the read-modify-write * operation. */ -if (!ctrl->loaded && (ctrl->info.size *8 ) != mapping->size) { -if ((ctrl->info.flags &UVC_CTRL_FLAG_GET_CUR ) ==0 ) { -memset (uvc_ctrl_data (ctrl,UVC_CTRL_DATA_CURRENT ), -0 , ctrl->info.size); - }else { - ret =uvc_query_ctrl (chain->dev,UVC_GET_CUR , - ctrl->entity->id, chain->dev->intfnum, - ctrl->info.selector, -uvc_ctrl_data (ctrl,UVC_CTRL_DATA_CURRENT ), - ctrl->info.size); -if (ret <0 ) -return ret; - } - - ctrl->loaded =1 ; +if ((ctrl->info.size *8 ) != mapping->size) { + ret =__uvc_ctrl_load_cur (chain, ctrl); +if (ret <0 ) +return ret; }/* Backup the current value in case we need to rollback later. */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 364/717 arm64: dts: ti: k3-j7200: fix main pinmux range
In reply to Greg Kroah-HartmanFrom: Matt Ranostay <[email protected]>
[ Upstream commit 0d0a0b4413460383331088b2203ba09a6971bc3a ]
Range size of 0x2b4 was incorrect since there isn't 173 configurable pins for muxing. Additionally there is a non-addressable region in the mapping which requires splitting into two ranges.
main_pmx0 -> 67 pinsmain_pmx1 -> 3 pins
--- arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts | 10 ++++++---- arch/arm64/boot/dts/ti/k3-j7200-main.dtsi | 11 ++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts +6 -4
@@ -134,15 +134,17 @@ >; }; - main_usbss0_pins_default: main-usbss0-pins-default { + vdd_sd_dv_pins_default: vdd-sd-dv-pins-default { pinctrl-single,pins = < - J721E_IOPAD(0x120, PIN_OUTPUT, 0) /* (T4) USB0_DRVVBUS */ + J721E_IOPAD(0xd0, PIN_OUTPUT, 7) /* (T5) SPI0_D1.GPIO0_55 */ >; }; +}; - vdd_sd_dv_pins_default: vdd-sd-dv-pins-default { +&main_pmx1 { + main_usbss0_pins_default: main-usbss0-pins-default { pinctrl-single,pins = < - J721E_IOPAD(0xd0, PIN_OUTPUT, 7) /* (T5) SPI0_D1.GPIO0_55 */ + J721E_IOPAD(0x04, PIN_OUTPUT, 0) /* (T4) USB0_DRVVBUS */ >; }; };
arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +10 -1
@@ -295,7 +295,16 @@ main_pmx0: pinctrl@11c000 { compatible = "pinctrl-single"; /* Proxy 0 addressing */ - reg = <0x00 0x11c000 0x00 0x2b4>; + reg = <0x00 0x11c000 0x00 0x10c>; + #pinctrl-cells = <1>; + pinctrl-single,register-width = <32>; + pinctrl-single,function-mask = <0xffffffff>; + }; + + main_pmx1: pinctrl@11c11c { + compatible = "pinctrl-single"; + /* Proxy 0 addressing */ + reg = <0x00 0x11c11c 0x00 0xc>; #pinctrl-cells = <1>; pinctrl-single,register-width = <32>; pinctrl-single,function-mask = <0xffffffff>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 370/717 iomap: iomap: fix memory corruption when recording errors during writeback
In reply to Greg Kroah-HartmanFrom: Darrick J. Wong <[email protected]>
[ Upstream commit 3d5f3ba1ac28059bdf7000cae2403e4e984308d2 ]
Every now and then I see this crash on arm64:
Unable to handle kernel NULL pointer dereference at virtual address 00000000000000f8
Buffer I/O error on dev dm-0, logical block 8733687, async page read
Mem abort info:
ESR = 0x0000000096000006
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x06: level 2 translation fault
Data abort info:
ISV = 0, ISS = 0x00000006
CM = 0, WnR = 0
user pgtable: 64k pages, 42-bit VAs, pgdp=0000000139750000
[00000000000000f8] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000, pmd=0000000000000000
Internal error: Oops: 96000006 [#1] PREEMPT SMP
Buffer I/O error on dev dm-0, logical block 8733688, async page read Dumping ftrace buffer:
Buffer I/O error on dev dm-0, logical block 8733689, async page read
(ftrace buffer empty)
XFS (dm-0): log I/O error -5
Modules linked in: dm_thin_pool dm_persistent_data XFS (dm-0): Metadata I/O Error (0x1) detected at xfs_trans_read_buf_map+0x1ec/0x590 [xfs] (fs/xfs/xfs_trans_buf.c:296). dm_bio_prison
XFS (dm-0): Please unmount the filesystem and rectify the problem(s)
XFS (dm-0): xfs_imap_lookup: xfs_ialloc_read_agi() returned error -5, agno 0
dm_bufio dm_log_writes xfs nft_chain_nat xt_REDIRECT nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip6t_REJECT
potentially unexpected fatal signal 6.
nf_reject_ipv6
potentially unexpected fatal signal 6.
ipt_REJECT nf_reject_ipv4
CPU: 1 PID: 122166 Comm: fsstress Tainted: G W 6.0.0-rc5-djwa #rc5 3004c9f1de887ebae86015f2677638ce51ee7 rpcsec_gss_krb5 auth_rpcgss xt_tcpudp ip_set_hash_ip ip_set_hash_net xt_set nft_compat ip_set_hash_mac ip_set nf_tables Hardware name: QEMU KVM Virtual Machine, BIOS 1.5.1 06/16/2021 pstate: 60001000 (nZCv daif -PAN -UAO -TCO -DIT +SSBS BTYPE=--) ip_tables pc : 000003fd6d7df200 x_tables lr : 000003fd6d7df1ec overlay nfsv4 CPU: 0 PID: 54031 Comm: u4:3 Tainted: G W 6.0.0-rc5-djwa #rc5 3004c9f1de887ebae86015f2677638ce51ee7405 Hardware name: QEMU KVM Virtual Machine, BIOS 1.5.1 06/16/2021 Workqueue: writeback wb_workfn sp : 000003ffd9522fd0 (flush-253:0) pstate: 60401005 (nZCv daif +PAN -UAO -TCO -DIT +SSBS BTYPE=--) pc : errseq_set+0x1c/0x100 x29: 000003ffd9522fd0 x28: 0000000000000023 x27: 000002acefeb6780 x26: 0000000000000005 x25: 0000000000000001 x24: 0000000000000000 x23: 00000000ffffffff x22: 0000000000000005 lr : __filemap_set_wb_err+0x24/0xe0 x21: 0000000000000006
sp : fffffe000f80f760
x29: fffffe000f80f760 x28: 0000000000000003 x27: fffffe000f80f9f8
x26: 0000000002523000 x25: 00000000fffffffb x24: fffffe000f80f868
x23: fffffe000f80fbb0 x22: fffffc0180c26a78 x21: 0000000002530000
x20: 0000000000000000 x19: 0000000000000000 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
x14: 0000000000000001 x13: 0000000000470af3 x12: fffffc0058f70000
x11: 0000000000000040 x10: 0000000000001b20 x9 : fffffe000836b288 x8 : fffffc00eb9fd480 x7 : 0000000000f83659 x6 : 0000000000000000 x5 : 0000000000000869 x4 : 0000000000000005 x3 : 00000000000000f8
x20: 000003fd6d740020 x19: 000000000001dd36 x18: 0000000000000001
x17: 000003fd6d78704c x16: 0000000000000001 x15: 000002acfac87668 x2 : 0000000000000ffa x1 : 00000000fffffffb x0 : 00000000000000f8
Call trace: errseq_set+0x1c/0x100 __filemap_set_wb_err+0x24/0xe0 iomap_do_writepage+0x5e4/0xd5c write_cache_pages+0x208/0x674 iomap_writepages+0x34/0x60 xfs_vm_writepages+0x8c/0xcc [xfs 7a861f39c43631f15d3a5884246ba5035d4ca78b] x14: 0000000000000000 x13: 2064656e72757465 x12: 0000000000002180 x11: 000003fd6d8a82d0 x10: 0000000000000000 x9 : 000003fd6d8ae288 x8 : 0000000000000083 x7 : 00000000ffffffff x6 : 00000000ffffffee x5 : 00000000fbad2887 x4 : 000003fd6d9abb58 x3 : 000003fd6d740020 x2 : 0000000000000006 x1 : 000000000001dd36 x0 : 0000000000000000 CPU: 1 PID: 122167 Comm: fsstress Tainted: G W 6.0.0-rc5-djwa #rc5 3004c9f1de887ebae86015f2677638ce51ee7 do_writepages+0x90/0x1c4 __writeback_single_inode+0x4c/0x4ac Hardware name: QEMU KVM Virtual Machine, BIOS 1.5.1 06/16/2021 writeback_sb_inodes+0x214/0x4ac wb_writeback+0xf4/0x3b0 pstate: 60001000 (nZCv daif -PAN -UAO -TCO -DIT +SSBS BTYPE=--) wb_workfn+0xfc/0x580 process_one_work+0x1e8/0x480 pc : 000003fd6d7df200 worker_thread+0x78/0x430
This crash is a result of iomap_writepage_map encountering some sort of error during writeback and wanting to set that error code in the file mapping so that fsync will report it. Unfortunately, the code dereferences folio->mapping after unlocking the folio, which means that another thread could have removed the page from the page cache (writeback doesn't hold the invalidation lock) and give it to somebody else.
At best we crash the system like above; at worst, we corrupt memory or set an error on some other unsuspecting file while failing to record the problems with *this* file. Regardless, fix the problem by reporting the error to the inode mapping.
NOTE: Commit 598ecfbaa742 lifted the XFS writeback code to iomap, so this fix should be backported to XFS in the 4.6-5.4 kernels in addition to iomap in the 5.5-5.19 kernels.
--- fs/iomap/buffered-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/iomap/buffered-io.c +1 -1
@@ -1412,7 +1412,7 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc,if (!count)folio_end_writeback (folio); done: -mapping_set_error (folio->mapping, error); +mapping_set_error (inode->i_mapping, error);return error; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 385/717 clk: berlin: Add of_node_put() for of_get_parent()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 37c381b812dcbfde9c3f1f3d3e75fdfc1b40d5bc ]
In berlin2_clock_setup() and berlin2q_clock_setup(), we need to call of_node_put() for the reference returned by of_get_parent() which has increased the refcount. We should call *_put() in fail path or when it is not used anymore.
--- drivers/clk/berlin/bg2.c | 5 ++++- drivers/clk/berlin/bg2q.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/clk/berlin/bg2.c +4 -1
@@ -500,12 +500,15 @@ static void __init berlin2_clock_setup(struct device_node *np)int n, ret; clk_data =kzalloc (struct_size (clk_data, hws,MAX_CLKS ),GFP_KERNEL ); -if (!clk_data) +if (!clk_data) { +of_node_put (parent_np);return ; + } clk_data->num =MAX_CLKS ; hws = clk_data->hws; gbase =of_iomap (parent_np,0 ); +of_node_put (parent_np);if (!gbase)return ;
drivers/clk/berlin/bg2q.c +5 -1
@@ -286,19 +286,23 @@ static void __init berlin2q_clock_setup(struct device_node *np)int n, ret; clk_data =kzalloc (struct_size (clk_data, hws,MAX_CLKS ),GFP_KERNEL ); -if (!clk_data) +if (!clk_data) { +of_node_put (parent_np);return ; + } clk_data->num =MAX_CLKS ; hws = clk_data->hws; gbase =of_iomap (parent_np,0 );if (!gbase) { +of_node_put (parent_np);pr_err ("%pOF: Unable to map global base\n" , np);return ; }/* BG2Q CPU PLL is not part of global registers */ cpupll_base =of_iomap (parent_np,1 ); +of_node_put (parent_np);if (!cpupll_base) {pr_err ("%pOF: Unable to map cpupll base\n" , np);iounmap (gbase);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 380/717 usb: common: debug: Check non-standard control requests
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
[ Upstream commit b6155eaf6b05e558218b44b88a6cad03f15a586c ]
Previously usb_decode_ctrl() only decodes standard control requests, but it was used for non-standard requests also. If it's non-standard or unknown standard bRequest, print the Setup data values.
--- drivers/usb/common/debug.c | 96 +++++++++++++++++++++++++------------- 1 file changed, 64 insertions(+), 32 deletions(-)
drivers/usb/common/debug.c +64 -32
@@ -208,30 +208,28 @@ static void usb_decode_set_isoch_delay(__u8 wValue, char *str, size_t size)snprintf (str, size,"Set Isochronous Delay(Delay = %d ns)" , wValue); } -/** -* usb_decode_ctrl - Returns human readable representation of control request. -* @str: buffer to return a human-readable representation of control request. -* This buffer should have about 200 bytes. -* @size: size of str buffer. -* @bRequestType: matches the USB bmRequestType field -* @bRequest: matches the USB bRequest field -* @wValue: matches the USB wValue field (CPU byte order) -* @wIndex: matches the USB wIndex field (CPU byte order) -* @wLength: matches the USB wLength field (CPU byte order) -* -* Function returns decoded, formatted and human-readable description of -* control request packet. -* -* The usage scenario for this is for tracepoints, so function as a return -* use the same value as in parameters. This approach allows to use this -* function in TP_printk -* -* Important: wValue, wIndex, wLength parameters before invoking this function -* should be processed by le16_to_cpu macro. -*/ -const char *usb_decode_ctrl (char *str,size_t size,__u8 bRequestType, -__u8 bRequest,__u16 wValue,__u16 wIndex, -__u16 wLength) +static void usb_decode_ctrl_generic (char *str,size_t size,__u8 bRequestType, +__u8 bRequest,__u16 wValue,__u16 wIndex, +__u16 wLength) +{ +u8 recip = bRequestType &USB_RECIP_MASK ; +u8 type = bRequestType &USB_TYPE_MASK ; + +snprintf (str, size, +"Type=%s Recipient=%s Dir=%s bRequest=%u wValue=%u wIndex=%u wLength=%u" , + (type ==USB_TYPE_STANDARD ) ?"Standard" : + (type ==USB_TYPE_VENDOR ) ?"Vendor" : + (type ==USB_TYPE_CLASS ) ?"Class" :"Unknown" , + (recip ==USB_RECIP_DEVICE ) ?"Device" : + (recip ==USB_RECIP_INTERFACE ) ?"Interface" : + (recip ==USB_RECIP_ENDPOINT ) ?"Endpoint" :"Unknown" , + (bRequestType &USB_DIR_IN ) ?"IN" :"OUT" , + bRequest, wValue, wIndex, wLength); +} + +static void usb_decode_ctrl_standard (char *str,size_t size,__u8 bRequestType, +__u8 bRequest,__u16 wValue,__u16 wIndex, +__u16 wLength) {switch (bRequest) {case USB_REQ_GET_STATUS :
@@ -272,14 +270,48 @@ const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType,usb_decode_set_isoch_delay (wValue, str, size);break ;default : -snprintf (str, size,"%02x %02x %02x %02x %02x %02x %02x %02x" , - bRequestType, bRequest, - (u8)(cpu_to_le16 (wValue) &0xff ), - (u8)(cpu_to_le16 (wValue) >>8 ), - (u8)(cpu_to_le16 (wIndex) &0xff ), - (u8)(cpu_to_le16 (wIndex) >>8 ), - (u8)(cpu_to_le16 (wLength) &0xff ), - (u8)(cpu_to_le16 (wLength) >>8 )); +usb_decode_ctrl_generic (str, size, bRequestType, bRequest, + wValue, wIndex, wLength); +break ; + } +} + +/** +* usb_decode_ctrl - Returns human readable representation of control request. +* @str: buffer to return a human-readable representation of control request. +* This buffer should have about 200 bytes. +* @size: size of str buffer. +* @bRequestType: matches the USB bmRequestType field +* @bRequest: matches the USB bRequest field +* @wValue: matches the USB wValue field (CPU byte order) +* @wIndex: matches the USB wIndex field (CPU byte order) +* @wLength: matches the USB wLength field (CPU byte order) +* +* Function returns decoded, formatted and human-readable description of +* control request packet. +* +* The usage scenario for this is for tracepoints, so function as a return +* use the same value as in parameters. This approach allows to use this +* function in TP_printk +* +* Important: wValue, wIndex, wLength parameters before invoking this function +* should be processed by le16_to_cpu macro. +*/ +const char *usb_decode_ctrl (char *str,size_t size,__u8 bRequestType, +__u8 bRequest,__u16 wValue,__u16 wIndex, +__u16 wLength) +{ +switch (bRequestType &USB_TYPE_MASK ) { +case USB_TYPE_STANDARD : +usb_decode_ctrl_standard (str, size, bRequestType, bRequest, + wValue, wIndex, wLength); +break ; +case USB_TYPE_VENDOR : +case USB_TYPE_CLASS : +default : +usb_decode_ctrl_generic (str, size, bRequestType, bRequest, + wValue, wIndex, wLength); +break ; }return str;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 388/717 clk: tegra: Fix refcount leak in tegra114_clock_init
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit db16a80c76ea395766913082b1e3f939dde29b2c ]
of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/clk/tegra/clk-tegra114.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/tegra/clk-tegra114.c +1 -0
@@ -1317,6 +1317,7 @@ static void __init tegra114_clock_init(struct device_node *np) } pmc_base =of_iomap (node,0 ); +of_node_put (node);if (!pmc_base) {pr_err ("Can't map pmc registers\n" );WARN_ON (1 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 406/717 clk: mediatek: clk-mt8195-vdo0: Set rate on vdo0_dp_intf0_dp_intfs parent
In reply to Greg Kroah-HartmanFrom: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 3f0dadd230cc2630202a977fe52cd1dd7a7579a7 ]
Add the CLK_SET_RATE_PARENT flag to the CLK_VDO0_DP_INTF0_DP_INTF
clock: this is required to trigger clock source selection on CLK_TOP_EDP, while avoiding to manage the enablement of the former separately from the latter in the displayport driver.
--- drivers/clk/mediatek/clk-mt8195-vdo0.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/clk/mediatek/clk-mt8195-vdo0.c +6 -1
@@ -37,6 +37,10 @@ static const struct mtk_gate_regs vdo0_2_cg_regs = {#define GATE_VDO0_2 (_id, _name, _parent, _shift) \ GATE_MTK(_id, _name, _parent, &vdo0_2_cg_regs, _shift, &mtk_clk_gate_ops_setclr) +#define GATE_VDO0_2_FLAGS (_id, _name, _parent, _shift, _flags) \ + GATE_MTK_FLAGS(_id, _name, _parent, &vdo0_2_cg_regs, _shift, \ + &mtk_clk_gate_ops_setclr, _flags) +static const struct mtk_gate vdo0_clks[] = {/* VDO0_0 */ GATE_VDO0_0 (CLK_VDO0_DISP_OVL0 ,"vdo0_disp_ovl0" ,"top_vpp" ,0 ),
@@ -85,7 +89,8 @@ static const struct mtk_gate vdo0_clks[] = {/* VDO0_2 */ GATE_VDO0_2 (CLK_VDO0_DSI0_DSI ,"vdo0_dsi0_dsi" ,"top_dsi_occ" ,0 ),GATE_VDO0_2 (CLK_VDO0_DSI1_DSI ,"vdo0_dsi1_dsi" ,"top_dsi_occ" ,8 ), - GATE_VDO0_2(CLK_VDO0_DP_INTF0_DP_INTF, "vdo0_dp_intf0_dp_intf", "top_edp", 16), +GATE_VDO0_2_FLAGS (CLK_VDO0_DP_INTF0_DP_INTF ,"vdo0_dp_intf0_dp_intf" , + "top_edp", 16, CLK_SET_RATE_PARENT), };static int clk_mt8195_vdo0_probe (struct platform_device *pdev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 356/717 arm64: dts: renesas: r9a07g054: Fix SCI{Rx,Tx} interrupt types
In reply to Greg Kroah-HartmanFrom: Biju Das <[email protected]>
[ Upstream commit 13dec051c7f139eef345c55a60941843e72128f1 ]
As per the RZ/V2L Hardware User's Manual (Rev.1.00 Nov, 2021), the interrupt type of SCI{Rx,Tx} is edge triggered.
--- arch/arm64/boot/dts/renesas/r9a07g054.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/renesas/r9a07g054.dtsi +4 -4
@@ -399,8 +399,8 @@ compatible = "renesas,r9a07g054-sci", "renesas,sci"; reg = <0 0x1004d000 0 0x400>; interrupts = <GIC_SPI 405 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 406 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 407 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 406 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 407 IRQ_TYPE_EDGE_RISING>, <GIC_SPI 408 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G054_SCI0_CLKP>;
@@ -414,8 +414,8 @@ compatible = "renesas,r9a07g054-sci", "renesas,sci"; reg = <0 0x1004d400 0 0x400>; interrupts = <GIC_SPI 409 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 410 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 411 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 410 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 411 IRQ_TYPE_EDGE_RISING>, <GIC_SPI 412 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G054_SCI1_CLKP>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 365/717 ARM: dts: exynos: correct s5k6a3 reset polarity on Midas family
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit 3ba2d4bb9592bf7a6a3fe3dbe711ecfc3d004bab ]
According to s5k6a3 driver code, the reset line for the chip appears to be active low. This also matches the typical polarity of reset lines in general. Let's fix it up as having correct polarity in DTS is important when the driver will be switched over to gpiod API.
--- arch/arm/boot/dts/exynos4412-midas.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-midas.dtsi +1 -1
@@ -585,7 +585,7 @@ clocks = <&camera 1>; clock-names = "extclk"; samsung,camclk-out = <1>; - gpios = <&gpm1 6 GPIO_ACTIVE_HIGH>; + gpios = <&gpm1 6 GPIO_ACTIVE_LOW>; port { is_s5k6a3_ep: endpoint {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 357/717 arm64: dts: renesas: r9a07g043: Fix SCI{Rx,Tx} interrupt types
In reply to Greg Kroah-HartmanFrom: Biju Das <[email protected]>
[ Upstream commit 72a482dbaec4b9e4d54b81be6bdb8c016fd2f4bd ]
As per the RZ/G2UL Hardware User's Manual (Rev.1.00 Apr, 2022), the interrupt type of SCI{Rx,Tx} is edge triggered.
--- arch/arm64/boot/dts/renesas/r9a07g043.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/renesas/r9a07g043.dtsi +4 -4
@@ -334,8 +334,8 @@ compatible = "renesas,r9a07g043-sci", "renesas,sci"; reg = <0 0x1004d000 0 0x400>; interrupts = <GIC_SPI 405 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 406 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 407 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 406 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 407 IRQ_TYPE_EDGE_RISING>, <GIC_SPI 408 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G043_SCI0_CLKP>;
@@ -349,8 +349,8 @@ compatible = "renesas,r9a07g043-sci", "renesas,sci"; reg = <0 0x1004d400 0 0x400>; interrupts = <GIC_SPI 409 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 410 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 411 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 410 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 411 IRQ_TYPE_EDGE_RISING>, <GIC_SPI 412 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G043_SCI1_CLKP>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 392/717 HSI: omap_ssi_port: Fix dma_map_sg error check
In reply to Greg Kroah-HartmanFrom: Jack Wang <[email protected]>
[ Upstream commit 551e325bbd3fb8b5a686ac1e6cf76e5641461cf2 ]
dma_map_sg return 0 on error, in case of error return -EIO to caller.
--- drivers/hsi/controllers/omap_ssi_port.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/hsi/controllers/omap_ssi_port.c +4 -4
@@ -230,10 +230,10 @@ static int ssi_start_dma(struct hsi_msg *msg, int lch)if (msg->ttype ==HSI_MSG_READ ) { err =dma_map_sg (&ssi->device, msg->sgt.sgl, msg->sgt.nents,DMA_FROM_DEVICE ); -if (err <0 ) { +if (!err) {dev_dbg (&ssi->device,"DMA map SG failed !\n" );pm_runtime_put_autosuspend (omap_port->pdev); -return err; +return -EIO ; } csdp = SSI_DST_BURST_4x32_BIT |SSI_DST_MEMORY_PORT | SSI_SRC_SINGLE_ACCESS0 | SSI_SRC_PERIPHERAL_PORT |
@@ -247,10 +247,10 @@ static int ssi_start_dma(struct hsi_msg *msg, int lch) }else { err =dma_map_sg (&ssi->device, msg->sgt.sgl, msg->sgt.nents,DMA_TO_DEVICE ); -if (err <0 ) { +if (!err) {dev_dbg (&ssi->device,"DMA map SG failed !\n" );pm_runtime_put_autosuspend (omap_port->pdev); -return err; +return -EIO ; } csdp = SSI_SRC_BURST_4x32_BIT |SSI_SRC_MEMORY_PORT | SSI_DST_SINGLE_ACCESS0 | SSI_DST_PERIPHERAL_PORT |
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 400/717 media: meson: vdec: add missing clk_disable_unprepare on error in vdec_hevc_start()
In reply to Greg Kroah-HartmanFrom: Xu Qiang <[email protected]>
[ Upstream commit 4029372233e13e281f8c387f279f9f064ced3810 ]
Add the missing clk_disable_unprepare() before return from vdec_hevc_start() in the error handling case.
--- drivers/staging/media/meson/vdec/vdec_hevc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/staging/media/meson/vdec/vdec_hevc.c +5 -1
@@ -167,8 +167,12 @@ static int vdec_hevc_start(struct amvdec_session *sess)clk_set_rate (core->vdec_hevc_clk,666666666 ); ret =clk_prepare_enable (core->vdec_hevc_clk); -if (ret) +if (ret) { +if (core->platform->revision ==VDEC_REVISION_G12A || + core->platform->revision ==VDEC_REVISION_SM1 ) +clk_disable_unprepare (core->vdec_hevcf_clk);return ret; + }if (core->platform->revision ==VDEC_REVISION_SM1 ) regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 199/717 x86/paravirt: add extra clobbers with ZERO_CALL_USED_REGS enabled
In reply to Greg Kroah-HartmanFrom: Bill Wendling <[email protected]>
[ Upstream commit 8c86f29bfb18465d15b05cfd26a6454ec787b793 ]
The ZERO_CALL_USED_REGS feature may zero out caller-saved registers before returning.
In spurious_kernel_fault(), the "pte_offset_kernel()" call results in this assembly code:
.Ltmp151:
#APP
# ALT: oldnstr
.Ltmp152:
.Ltmp153:
.Ltmp154:
.section .discard.retpoline_safe,"",@progbits
.quad .Ltmp154
.text
callq *pv_ops+536(%rip).Ltmp155:
.section .parainstructions,"a",@progbits
.p2align 3, 0x0
.quad .Ltmp153
.byte 67
.byte .Ltmp155-.Ltmp153
.short 1
.text.Ltmp156:
# ALT: padding
.zero (-(((.Ltmp157-.Ltmp158)-(.Ltmp156-.Ltmp152))>0))*((.Ltmp157-.Ltmp158)-(.Ltmp156-.Ltmp152)),144
.Ltmp159:
.section .altinstructions,"a",@progbits
.Ltmp160:
.long .Ltmp152-.Ltmp160
.Ltmp161:
.long .Ltmp158-.Ltmp161
.short 33040
.byte .Ltmp159-.Ltmp152
.byte .Ltmp157-.Ltmp158.text
.section .altinstr_replacement,"ax",@progbits
# ALT: replacement 1
.Ltmp158:
movq %rdi, %rax
.Ltmp157:
.text
#NO_APP
.Ltmp162:
testb $-128, %dilThe "testb" here is using %dil, but the %rdi register was cleared before returning from "callq *pv_ops+536(%rip)". Adding the proper constraints results in the use of a different register:
movq %r11, %rdi
# Similar to above.
testb $-128, %r11b--- arch/x86/include/asm/paravirt_types.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
arch/x86/include/asm/paravirt_types.h +10 -1
@@ -414,8 +414,17 @@ int paravirt_disable_iospace(void); "=c" (__ecx)#define PVOP_CALL_CLOBBERS PVOP_VCALL_CLOBBERS, "=a" (__eax) -/* void functions are still allowed [re]ax for scratch */ +/* +* void functions are still allowed [re]ax for scratch. +* +* The ZERO_CALL_USED REGS feature may end up zeroing out callee-saved +* registers. Make sure we model this with the appropriate clobbers. +*/ +#ifdef CONFIG_ZERO_CALL_USED_REGS +#define PVOP_VCALLEE_CLOBBERS "=a" (__eax), PVOP_VCALL_CLOBBERS +#else #define PVOP_VCALLEE_CLOBBERS "=a" (__eax) +#endif #define PVOP_CALLEE_CLOBBERS PVOP_VCALLEE_CLOBBERS#define EXTRA_CLOBBERS , "r8", "r9", "r10", "r11"
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 366/717 ARM: Drop CMDLINE_* dependency on ATAGS
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 136f4b1ec7c962ee37a787e095fd37b058d72bd3 ]
On arm32, the configuration options to specify the kernel command line type depend on ATAGS. However, the actual CMDLINE cofiguration option does not depend on ATAGS, and the code that handles this is not specific to ATAGS (see drivers/of/fdt.c:early_init_dt_scan_chosen()).
Hence users who desire to override the kernel command line on arm32 must enable support for ATAGS, even on a pure-DT system. Other architectures (arm64, loongarch, microblaze, nios2, powerpc, and riscv) do not impose such a restriction.
Hence drop the dependency on ATAGS.
--- arch/arm/Kconfig | 1 - 1 file changed, 1 deletion(-)
arch/arm/Kconfig +0 -1
@@ -1653,7 +1653,6 @@ config CMDLINE choice prompt "Kernel command line type" if CMDLINE != "" default CMDLINE_FROM_BOOTLOADER - depends on ATAGS config CMDLINE_FROM_BOOTLOADER bool "Use bootloader kernel arguments if available"
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 408/717 clk: mediatek: mt8195-infra_ao: Set pwrmcu clocks as critical
In reply to Greg Kroah-HartmanFrom: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 3f10f49cd9f8ab6471639d4ca2c6db9451121779 ]
The pwrmcu is responsible for power management and idle states in SSPM:
on older SoCs this was managed in Linux drivers like sspm/mcupm/eemgpu but, at least on MT8195, this functionality was transferred to the ATF firmware.
For this reason, turning off the pwrmcu related clocks from the kernel will lead to unability to resume the platform after suspend and other currently unknown PM related side-effects.
Set the PWRMCU and PWRMCU_BUS_H clocks as critical to prevent the kernel from turning them off, fixing the aforementioned issue.
--- drivers/clk/mediatek/clk-mt8195-infra_ao.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/clk/mediatek/clk-mt8195-infra_ao.c +10 -3
@@ -54,8 +54,12 @@ static const struct mtk_gate_regs infra_ao4_cg_regs = {#define GATE_INFRA_AO1 (_id, _name, _parent, _shift) \ GATE_INFRA_AO1_FLAGS(_id, _name, _parent, _shift, 0) +#define GATE_INFRA_AO2_FLAGS (_id, _name, _parent, _shift, _flag) \ + GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao2_cg_regs, _shift, \ + &mtk_clk_gate_ops_setclr, _flag) +#define GATE_INFRA_AO2 (_id, _name, _parent, _shift) \ - GATE_MTK(_id, _name, _parent, &infra_ao2_cg_regs, _shift, &mtk_clk_gate_ops_setclr) + GATE_INFRA_AO2_FLAGS(_id, _name, _parent, _shift, 0)#define GATE_INFRA_AO3_FLAGS (_id, _name, _parent, _shift, _flag) \ GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao3_cg_regs, _shift, \
@@ -135,8 +139,11 @@ static const struct mtk_gate infra_ao_clks[] = {GATE_INFRA_AO2 (CLK_INFRA_AO_UNIPRO_SYS ,"infra_ao_unipro_sys" ,"top_ufs" ,11 ),GATE_INFRA_AO2 (CLK_INFRA_AO_UNIPRO_TICK ,"infra_ao_unipro_tick" ,"top_ufs_tick1us" ,12 ),GATE_INFRA_AO2 (CLK_INFRA_AO_UFS_MP_SAP_B ,"infra_ao_ufs_mp_sap_b" ,"top_ufs_mp_sap_cfg" ,13 ), -GATE_INFRA_AO2 (CLK_INFRA_AO_PWRMCU ,"infra_ao_pwrmcu" ,"top_pwrmcu" ,15 ), -GATE_INFRA_AO2 (CLK_INFRA_AO_PWRMCU_BUS_H ,"infra_ao_pwrmcu_bus_h" ,"top_axi" ,17 ), +/* pwrmcu is used by ATF for platform PM: clocks must never be disabled by the kernel */ +GATE_INFRA_AO2_FLAGS (CLK_INFRA_AO_PWRMCU ,"infra_ao_pwrmcu" ,"top_pwrmcu" ,15 , +CLK_IS_CRITICAL ), +GATE_INFRA_AO2_FLAGS (CLK_INFRA_AO_PWRMCU_BUS_H ,"infra_ao_pwrmcu_bus_h" ,"top_axi" ,17 , +CLK_IS_CRITICAL ),GATE_INFRA_AO2 (CLK_INFRA_AO_APDMA_B ,"infra_ao_apdma_b" ,"top_axi" ,18 ),GATE_INFRA_AO2 (CLK_INFRA_AO_SPI4 ,"infra_ao_spi4" ,"top_spi" ,25 ), GATE_INFRA_AO2(CLK_INFRA_AO_SPI5, "infra_ao_spi5", "top_spi", 26),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 403/717 media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 1c78f19c3a0ea312a8178a6bfd8934eb93e9b10a ]
of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/media/platform/xilinx/xilinx-vipp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/media/platform/xilinx/xilinx-vipp.c +5 -4
@@ -471,7 +471,7 @@ static int xvip_graph_dma_init(struct xvip_composite_device *xdev) {struct device_node *ports;struct device_node *port; -int ret; +int ret =0 ; ports =of_get_child_by_name (xdev->dev->of_node,"ports" );if (ports ==NULL ) {
@@ -481,13 +481,14 @@ static int xvip_graph_dma_init(struct xvip_composite_device *xdev)for_each_child_of_node (ports, port) { ret =xvip_graph_dma_init_one (xdev, port); -if (ret <0 ) { +if (ret) {of_node_put (port); -return ret; +break ; } } -return 0 ; +of_node_put (ports); +return ret; }static void xvip_graph_cleanup (struct xvip_composite_device *xdev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 404/717 RDMA/rxe: Fix "kernel NULL pointer dereference" error
In reply to Greg Kroah-HartmanFrom: Zhu Yanjun <[email protected]>
[ Upstream commit a625ca30eff806395175ebad3ac1399014bdb280 ]
When rxe_queue_init in the function rxe_qp_init_req fails, both qp->req.task.func and qp->req.task.arg are not initialized.
Because of creation of qp fails, the function rxe_create_qp will call rxe_qp_do_cleanup to handle allocated resource.
Before calling __rxe_do_task, both qp->req.task.func and qp->req.task.arg should be checked.
--- drivers/infiniband/sw/rxe/rxe_qp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_qp.c +3 -1
@@ -794,7 +794,9 @@ static void rxe_qp_do_cleanup(struct work_struct *work)rxe_cleanup_task (&qp->comp.task);/* flush out any receive wr's or pending requests */ -__rxe_do_task (&qp->req.task); +if (qp->req.task.func) +__rxe_do_task (&qp->req.task); +if (qp->sq.queue) {__rxe_do_task (&qp->comp.task);__rxe_do_task (&qp->req.task);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 39/717 btf: Export bpf_dynptr definition
In reply to Greg Kroah-HartmanFrom: Roberto Sassu <[email protected]>
commit 00f146413ccb6c84308e559281449755c83f54c5 upstream.
eBPF dynamic pointers is a new feature recently added to upstream. It binds together a pointer to a memory area and its size. The internal kernel structure bpf_dynptr_kern is not accessible by eBPF programs in user space. They instead see bpf_dynptr, which is then translated to the internal kernel structure by the eBPF verifier.
The problem is that it is not possible to include at the same time the uapi include linux/bpf.h and the vmlinux BTF vmlinux.h, as they both contain the definition of some structures/enums. The compiler complains saying that the structures/enums are redefined.
As bpf_dynptr is defined in the uapi include linux/bpf.h, this makes it impossible to include vmlinux.h. However, in some cases, e.g. when using kfuncs, vmlinux.h has to be included. The only option until now was to include vmlinux.h and add the definition of bpf_dynptr directly in the eBPF program source code from linux/bpf.h.
Solve the problem by using the same approach as for bpf_timer (which also follows the same scheme with the _kern suffix for the internal kernel structure).
Add the following line in one of the dynamic pointer helpers, bpf_dynptr_from_mem():
BTF_TYPE_EMIT(struct bpf_dynptr);
--- kernel/bpf/helpers.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/bpf/helpers.c +2 -0
@@ -1468,6 +1468,8 @@ BPF_CALL_4(bpf_dynptr_from_mem, void *, {int err; +BTF_TYPE_EMIT (struct bpf_dynptr ); + err =bpf_dynptr_check_size (size);if (err) goto error;
Greg Kroah-Hartman
maintainerPATCH 405/717 RDMA/rxe: Fix the error caused by qp->sk
In reply to Greg Kroah-HartmanFrom: Zhu Yanjun <[email protected]>
[ Upstream commit 548ce2e66725dcba4e27d1e8ac468d5dd17fd509 ]
When sock_create_kern in the function rxe_qp_init_req fails, qp->sk is set to NULL.
Then the function rxe_create_qp will call rxe_qp_do_cleanup to handle allocated resource.
Before handling qp->sk, this variable should be checked.
--- drivers/infiniband/sw/rxe/rxe_qp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/sw/rxe/rxe_qp.c +4 -2
@@ -832,8 +832,10 @@ static void rxe_qp_do_cleanup(struct work_struct *work)free_rd_atomic_resources (qp); -kernel_sock_shutdown (qp->sk,SHUT_RDWR ); -sock_release (qp->sk); +if (qp->sk) { +kernel_sock_shutdown (qp->sk,SHUT_RDWR ); +sock_release (qp->sk); + } }/* called when the last reference to the qp is dropped */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 410/717 fpga: prevent integer overflow in dfl_feature_ioctl_set_irq()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 939bc5453b8cbdde9f1e5110ce8309aedb1b501a ]
The "hdr.count * sizeof(s32)" multiplication can overflow on 32 bit systems leading to memory corruption. Use array_size() to fix that.
--- drivers/fpga/dfl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/dfl.c +1 -1
@@ -1866,7 +1866,7 @@ long dfl_feature_ioctl_set_irq(struct platform_device *pdev,return -EINVAL ; fds =memdup_user ((void __user *)(arg +sizeof (hdr)), - hdr.count *sizeof (s32)); +array_size (hdr.count,sizeof (s32)));if (IS_ERR (fds))return PTR_ERR (fds);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 369/717 ARM: dts: exynos: fix polarity of VBUS GPIO of Origen
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit a08137bd1e0a7ce951dce9ce4a83e39d379b6e1b ]
EHCI Oxynos (drivers/usb/host/ehci-exynos.c) drives VBUS GPIO high when trying to power up the bus, therefore the GPIO in DTS must be marked as "active high". This will be important when EHCI driver is converted to gpiod API that respects declared polarities.
--- arch/arm/boot/dts/exynos4412-origen.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-origen.dts +1 -1
@@ -95,7 +95,7 @@ }; &ehci { - samsung,vbus-gpio = <&gpx3 5 1>; + samsung,vbus-gpio = <&gpx3 5 GPIO_ACTIVE_HIGH>; status = "okay"; phys = <&exynos_usbphy 2>, <&exynos_usbphy 3>; phy-names = "hsic0", "hsic1";
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 416/717 usb: gadget: f_fs: stricter integer overflow checks
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit f57004b9d96755cd6a243b51c267be4016b4563c ]
This from static analysis. The vla_item() takes a size and adds it to the total. It has a built in integer overflow check so if it encounters an integer overflow anywhere then it records the total as SIZE_MAX.
However there is an issue here because the "lang_count*(needed_count+1)" multiplication can overflow. Technically the "lang_count + 1" addition could overflow too, but that would be detected and is harmless. Fix both using the new size_add() and size_mul() functions.
--- drivers/usb/gadget/function/f_fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_fs.c +2 -2
@@ -2645,10 +2645,10 @@ static int __ffs_data_got_strings(struct ffs_data *ffs,unsigned i =0 ;vla_group (d); vla_item(d, struct usb_gadget_strings *, stringtabs, - lang_count +1 ); +size_add (lang_count,1 )); vla_item(d, struct usb_gadget_strings, stringtab, lang_count); vla_item(d, struct usb_string, strings, - lang_count*(needed_count+1 )); +size_mul (lang_count, (needed_count +1 )));char *vlabuf =kmalloc (vla_group_size (d),GFP_KERNEL );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 413/717 dmaengine: hisilicon: Disable channels when unregister hisi_dma
In reply to Greg Kroah-HartmanFrom: Jie Hai <[email protected]>
[ Upstream commit e3bdaa04ada31f46d0586df83a2789b8913053c5 ]
When hisi_dma is unloaded or unbinded, all of channels should be disabled. This patch disables DMA channels when driver is unloaded or unbinded.
--- drivers/dma/hisi_dma.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/dma/hisi_dma.c +9 -5
@@ -180,7 +180,8 @@ static void hisi_dma_reset_qp_point(struct hisi_dma_dev *hdma_dev, u32 index)hisi_dma_chan_write (hdma_dev->base,HISI_DMA_CQ_HEAD_PTR , index,0 ); } -static void hisi_dma_reset_hw_chan (struct hisi_dma_chan *chan) +static void hisi_dma_reset_or_disable_hw_chan (struct hisi_dma_chan *chan, +bool disable) {struct hisi_dma_dev *hdma_dev = chan->hdma_dev;u32 index = chan->qp_num, tmp;
@@ -201,8 +202,11 @@ static void hisi_dma_reset_hw_chan(struct hisi_dma_chan *chan)hisi_dma_do_reset (hdma_dev, index);hisi_dma_reset_qp_point (hdma_dev, index);hisi_dma_pause_dma (hdma_dev, index, false); -hisi_dma_enable_dma (hdma_dev, index, true); -hisi_dma_unmask_irq (hdma_dev, index); + +if (!disable) { +hisi_dma_enable_dma (hdma_dev, index, true); +hisi_dma_unmask_irq (hdma_dev, index); + } ret = readl_relaxed_poll_timeout(hdma_dev->base + HISI_DMA_Q_FSM_STS + index * HISI_DMA_OFFSET, tmp,
@@ -218,7 +222,7 @@ static void hisi_dma_free_chan_resources(struct dma_chan *c)struct hisi_dma_chan *chan =to_hisi_dma_chan (c);struct hisi_dma_dev *hdma_dev = chan->hdma_dev; -hisi_dma_reset_hw_chan (chan); +hisi_dma_reset_or_disable_hw_chan (chan, false);vchan_free_chan_resources (&chan->vc);memset (chan->sq,0 ,sizeof (struct hisi_dma_sqe ) * hdma_dev->chan_depth);
@@ -394,7 +398,7 @@ static void hisi_dma_enable_qp(struct hisi_dma_dev *hdma_dev, u32 qp_index)static void hisi_dma_disable_qp (struct hisi_dma_dev *hdma_dev,u32 qp_index) { -hisi_dma_reset_hw_chan (&hdma_dev->chan[qp_index]); +hisi_dma_reset_or_disable_hw_chan (&hdma_dev->chan[qp_index], true); }static void hisi_dma_enable_qps (struct hisi_dma_dev *hdma_dev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 217/717 selftests/xsk: Add missing close() on netns fd
In reply to Greg Kroah-HartmanFrom: Maciej Fijalkowski <[email protected]>
[ Upstream commit 8a7d61bdc2fac2c460a2f32a062f5c6dbd21a764 ]
Commit 1034b03e54ac ("selftests: xsk: Simplify cleanup of ifobjects") removed close on netns fd, which is not correct, so let us restore it.
--- tools/testing/selftests/bpf/xdpxceiver.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/testing/selftests/bpf/xdpxceiver.c +4 -0
@@ -1589,6 +1589,8 @@ static struct ifobject *ifobject_create(void)if (!ifobj->umem) goto out_umem; + ifobj->ns_fd =-1 ; +return ifobj; out_umem:
@@ -1600,6 +1602,8 @@ static struct ifobject *ifobject_create(void)static void ifobject_delete (struct ifobject *ifobj) { +if (ifobj->ns_fd !=-1 ) +close (ifobj->ns_fd);free (ifobj->umem);free (ifobj->xsk_arr);free (ifobj);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 374/717 iio: adc: at91-sama5d2_adc: disable/prepare buffer on suspend/resume
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 808175e21d9b7f866eda742e8970f27b78afe5db ]
In case triggered buffers are enabled while system is suspended they will not work anymore after resume. For this call at91_adc_buffer_postdisable() on suspend and at91_adc_buffer_prepare() on resume. On tests it has been seen that at91_adc_buffer_postdisable() call is not necessary but it has been kept because it also does the book keeping for DMA. On resume path there is no need to call at91_adc_configure_touch() as it is embedded in at91_adc_buffer_prepare().
--- drivers/iio/adc/at91-sama5d2_adc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/iio/adc/at91-sama5d2_adc.c +7 -7
@@ -2116,6 +2116,9 @@ static __maybe_unused int at91_adc_suspend(struct device *dev)struct iio_dev *indio_dev =dev_get_drvdata (dev);struct at91_adc_state *st =iio_priv (indio_dev); +if (iio_buffer_enabled (indio_dev)) +at91_adc_buffer_postdisable (indio_dev); +/* * Do a sofware reset of the ADC before we go to suspend. * this will ensure that all pins are free from being muxed by the ADC
@@ -2159,14 +2162,11 @@ static __maybe_unused int at91_adc_resume(struct device *dev)if (!iio_buffer_enabled (indio_dev))return 0 ; -/* check if we are enabling triggered buffer or the touchscreen */ -if (at91_adc_current_chan_is_touch (indio_dev)) -return at91_adc_configure_touch (st, true); -else -return at91_adc_configure_trigger (st->trig, true); + ret =at91_adc_buffer_prepare (indio_dev); +if (ret) + goto vref_disable_resume; -/* not needed but more explicit */ -return 0 ; +return at91_adc_configure_trigger (st->trig, true); vref_disable_resume:regulator_disable (st->vref);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 371/717 iio: adc: at91-sama5d2_adc: fix AT91_SAMA5D2_MR_TRACKTIM_MAX
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit bb73d5d9164c57c4bb916739a98e5cd8e0a5ed8c ]
All ADC HW versions handled by this driver (SAMA5D2, SAM9X60, SAMA7G5) have MR.TRACKTIM on 4 bits. Fix AT91_SAMA5D2_MR_TRACKTIM_MAX to reflect this.
--- drivers/iio/adc/at91-sama5d2_adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/at91-sama5d2_adc.c +1 -1
@@ -77,7 +77,7 @@ struct at91_adc_reg_layout {#define AT91_SAMA5D2_MR_ANACH BIT(23)/* Tracking Time */ #define AT91_SAMA5D2_MR_TRACKTIM (v) ((v) << 24) -#define AT91_SAMA5D2_MR_TRACKTIM_MAX 0xff +#define AT91_SAMA5D2_MR_TRACKTIM_MAX 0xf/* Transfer Time */ #define AT91_SAMA5D2_MR_TRANSFER (v) ((v) << 28)#define AT91_SAMA5D2_MR_TRANSFER_MAX 0x3
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 412/717 dmaengine: idxd: avoid deadlock in process_misc_interrupts()
In reply to Greg Kroah-HartmanFrom: Jerry Snitselaar <[email protected]>
[ Upstream commit 407171717a4f4d2d80825584643374a2dfdb0540 ]
idxd_device_clear_state() now grabs the idxd->dev_lock itself, so don't grab the lock prior to calling it.
This was seen in testing after dmar fault occurred on system, resulting in lockup stack traces.
--- drivers/dma/idxd/irq.c | 2 -- 1 file changed, 2 deletions(-)
drivers/dma/idxd/irq.c +0 -2
@@ -324,13 +324,11 @@ static int process_misc_interrupts(struct idxd_device *idxd, u32 cause) idxd->state =IDXD_DEV_HALTED ;idxd_wqs_quiesce (idxd);idxd_wqs_unmap_portal (idxd); -spin_lock (&idxd->dev_lock);idxd_device_clear_state (idxd);dev_err (&idxd->pdev->dev,"idxd halted, need %s.\n" , gensts.reset_type ==IDXD_DEVICE_RESET_FLR ?"FLR" :"system reset" ); -spin_unlock (&idxd->dev_lock);return -ENXIO ; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 74/717 clocksource/drivers/arm_arch_timer: Fix CNTPCT_LO and CNTVCT_LO value
In reply to Greg Kroah-HartmanFrom: Yang Guo <[email protected]>
commit af246cc6d0ed11318223606128bb0b09866c4c08 upstream.
CNTPCT_LO and CNTVCT_LO are defined by mistake in commit '8b82c4f883a7', so fix them according to the Arm ARM DDI 0487I.a, Table I2-4 "CNTBaseN memory map" as follows:
Offset Register Type Description 0x000 CNTPCT[31:0] RO Physical Count register. 0x004 CNTPCT[63:32] RO 0x008 CNTVCT[31:0] RO Virtual Count register. 0x00C CNTVCT[63:32] RO
--- drivers/clocksource/arm_arch_timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/arm_arch_timer.c +2 -2
@@ -44,8 +44,8 @@#define CNTACR_RWVT BIT(4)#define CNTACR_RWPT BIT(5) -#define CNTVCT_LO 0x00 -#define CNTPCT_LO 0x08 +#define CNTPCT_LO 0x00 +#define CNTVCT_LO 0x08#define CNTFRQ 0x10#define CNTP_CVAL_LO 0x20#define CNTP_CTL 0x2c
Greg Kroah-Hartman
maintainerPATCH 418/717 dyndbg: fix module.dyndbg handling
In reply to Greg Kroah-HartmanFrom: Jim Cromie <[email protected]>
[ Upstream commit 85d6b66d31c35158364058ee98fb69ab5bb6a6b1 ]
For CONFIG_DYNAMIC_DEBUG=N, the ddebug_dyndbg_module_param_cb() stub-fn is too permissive:
bash-5.1# modprobe drm JUNKdyndbg
bash-5.1# modprobe drm dyndbgJUNK
[ 42.933220] dyndbg param is supported only in CONFIG_DYNAMIC_DEBUG builds [ 42.937484] ACPI: bus type drm_connector registered
This caused no ill effects, because unknown parameters are either ignored by default with an "unknown parameter" warning, or ignored because dyndbg allows its no-effect use on non-dyndbg builds.
But since the code has an explicit feedback message, it should be issued accurately. Fix with strcmp for exact param-name match.
--- include/linux/dynamic_debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/dynamic_debug.h +1 -1
@@ -201,7 +201,7 @@ static inline int ddebug_remove_module(const char *mod)static inline int ddebug_dyndbg_module_param_cb (char *param,char *val,const char *modname) { -if (strstr (param,"dyndbg" )) { +if (!strcmp (param,"dyndbg" )) {/* avoid pr_warn(), which wants pr_fmt() fully defined */ printk (KERN_WARNING "dyndbg param is supported only in " "CONFIG_DYNAMIC_DEBUG builds\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 117/717 f2fs: fix to do sanity check on summary info
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
commit c6ad7fd16657ebd34a87a97d9588195aae87597d upstream.
As Wenqing Liu reported in bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=216456
BUG: KASAN: use-after-free in recover_data+0x63ae/0x6ae0 [f2fs] Read of size 4 at addr ffff8881464dcd80 by task mount/1013 CPU: 3 PID: 1013 Comm: mount Tainted: G W 6.0.0-rc4 #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.15.0-1 04/01/2014 Call Trace: dump_stack_lvl+0x45/0x5e print_report.cold+0xf3/0x68d kasan_report+0xa8/0x130 recover_data+0x63ae/0x6ae0 [f2fs] f2fs_recover_fsync_data+0x120d/0x1fc0 [f2fs] f2fs_fill_super+0x4665/0x61e0 [f2fs] mount_bdev+0x2cf/0x3b0 legacy_get_tree+0xed/0x1d0 vfs_get_tree+0x81/0x2b0 path_mount+0x47e/0x19d0 do_mount+0xce/0xf0 __x64_sys_mount+0x12c/0x1a0 do_syscall_64+0x38/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd
The root cause is: in fuzzed image, SSA table is corrupted: ofs_in_node is larger than ADDRS_PER_PAGE(), result in out-of-range access on 4k-size page.
- recover_data
- do_recover_data
- check_index_in_prev_nodes
- f2fs_data_blkaddr
This patch adds sanity check on summary info in recovery and GC flow in where the flows rely on them.
After patch:
[ 29.310883] F2FS-fs (loop0): Inconsistent ofs_in_node:65286 in summary, ino:0, nid:6, max:1018
--- fs/f2fs/gc.c | 10 +++++++++- fs/f2fs/recovery.c | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-)
fs/f2fs/gc.c +9 -1
@@ -1075,7 +1075,7 @@ static bool is_alive(struct f2fs_sb_info {struct page *node_page;nid_t nid; -unsigned int ofs_in_node; +unsigned int ofs_in_node, max_addrs;block_t source_blkaddr; nid =le32_to_cpu (sum->nid);
@@ -1101,6 +1101,14 @@ static bool is_alive(struct f2fs_sb_inforeturn false; } + max_addrs =IS_INODE (node_page) ?DEF_ADDRS_PER_INODE : +DEF_ADDRS_PER_BLOCK ; +if (ofs_in_node >= max_addrs) { +f2fs_err (sbi,"Inconsistent ofs_in_node:%u in summary, ino:%u, nid:%u, max:%u" , + ofs_in_node, dni->ino, dni->nid, max_addrs); +return false; + } + *nofs =ofs_of_node (node_page); source_blkaddr =data_blkaddr (NULL , node_page, ofs_in_node);f2fs_put_page (node_page,1 );
fs/f2fs/recovery.c +12 -3
@@ -474,7 +474,7 @@ static int check_index_in_prev_nodes(strstruct dnode_of_data tdn = *dn;nid_t ino, nid;struct inode *inode; -unsigned int offset; +unsigned int offset, ofs_in_node, max_addrs;block_t bidx;int i;
@@ -501,15 +501,24 @@ static int check_index_in_prev_nodes(str got_it:/* Use the locked dnode page and inode */ nid =le32_to_cpu (sum.nid); + ofs_in_node =le16_to_cpu (sum.ofs_in_node); + + max_addrs =ADDRS_PER_PAGE (dn->node_page, dn->inode); +if (ofs_in_node >= max_addrs) { +f2fs_err (sbi,"Inconsistent ofs_in_node:%u in summary, ino:%lu, nid:%u, max:%u" , + ofs_in_node, dn->inode->i_ino, nid, max_addrs); +return -EFSCORRUPTED ; + } +if (dn->inode->i_ino == nid) { tdn.nid = nid;if (!dn->inode_page_locked)lock_page (dn->inode_page); tdn.node_page = dn->inode_page; - tdn.ofs_in_node =le16_to_cpu (sum.ofs_in_node); + tdn.ofs_in_node = ofs_in_node; goto truncate_out; }else if (dn->nid == nid) { - tdn.ofs_in_node =le16_to_cpu (sum.ofs_in_node); + tdn.ofs_in_node = ofs_in_node; goto truncate_out; }
Greg Kroah-Hartman
maintainerPATCH 91/717 powerpc/Kconfig: Fix non existing CONFIG_PPC_FSL_BOOKE
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit d1203f32d86987a3ccd7de9ba2448ba12d86d125 upstream.
CONFIG_PPC_FSL_BOOKE doesn't exist. Should be CONFIG_FSL_BOOKE.
--- arch/powerpc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/Kconfig +1 -1
@@ -817,7 +817,7 @@ config DATA_SHIFT default 24 if STRICT_KERNEL_RWX && PPC64 range 17 28 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_BOOK3S_32 range 19 23 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_8xx - range 20 24 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_FSL_BOOKE + range 20 24 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && FSL_BOOKE default 22 if STRICT_KERNEL_RWX && PPC_BOOK3S_32 default 18 if (DEBUG_PAGEALLOC || KFENCE) && PPC_BOOK3S_32 default 23 if STRICT_KERNEL_RWX && PPC_8xx
Greg Kroah-Hartman
maintainerPATCH 415/717 dmaengine: hisilicon: Add multi-thread support for a DMA channel
In reply to Greg Kroah-HartmanFrom: Jie Hai <[email protected]>
[ Upstream commit 2cbb95883c990d0002a77e13d3278913ab26ad79 ]
When we get a DMA channel and try to use it in multiple threads it will cause oops and hanging the system.
% echo 100 > /sys/module/dmatest/parameters/threads_per_chan % echo 100 > /sys/module/dmatest/parameters/iterations % echo 1 > /sys/module/dmatest/parameters/run
[383493.327077] Unable to handle kernel paging request at virtual address dead000000000108 [383493.335103] Mem abort info: [383493.335103] ESR = 0x96000044 [383493.335105] EC = 0x25: DABT (current EL), IL = 32 bits [383493.335107] SET = 0, FnV = 0 [383493.335108] EA = 0, S1PTW = 0 [383493.335109] FSC = 0x04: level 0 translation fault [383493.335110] Data abort info: [383493.335111] ISV = 0, ISS = 0x00000044 [383493.364739] CM = 0, WnR = 1 [383493.367793] [dead000000000108] address between user and kernel address ranges [383493.375021] Internal error: Oops: 96000044 [#1] PREEMPT SMP [383493.437574] CPU: 63 PID: 27895 Comm: dma0chan0-copy2 Kdump: loaded Tainted: GO 5.17.0-rc4+ #2 [383493.457851] pstate: 204000c9 (nzCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [383493.465331] pc : vchan_tx_submit+0x64/0xa0 [383493.469957] lr : vchan_tx_submit+0x34/0xa0
This occurs because the transmission timed out, and that's due to data race. Each thread rewrite channels's descriptor as soon as device_issue_pending is called. It leads to the situation that the driver thinks that it uses the right descriptor in interrupt handler while channels's descriptor has been changed by other thread. The descriptor which in fact reported interrupt will not be handled any more, as well as its tx->callback. That's why timeout reports.
With current fixes channels' descriptor changes it's value only when it has been used. A new descriptor is acquired from vc->desc_issued queue that is already filled with descriptors that are ready to be sent. Threads have no direct access to DMA channel descriptor. In case of channel's descriptor is busy, try to submit to HW again when a descriptor is completed. In this case, vc->desc_issued may be empty when hisi_dma_start_transfer is called, so delete error reporting on this. Now it is just possible to queue a descriptor for further processing.
--- drivers/dma/hisi_dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/dma/hisi_dma.c +2 -4
@@ -271,7 +271,6 @@ static void hisi_dma_start_transfer(struct hisi_dma_chan *chan) vd =vchan_next_desc (&chan->vc);if (!vd) { -dev_err (&hdma_dev->pdev->dev,"no issued task!\n" ); chan->desc =NULL ;return ; }
@@ -303,7 +302,7 @@ static void hisi_dma_issue_pending(struct dma_chan *c)spin_lock_irqsave (&chan->vc.lock, flags); -if (vchan_issue_pending (&chan->vc)) +if (vchan_issue_pending (&chan->vc) && !chan->desc)hisi_dma_start_transfer (chan);spin_unlock_irqrestore (&chan->vc.lock, flags);
@@ -441,11 +440,10 @@ static irqreturn_t hisi_dma_irq(int irq, void *data) chan->qp_num, chan->cq_head);if (FIELD_GET (STATUS_MASK , cqe->w0) ==STATUS_SUCC ) {vchan_cookie_complete (&desc->vd); +hisi_dma_start_transfer (chan); }else {dev_err (&hdma_dev->pdev->dev,"task error!\n" ); } - - chan->desc =NULL ; }spin_unlock (&chan->vc.lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 393/717 clk: qcom: gcc-sdm660: Use floor ops for SDCC1 clock
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit 6956c18f4ad9200aa945f7ea37d65a05afc49d51 ]
In commit 3f905469c8ce ("clk: qcom: gcc: Use floor ops for SDCC clocks") floor ops were applied to SDCC2 only, but flooring is also required on the SDCC1 apps clock which is used by the eMMC card on Sony's Nile platform, and otherwise result in the typicial "Card appears overclocked" warnings observed on many other platforms before:
mmc0: Card appears overclocked; req 52000000 Hz, actual 100000000 Hz
mmc0: Card appears overclocked; req 52000000 Hz, actual 100000000 Hz
mmc0: Card appears overclocked; req 104000000 Hz, actual 192000000 Hz--- drivers/clk/qcom/gcc-sdm660.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gcc-sdm660.c +1 -1
@@ -757,7 +757,7 @@ static struct clk_rcg2 sdcc1_apps_clk_src = { .name = "sdcc1_apps_clk_src", .parent_data = gcc_parent_data_xo_gpll0_gpll4_gpll0_early_div, .num_parents = ARRAY_SIZE(gcc_parent_data_xo_gpll0_gpll4_gpll0_early_div), - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_floor_ops, }, };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 149/717 tracing: Do not free snapshot if tracer is on cmdline
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (Google) <[email protected]>
commit a541a9559bb0a8ecc434de01d3e4826c32e8bb53 upstream.
The ftrace_boot_snapshot and alloc_snapshot cmdline options allocate the snapshot buffer at boot up for use later. The ftrace_boot_snapshot in particular requires the snapshot to be allocated because it will take a snapshot at the end of boot up allowing to see the traces that happened during boot so that it's not lost when user space takes over.
When a tracer is registered (started) there's a path that checks if it requires the snapshot buffer or not, and if it does not and it was allocated it will do a synchronization and free the snapshot buffer.
This is only required if the previous tracer was using it for "max latency" snapshots, as it needs to make sure all max snapshots are complete before freeing. But this is only needed if the previous tracer was using the snapshot buffer for latency (like irqoff tracer and friends). But it does not make sense to free it, if the previous tracer was not using it, and the snapshot was allocated by the cmdline parameters. This basically takes away the point of allocating it in the first place!
Note, the allocated snapshot worked fine for just trace events, but fails when a tracer is enabled on the cmdline.
Further investigation, this goes back even further and it does not require a tracer on the cmdline to fail. Simply enable snapshots and then enable a tracer, and it will remove the snapshot.
--- kernel/trace/trace.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
kernel/trace/trace.c +6 -4
@@ -6428,12 +6428,12 @@ int tracing_set_tracer(struct trace_arraif (tr->current_trace->reset) tr->current_trace->reset (tr); +#ifdef CONFIG_TRACER_MAX_TRACE + had_max_tr = tr->current_trace->use_max_tr; +/* Current trace needs to be nop_trace before synchronize_rcu */ tr->current_trace = &nop_trace; -#ifdef CONFIG_TRACER_MAX_TRACE - had_max_tr = tr->allocated_snapshot; -if (had_max_tr && !t->use_max_tr) {/* * We need to make sure that the update_max_tr sees that
@@ -6446,11 +6446,13 @@ int tracing_set_tracer(struct trace_arra free_snapshot(tr); } -if (t->use_max_tr && !had_max_tr) { +if (t->use_max_tr && !tr->allocated_snapshot) { ret =tracing_alloc_snapshot_instance (tr);if (ret <0 ) goto out; } +#else + tr->current_trace = &nop_trace;#endif if (t->init) {
Greg Kroah-Hartman
maintainerPATCH 152/717 tracing: Fix reading strings from synthetic events
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (Google) <[email protected]>
commit 0934ae9977c27133449b6dd8c6213970e7eece38 upstream.
The follow commands caused a crash:
# cd /sys/kernel/tracing # echo 's:open char file[]' > dynamic_events # echo 'hist:keys=common_pid:file=filename:onchange($file).trace(open,$file)' > events/syscalls/sys_enter_openat/trigger' # echo 1 > events/synthetic/open/enable
BOOM!
The problem is that the synthetic event field "char file[]" will read the value given to it as a string without any memory checks to make sure the address is valid. The above example will pass in the user space address and the sythetic event code will happily call strlen() on it and then strscpy() where either one will cause an oops when accessing user space addresses.
Use the helper functions from trace_kprobe and trace_eprobe that can read strings safely (and actually succeed when the address is from user space and the memory is mapped in).
Now the above can show:
packagekitd-1721 [000] ...2. 104.597170: open: file=/usr/lib/rpm/fileattrs/cmake.attr
in:imjournal-978 [006] ...2. 104.599642: open: file=/var/lib/rsyslog/imjournal.state.tmp
packagekitd-1721 [000] ...2. 104.626308: open: file=/usr/lib/rpm/fileattrs/debuginfo.attr--- kernel/trace/trace_events_synth.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
kernel/trace/trace_events_synth.c +17 -6
@@ -17,6 +17,8 @@/* for gfp flag names */ #include <linux/trace_events.h> #include <trace/events/mmflags.h> +#include "trace_probe.h" +#include "trace_probe_kernel.h" #include "trace_synth.h"
@@ -409,6 +411,7 @@ static unsigned int trace_string(struct {unsigned int len =0 ;char *str_field; +int ret;if (is_dynamic) {u32 data_offset;
@@ -417,19 +420,27 @@ static unsigned int trace_string(struct data_offset += event->n_u64 *sizeof (u64); data_offset += data_size; - str_field = (char *)entry + data_offset; - - len =strlen (str_val) +1 ; -strscpy (str_field, str_val, len); + len =kern_fetch_store_strlen ((unsigned long )str_val); data_offset |= len <<16 ; *(u32 *)&entry->fields[*n_u64] = data_offset; + ret =kern_fetch_store_string ((unsigned long )str_val, &entry->fields[*n_u64], entry); + (*n_u64)++; }else { str_field = (char *)&entry->fields[*n_u64]; -strscpy (str_field, str_val,STR_VAR_LEN_MAX ); +#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE +if ((unsigned long )str_val <TASK_SIZE ) + ret =strncpy_from_user_nofault (str_field, str_val,STR_VAR_LEN_MAX ); + else +#endif + ret =strncpy_from_kernel_nofault (str_field, str_val,STR_VAR_LEN_MAX ); + +if (ret <0 ) +strcpy (str_field,FAULT_STRING ); + (*n_u64) +=STR_VAR_LEN_MAX /sizeof (u64); }
@@ -462,7 +473,7 @@ static notrace void trace_event_raw_even val_idx = var_ref_idx[field_pos]; str_val = (char *)(long )var_ref_vals[val_idx]; - len =strlen (str_val) +1 ; + len =kern_fetch_store_strlen ((unsigned long )str_val); fields_size += len; }
Greg Kroah-Hartman
maintainerPATCH 387/717 clk: tegra: Fix refcount leak in tegra210_clock_init
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 56c78cb1f00a9dde8cd762131ce8f4c5eb046fbb ]
of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/clk/tegra/clk-tegra210.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/tegra/clk-tegra210.c +1 -0
@@ -3748,6 +3748,7 @@ static void __init tegra210_clock_init(struct device_node *np) } pmc_base =of_iomap (node,0 ); +of_node_put (node);if (!pmc_base) {pr_err ("Can't map pmc registers\n" );WARN_ON (1 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 421/717 clk: qcom: sm6115: Select QCOM_GDSC
In reply to Greg Kroah-HartmanFrom: Dang Huynh <[email protected]>
[ Upstream commit 50ee65dc512b9b5c4de354cf3b4dded34f46c571 ]
While working on the Fxtec Pro1X device, this error shows up with my own minimal configuration:
gcc-sm6115: probe of 1400000.clock-controller failed with error -38
The clock driver depends on CONFIG_QCOM_GDSC and after enabling that, the driver probes successfully.
--- drivers/clk/qcom/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/clk/qcom/Kconfig +1 -0
@@ -637,6 +637,7 @@ config SM_DISPCC_6350 config SM_GCC_6115 tristate "SM6115 and SM4250 Global Clock Controller" + select QCOM_GDSC help Support for the global clock controller on SM6115 and SM4250 devices. Say Y if you want to use peripheral devices such as UART, SPI,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 438/717 mtd: rawnand: meson: fix bit map use in meson_nfc_ecc_correct()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 3e4ad3212cf22687410b1e8f4e68feec50646113 ]
The meson_nfc_ecc_correct() function accidentally does a right shift instead of a left shift so it only works for BIT(0). Also use BIT_ULL() because "correct_bitmap" is a u64 and we want to avoid shift wrapping bugs.
--- drivers/mtd/nand/raw/meson_nand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/meson_nand.c +2 -2
@@ -454,7 +454,7 @@ static int meson_nfc_ecc_correct(struct nand_chip *nand, u32 *bitflips,if (ECC_ERR_CNT (*info) !=ECC_UNCORRECTABLE ) { mtd->ecc_stats.corrected +=ECC_ERR_CNT (*info); *bitflips =max_t (u32, *bitflips,ECC_ERR_CNT (*info)); - *correct_bitmap |=1 >> i; + *correct_bitmap |=BIT_ULL (i);continue ; } if ((nand->options & NAND_NEED_SCRAMBLING) &&
@@ -800,7 +800,7 @@ static int meson_nfc_read_page_hwecc(struct nand_chip *nand, u8 *buf,u8 *data = buf + i * ecc->size;u8 *oob = nand->oob_poi + i * (ecc->bytes +2 ); -if (correct_bitmap & (1 << i)) +if (correct_bitmap &BIT_ULL (i))continue ; ret = nand_check_erased_ecc_chunk(data, ecc->size, oob, ecc->bytes + 2,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 435/717 ata: fix ata_id_has_devslp()
In reply to Greg Kroah-HartmanFrom: Niklas Cassel <[email protected]>
[ Upstream commit 9c6e09a434e1317e09b78b3b69cd384022ec9a03 ]
ACS-5 section
7.13.6.36 Word 78: Serial ATA features supported
states that:
If word 76 is not 0000h or FFFFh, word 78 reports the features supported by the device. If this word is not supported, the word shall be cleared to zero.
(This text also exists in really old ACS standards, e.g. ACS-3.)
Additionally, move the macro to the other ATA_ID_FEATURE_SUPP macros (which already have this check), thus making it more likely that the next ATA_ID_FEATURE_SUPP macro that is added will include this check.
--- include/linux/ata.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/ata.h +4 -1
@@ -566,6 +566,10 @@ struct ata_bmdma_prd { ((((id)[ATA_ID_SATA_CAPABILITY ] !=0x0000 ) && \ ((id)[ATA_ID_SATA_CAPABILITY ] !=0xffff )) && \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 2))) +#define ata_id_has_devslp (id) \ + ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ + ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ + ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8)))#define ata_id_iordy_disable (id) ((id)[ATA_ID_CAPABILITY] & (1 << 10))#define ata_id_has_iordy (id) ((id)[ATA_ID_CAPABILITY] & (1 << 11))#define ata_id_u32 (id,n) \
@@ -578,7 +582,6 @@ struct ata_bmdma_prd {#define ata_id_cdb_intr (id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20)#define ata_id_has_da (id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4)) -#define ata_id_has_devslp (id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8))#define ata_id_has_ncq_autosense (id) \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 395/717 tty: xilinx_uartps: Fix the ignore_status
In reply to Greg Kroah-HartmanFrom: Shubhrajyoti Datta <[email protected]>
[ Upstream commit b8a6c3b3d4654fba19881cc77da61eac29f57cae ]
Currently the ignore_status is not considered in the isr. Add a check to add the ignore_status.
--- drivers/tty/serial/xilinx_uartps.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/xilinx_uartps.c +2 -0
@@ -361,6 +361,8 @@ static irqreturn_t cdns_uart_isr(int irq, void *dev_id) isrstatus &= ~CDNS_UART_IXR_TXEMPTY ; } + isrstatus &= port->read_status_mask; + isrstatus &= ~port->ignore_status_mask;/* * Skip RX processing if RX is disabled as RXEMPTY will never be set * as read bytes will not be removed from the FIFO.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 396/717 media: amphion: insert picture startcode after seek for vc1g format
In reply to Greg Kroah-HartmanFrom: Ming Qian <[email protected]>
[ Upstream commit f7fd6c318c8a5d06bf3fe611f30763d62eaaf7f0 ]
For format vc1, the amphion vpu requires driver to help insert some custom startcode before sequence and frame. the startcode is different for vc1l and vc1g format.
But the sequence startcode is only needed at the beginning, and it's not expected after seek.
driver need to treat the codec header and the first frame after seek as a normal frame, and insert picture startcode for it.
In previous patch, I just fix it for vc1l format,
and should fix the similar issue for vc1g too.
--- drivers/media/platform/amphion/vpu_malone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/amphion/vpu_malone.c +1 -1
@@ -1277,7 +1277,7 @@ static int vpu_malone_insert_scode_vc1_g_pic(struct malone_scode_t *scode) vbuf =to_vb2_v4l2_buffer (scode->vb); data =vb2_plane_vaddr (scode->vb,0 ); -if (vbuf->sequence ==0 ||vpu_vb_is_codecconfig (vbuf)) +if (scode->inst->total_input_count ==0 ||vpu_vb_is_codecconfig (vbuf))return 0 ;if (MALONE_VC1_CONTAIN_NAL (*data))return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 439/717 md: Replace snprintf with scnprintf
In reply to Greg Kroah-HartmanFrom: Saurabh Sengar <[email protected]>
[ Upstream commit 1727fd5015d8f93474148f94e34cda5aa6ad4a43 ]
Current code produces a warning as shown below when total characters in the constituent block device names plus the slashes exceeds 200. snprintf() returns the number of characters generated from the given input, which could cause the expression “200 – len” to wrap around to a large positive number. Fix this by using scnprintf() instead, which returns the actual number of characters written into the buffer.
[ 1513.267938] ------------[ cut here ]------------ [ 1513.267943] WARNING: CPU: 15 PID: 37247 at <snip>/lib/vsprintf.c:2509 vsnprintf+0x2c8/0x510 [ 1513.267944] Modules linked in: <snip> [ 1513.267969] CPU: 15 PID: 37247 Comm: mdadm Not tainted 5.4.0-1085-azure #90~18.04.1-Ubuntu [ 1513.267969] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v4.1 05/09/2022 [ 1513.267971] RIP: 0010:vsnprintf+0x2c8/0x510 <-snip-> [ 1513.267982] Call Trace: [ 1513.267986] snprintf+0x45/0x70 [ 1513.267990] ? disk_name+0x71/0xa0 [ 1513.267993] dump_zones+0x114/0x240 [raid0] [ 1513.267996] ? _cond_resched+0x19/0x40 [ 1513.267998] raid0_run+0x19e/0x270 [raid0] [ 1513.268000] md_run+0x5e0/0xc50 [ 1513.268003] ? security_capable+0x3f/0x60 [ 1513.268005] do_md_run+0x19/0x110 [ 1513.268006] md_ioctl+0x195e/0x1f90 [ 1513.268007] blkdev_ioctl+0x91f/0x9f0 [ 1513.268010] block_ioctl+0x3d/0x50 [ 1513.268012] do_vfs_ioctl+0xa9/0x640 [ 1513.268014] ? __fput+0x162/0x260 [ 1513.268016] ksys_ioctl+0x75/0x80 [ 1513.268017] __x64_sys_ioctl+0x1a/0x20 [ 1513.268019] do_syscall_64+0x5e/0x200 [ 1513.268021] entry_SYSCALL_64_after_hwframe+0x44/0xa9
--- drivers/md/raid0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid0.c +1 -1
@@ -47,7 +47,7 @@ static void dump_zones(struct mddev *mddev)int len =0 ;for (k =0 ; k < conf->strip_zone[j].nb_dev; k++) - len +=snprintf (line+len,200 -len,"%s%pg" , k?"/" :"" , + len +=scnprintf (line+len,200 -len,"%s%pg" , k?"/" :"" , conf->devlist[j * raid_disks + k]->bdev);pr_debug ("md: zone%d=[%s]\n" , j, line);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 441/717 md/raid5: Remove unnecessary bio_put() in raid5_read_one_chunk()
In reply to Greg Kroah-HartmanFrom: David Sloan <[email protected]>
[ Upstream commit c66a6f41e09ad386fd2cce22b9cded837bbbc704 ]
When running chunk-sized reads on disks with badblocks duplicate bio free/puts are observed:
=============================================================================
BUG bio-200 (Not tainted): Object already free
-----------------------------------------------------------------------------
Allocated in mempool_alloc_slab+0x17/0x20 age=3 cpu=2 pid=7504
__slab_alloc.constprop.0+0x5a/0xb0
kmem_cache_alloc+0x31e/0x330
mempool_alloc_slab+0x17/0x20
mempool_alloc+0x100/0x2b0
bio_alloc_bioset+0x181/0x460
do_mpage_readpage+0x776/0xd00
mpage_readahead+0x166/0x320
blkdev_readahead+0x15/0x20
read_pages+0x13f/0x5f0
page_cache_ra_unbounded+0x18d/0x220
force_page_cache_ra+0x181/0x1c0
page_cache_sync_ra+0x65/0xb0
filemap_get_pages+0x1df/0xaf0
filemap_read+0x1e1/0x700
blkdev_read_iter+0x1e5/0x330
vfs_read+0x42a/0x570
Freed in mempool_free_slab+0x17/0x20 age=3 cpu=2 pid=7504
kmem_cache_free+0x46d/0x490
mempool_free_slab+0x17/0x20
mempool_free+0x66/0x190
bio_free+0x78/0x90
bio_put+0x100/0x1a0
raid5_make_request+0x2259/0x2450
md_handle_request+0x402/0x600
md_submit_bio+0xd9/0x120
__submit_bio+0x11f/0x1b0
submit_bio_noacct_nocheck+0x204/0x480
submit_bio_noacct+0x32e/0xc70
submit_bio+0x98/0x1a0
mpage_readahead+0x250/0x320
blkdev_readahead+0x15/0x20
read_pages+0x13f/0x5f0
page_cache_ra_unbounded+0x18d/0x220
Slab 0xffffea000481b600 objects=21 used=0 fp=0xffff8881206d8940 flags=0x17ffffc0010201(locked|slab|head|node=0|zone=2|lastcpupid=0x1fffff)
CPU: 0 PID: 34525 Comm: kworker/u24:2 Not tainted 6.0.0-rc2-localyes-265166-gf11c5343fa3f #143
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-1ubuntu1.1 04/01/2014
Workqueue: raid5wq raid5_do_work
Call Trace:
<TASK>
dump_stack_lvl+0x5a/0x78
dump_stack+0x10/0x16
print_trailer+0x158/0x165
object_err+0x35/0x50
free_debug_processing.cold+0xb7/0xbe
__slab_free+0x1ae/0x330
kmem_cache_free+0x46d/0x490
mempool_free_slab+0x17/0x20
mempool_free+0x66/0x190
bio_free+0x78/0x90
bio_put+0x100/0x1a0
mpage_end_io+0x36/0x150
bio_endio+0x2fd/0x360
md_end_io_acct+0x7e/0x90
bio_endio+0x2fd/0x360
handle_failed_stripe+0x960/0xb80
handle_stripe+0x1348/0x3760
handle_active_stripes.constprop.0+0x72a/0xaf0
raid5_do_work+0x177/0x330
process_one_work+0x616/0xb20
worker_thread+0x2bd/0x6f0
kthread+0x179/0x1b0
ret_from_fork+0x22/0x30
</TASK>The double free is caused by an unnecessary bio_put() in the if(is_badblock(...)) error path in raid5_read_one_chunk().
The error path was moved ahead of bio_alloc_clone() in c82aa1b76787c ("md/raid5: move checking badblock before clone bio in raid5_read_one_chunk"). The previous code checked and freed align_bio which required a bio_put. After the move that is no longer needed as raid_bio is returned to the control of the common io path which performs its own endio resulting in a double free on bad device blocks.
--- drivers/md/raid5.c | 1 - 1 file changed, 1 deletion(-)
drivers/md/raid5.c +0 -1
@@ -5446,7 +5446,6 @@ static int raid5_read_one_chunk(struct mddev *mddev, struct bio *raid_bio)if (is_badblock (rdev, sector,bio_sectors (raid_bio), &first_bad, &bad_sectors)) { -bio_put (raid_bio);rdev_dec_pending (rdev, mddev);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 437/717 ata: fix ata_id_has_dipm()
In reply to Greg Kroah-HartmanFrom: Niklas Cassel <[email protected]>
[ Upstream commit 630624cb1b5826d753ac8e01a0e42de43d66dedf ]
ACS-5 section
7.13.6.36 Word 78: Serial ATA features supported
states that:
If word 76 is not 0000h or FFFFh, word 78 reports the features supported by the device. If this word is not supported, the word shall be cleared to zero.
(This text also exists in really old ACS standards, e.g. ACS-3.)
The problem with ata_id_has_dipm() is that the while it performs a check against 0 and 0xffff, it performs the check against ATA_ID_FEATURE_SUPP (word 78), the same word where the feature bit is stored.
Fix this by performing the check against ATA_ID_SATA_CAPABILITY (word 76), like required by the spec. The feature bit check itself is of course still performed against ATA_ID_FEATURE_SUPP (word 78).
Additionally, move the macro to the other ATA_ID_FEATURE_SUPP macros (which already have this check), thus making it more likely that the next ATA_ID_FEATURE_SUPP macro that is added will include this check.
--- include/linux/ata.h | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
include/linux/ata.h +4 -11
@@ -574,6 +574,10 @@ struct ata_bmdma_prd { ((((id)[ATA_ID_SATA_CAPABILITY ] !=0x0000 ) && \ ((id)[ATA_ID_SATA_CAPABILITY ] !=0xffff )) && \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7))) +#define ata_id_has_dipm (id) \ + ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ + ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ + ((id)[ATA_ID_FEATURE_SUPP] & (1 << 3)))#define ata_id_iordy_disable (id) ((id)[ATA_ID_CAPABILITY] & (1 << 10))#define ata_id_has_iordy (id) ((id)[ATA_ID_CAPABILITY] & (1 << 11))#define ata_id_u32 (id,n) \
@@ -597,17 +601,6 @@ static inline bool ata_id_has_hipm(const u16 *id)return val & (1 <<9 ); } -static inline bool ata_id_has_dipm (const u16 *id) -{ -u16 val = id[ATA_ID_FEATURE_SUPP ]; - -if (val ==0 || val ==0xffff ) -return false; - -return val & (1 <<3 ); -} - -static inline bool ata_id_has_fua (const u16 *id) {if ((id[ATA_ID_CFSSE ] &0xC000 ) !=0x4000 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 443/717 IB: Set IOVA/LENGTH on IB_MR in core/uverbs layers
In reply to Greg Kroah-HartmanFrom: Daisuke Matsuda <[email protected]>
[ Upstream commit 241f9a27e0fc0eaf23e3d52c8450f10648cd11f1 ]
Set 'iova' and 'length' on ib_mr in ib_uverbs and ib_core layers to let all drivers have the members filled. Also, this commit removes redundancy in the respective drivers.
Previously, commit 04c0a5fcfcf65 ("IB/uverbs: Set IOVA on IB MR in uverbs layer") changed to set 'iova', but seems to have missed 'length' and the ib_core layer at that time.
--- drivers/infiniband/core/uverbs_cmd.c | 5 ++++- drivers/infiniband/core/verbs.c | 2 ++ drivers/infiniband/hw/hns/hns_roce_mr.c | 1 - drivers/infiniband/hw/mlx4/mr.c | 1 - 4 files changed, 6 insertions(+), 3 deletions(-)
drivers/infiniband/core/uverbs_cmd.c +4 -1
@@ -739,6 +739,7 @@ static int ib_uverbs_reg_mr(struct uverbs_attr_bundle *attrs) mr->uobject = uobj;atomic_inc (&pd->usecnt); mr->iova = cmd.hca_va; + mr->length = cmd.length;rdma_restrack_new (&mr->res,RDMA_RESTRACK_MR );rdma_restrack_set_name (&mr->res,NULL );
@@ -861,8 +862,10 @@ static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs) mr->pd = new_pd;atomic_inc (&new_pd->usecnt); } -if (cmd.flags &IB_MR_REREG_TRANS ) +if (cmd.flags &IB_MR_REREG_TRANS ) { mr->iova = cmd.hca_va; + mr->length = cmd.length; + } }memset (&resp,0 ,sizeof (resp));
drivers/infiniband/core/verbs.c +2 -0
@@ -2149,6 +2149,8 @@ struct ib_mr *ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, mr->pd = pd; mr->dm =NULL ;atomic_inc (&pd->usecnt); + mr->iova = virt_addr; + mr->length = length;rdma_restrack_new (&mr->res,RDMA_RESTRACK_MR );rdma_restrack_parent_name (&mr->res, &pd->res);
drivers/infiniband/hw/hns/hns_roce_mr.c +0 -1
@@ -249,7 +249,6 @@ struct ib_mr *hns_roce_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, goto err_alloc_pbl; mr->ibmr.rkey = mr->ibmr.lkey = mr->key; - mr->ibmr.length = length;return &mr->ibmr;
drivers/infiniband/hw/mlx4/mr.c +0 -1
@@ -439,7 +439,6 @@ struct ib_mr *mlx4_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, goto err_mr; mr->ibmr.rkey = mr->ibmr.lkey = mr->mmr.key; - mr->ibmr.length = length; mr->ibmr.page_size =1U << shift;return &mr->ibmr;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 424/717 phy: amlogic: phy-meson-axg-mipi-pcie-analog: Hold reference returned by of_get_parent()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit c4c349be07aeec5f397a349046dc5fc0f2657691 ]
As the of_get_parent() will increase the refcount of the node->parent and the reference will be discarded, so we should hold the reference with which we can decrease the refcount when done.
--- drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c +4 -2
@@ -197,7 +197,7 @@ static int phy_axg_mipi_pcie_analog_probe(struct platform_device *pdev)struct phy_provider *phy;struct device *dev = &pdev->dev;struct phy_axg_mipi_pcie_analog_priv *priv; -struct device_node *np = dev->of_node; +struct device_node *np = dev->of_node, *parent_np;struct regmap *map;int ret;
@@ -206,7 +206,9 @@ static int phy_axg_mipi_pcie_analog_probe(struct platform_device *pdev)return -ENOMEM ;/* Get the hhi system controller node */ - map =syscon_node_to_regmap (of_get_parent (dev->of_node)); + parent_np =of_get_parent (dev->of_node); + map =syscon_node_to_regmap (parent_np); +of_node_put (parent_np);if (IS_ERR (map)) {dev_err (dev,"failed to get HHI regmap\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 445/717 usb: gadget: function: fix dangling pnp_string in f_printer.c
In reply to Greg Kroah-HartmanFrom: Albert Briscoe <[email protected]>
[ Upstream commit 24b7ba2f88e04800b54d462f376512e8c41b8a3c ]
When opts->pnp_string is changed with configfs, new memory is allocated for the string. It does not, however, update dev->pnp_string, even though the memory is freed. When rquesting the string, the host then gets old or corrupted data rather than the new string. The ieee 1284 id string should be allowed to change while the device is connected.
The bug was introduced in commit fdc01cc286be ("usb: gadget: printer:
Remove pnp_string static buffer"), which changed opts->pnp_string from a char[] to a char*.
This patch changes dev->pnp_string from a char* to a char** pointing to opts->pnp_string.
--- drivers/usb/gadget/function/f_printer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/usb/gadget/function/f_printer.c +6 -6
@@ -89,7 +89,7 @@ struct printer_dev {u8 printer_cdev_open;wait_queue_head_t wait;unsigned q_len; -char *pnp_string;/* We don't own memory! */ +char **pnp_string;/* We don't own memory! */ struct usb_function function; };
@@ -1000,16 +1000,16 @@ static int printer_func_setup(struct usb_function *f,if ((wIndex>>8 ) != dev->interface)break ; -if (!dev->pnp_string) { +if (!*dev->pnp_string) { value =0 ;break ; } - value =strlen (dev->pnp_string); + value =strlen (*dev->pnp_string); buf[0 ] = (value >>8 ) &0xFF ; buf[1 ] = value &0xFF ; -memcpy (buf +2 , dev->pnp_string, value); +memcpy (buf +2 , *dev->pnp_string, value);DBG (dev,"1284 PNP String: %x %s\n" , value, - dev->pnp_string); + *dev->pnp_string);break ;case GET_PORT_STATUS :/* Get Port Status */
@@ -1475,7 +1475,7 @@ static struct usb_function *gprinter_alloc(struct usb_function_instance *fi)kref_init (&dev->kref); ++opts->refcnt; dev->minor = opts->minor; - dev->pnp_string = opts->pnp_string; + dev->pnp_string = &opts->pnp_string; dev->q_len = opts->q_len;mutex_unlock (&opts->lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 447/717 drivers: serial: jsm: fix some leaks in probe
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 1d5859ef229e381f4db38dce8ed58e4bf862006b ]
This error path needs to unwind instead of just returning directly.
--- drivers/tty/serial/jsm/jsm_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/serial/jsm/jsm_driver.c +2 -1
@@ -211,7 +211,8 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)break ;default : -return -ENXIO ; + rc = -ENXIO ; + goto out_kfree_brd; } rc =request_irq (brd->irq, brd->bd_ops->intr,IRQF_SHARED ,"JSM" , brd);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 451/717 staging: vt6655: fix some erroneous memory clean-up loops
In reply to Greg Kroah-HartmanFrom: Nam Cao <[email protected]>
[ Upstream commit 2a2db520e3ca5aafba7c211abfd397666c9b5f9d ]
In some initialization functions of this driver, memory is allocated with 'i' acting as an index variable and increasing from 0. The commit in "Fixes" introduces some clean-up codes in case of allocation failure, which free memory in reverse order with 'i' decreasing to 0. However, there are some problems:
- The case i=0 is left out. Thus memory is leaked.
- In case memory allocation fails right from the start, the memory freeing loops will start with i=-1 and invalid memory locations will be accessed.
One of these loops has been fixed in commit c8ff91535880 ("staging:
vt6655: fix potential memory leak"). Fix the remaining erroneous loops.
--- drivers/staging/vt6655/device_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/vt6655/device_main.c +3 -3
@@ -564,7 +564,7 @@ static int device_init_rd0_ring(struct vnt_private *priv)kfree (desc->rd_info); err_free_desc: -while (--i) { +while (i--) { desc = &priv->aRD0Ring[i];device_free_rx_buf (priv, desc);kfree (desc->rd_info);
@@ -610,7 +610,7 @@ static int device_init_rd1_ring(struct vnt_private *priv)kfree (desc->rd_info); err_free_desc: -while (--i) { +while (i--) { desc = &priv->aRD1Ring[i];device_free_rx_buf (priv, desc);kfree (desc->rd_info);
@@ -715,7 +715,7 @@ static int device_init_td1_ring(struct vnt_private *priv)return 0 ; err_free_desc: -while (--i) { +while (i--) { desc = &priv->apTD1Rings[i];kfree (desc->td_info); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 452/717 slimbus: qcom-ngd-ctrl: allow compile testing without QCOM_RPROC_COMMON
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit e291691c69776ad278cd39dec2306dd39d681a9f ]
The Qualcomm common remote-proc code (CONFIG_QCOM_RPROC_COMMON) has necessary stubs, so it is not needed for compile testing.
Stable-dep-of: 42992cf187e4 ("slimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register")
--- drivers/slimbus/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/slimbus/Kconfig +2 -1
@@ -22,7 +22,8 @@ config SLIM_QCOM_CTRL config SLIM_QCOM_NGD_CTRL tristate "Qualcomm SLIMbus Satellite Non-Generic Device Component" - depends on HAS_IOMEM && DMA_ENGINE && NET && QCOM_RPROC_COMMON + depends on HAS_IOMEM && DMA_ENGINE && NET + depends on QCOM_RPROC_COMMON || COMPILE_TEST depends on ARCH_QCOM || COMPILE_TEST select QCOM_QMI_HELPERS select QCOM_PDR_HELPERS
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 420/717 dyndbg: drop EXPORTed dynamic_debug_exec_queries
In reply to Greg Kroah-HartmanFrom: Jim Cromie <[email protected]>
[ Upstream commit e26ef3af964acfea311403126acee8c56c89e26b ]
This exported fn is unused, and will not be needed. Lets dump it.
The export was added to let drm control pr_debugs, as part of using them to avoid drm_debug_enabled overheads. But its better to just implement the drm.debug bitmap interface, then its available for everyone.
--- include/linux/dynamic_debug.h | 9 --------- lib/dynamic_debug.c | 29 ----------------------------- 2 files changed, 38 deletions(-)
include/linux/dynamic_debug.h +0 -9
@@ -55,9 +55,6 @@ struct _ddebug {#if defined(CONFIG_DYNAMIC_DEBUG_CORE ) -/* exported for module authors to exercise >control */ -int dynamic_debug_exec_queries (const char *query,const char *modname); -int ddebug_add_module (struct _ddebug *tab,unsigned int n,const char *modname);extern int ddebug_remove_module (const char *mod_name);
@@ -221,12 +218,6 @@ static inline int ddebug_dyndbg_module_param_cb(char *param, char *val, rowsize, groupsize, buf, len, ascii); \ } while (0) -static inline int dynamic_debug_exec_queries(const char *query, const char *modname) -{ -pr_warn ("kernel not built with CONFIG_DYNAMIC_DEBUG_CORE\n" ); -return 0 ; -} -#endif /* !CONFIG_DYNAMIC_DEBUG_CORE */ #endif
lib/dynamic_debug.c +0 -29
@@ -557,35 +557,6 @@ static int ddebug_exec_queries(char *query, const char *modname)return nfound; } -/** -* dynamic_debug_exec_queries - select and change dynamic-debug prints -* @query: query-string described in admin-guide/dynamic-debug-howto -* @modname: string containing module name, usually &module.mod_name -* -* This uses the >/proc/dynamic_debug/control reader, allowing module -* authors to modify their dynamic-debug callsites. The modname is -* canonically struct module.mod_name, but can also be null or a -* module-wildcard, for example: "drm*". -*/ -int dynamic_debug_exec_queries (const char *query,const char *modname) -{ -int rc; -char *qry;/* writable copy of query */ - -if (!query) { -pr_err ("non-null query/command string expected\n" ); -return -EINVAL ; - } - qry =kstrndup (query,PAGE_SIZE ,GFP_KERNEL ); -if (!qry) -return -ENOMEM ; - - rc =ddebug_exec_queries (qry, modname); -kfree (qry); -return rc; -} -EXPORT_SYMBOL_GPL (dynamic_debug_exec_queries); -#define PREFIX_SIZE 64static int remaining (int wrote)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 425/717 phy: phy-mtk-tphy: fix the phy type setting issue
In reply to Greg Kroah-HartmanFrom: Chunfeng Yun <[email protected]>
[ Upstream commit 931c05a8cb1be029ef2fbc1e4af313d4cb297c47 ]
The PHY type is not set if the index is non zero, prepare type value according to the index, like as mask value.
--- drivers/phy/mediatek/phy-mtk-tphy.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/phy/mediatek/phy-mtk-tphy.c +4 -3
@@ -906,7 +906,7 @@ static int phy_type_syscon_get(struct mtk_phy_instance *instance,static int phy_type_set (struct mtk_phy_instance *instance) {int type; -u32 mask; +u32 offset;if (!instance->type_sw)return 0 ;
@@ -929,8 +929,9 @@ static int phy_type_set(struct mtk_phy_instance *instance)return 0 ; } - mask =RG_PHY_SW_TYPE << (instance->type_sw_index *BITS_PER_BYTE ); -regmap_update_bits (instance->type_sw, instance->type_sw_reg, mask, type); + offset = instance->type_sw_index *BITS_PER_BYTE ; +regmap_update_bits (instance->type_sw, instance->type_sw_reg, +RG_PHY_SW_TYPE << offset, type << offset);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 278/717 eth: alx: take rtnl_lock on resume
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 6ad1c94e1e7e374d88f0cfd77936dddb8339aaba ]
Zbynek reports that alx trips an rtnl assertion on resume:
RTNL: assertion failed at net/core/dev.c (2891)
RIP: 0010:netif_set_real_num_tx_queues+0x1ac/0x1c0 Call Trace: <TASK> __alx_open+0x230/0x570 [alx] alx_resume+0x54/0x80 [alx] ? pci_legacy_resume+0x80/0x80 dpm_run_callback+0x4a/0x150 device_resume+0x8b/0x190 async_resume+0x19/0x30 async_run_entry_fn+0x30/0x130 process_one_work+0x1e5/0x3b0
indeed the driver does not hold rtnl_lock during its internal close and re-open functions during suspend/resume. Note that this is not a huge bug as the driver implements its own locking, and does not implement changing the number of queues, but we need to silence the splat.
--- drivers/net/ethernet/atheros/alx/main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/atheros/alx/main.c +5 -0
@@ -1912,11 +1912,14 @@ static int alx_suspend(struct device *dev)if (!netif_running (alx->dev))return 0 ; + +rtnl_lock ();netif_device_detach (alx->dev);mutex_lock (&alx->mtx);__alx_stop (alx);mutex_unlock (&alx->mtx); +rtnl_unlock ();return 0 ; }
@@ -1927,6 +1930,7 @@ static int alx_resume(struct device *dev)struct alx_hw *hw = &alx->hw;int err; +rtnl_lock ();mutex_lock (&alx->mtx);alx_reset_phy (hw);
@@ -1943,6 +1947,7 @@ static int alx_resume(struct device *dev) unlock:mutex_unlock (&alx->mtx); +rtnl_unlock ();return err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 436/717 ata: fix ata_id_has_ncq_autosense()
In reply to Greg Kroah-HartmanFrom: Niklas Cassel <[email protected]>
[ Upstream commit a5fb6bf853148974dbde092ec1bde553bea5e49f ]
ACS-5 section
7.13.6.36 Word 78: Serial ATA features supported
states that:
If word 76 is not 0000h or FFFFh, word 78 reports the features supported by the device. If this word is not supported, the word shall be cleared to zero.
(This text also exists in really old ACS standards, e.g. ACS-3.)
Additionally, move the macro to the other ATA_ID_FEATURE_SUPP macros (which already have this check), thus making it more likely that the next ATA_ID_FEATURE_SUPP macro that is added will include this check.
--- include/linux/ata.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
include/linux/ata.h +4 -2
@@ -570,6 +570,10 @@ struct ata_bmdma_prd { ((((id)[ATA_ID_SATA_CAPABILITY ] !=0x0000 ) && \ ((id)[ATA_ID_SATA_CAPABILITY ] !=0xffff )) && \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8))) +#define ata_id_has_ncq_autosense (id) \ + ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ + ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ + ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7)))#define ata_id_iordy_disable (id) ((id)[ATA_ID_CAPABILITY] & (1 << 10))#define ata_id_has_iordy (id) ((id)[ATA_ID_CAPABILITY] & (1 << 11))#define ata_id_u32 (id,n) \
@@ -582,8 +586,6 @@ struct ata_bmdma_prd {#define ata_id_cdb_intr (id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20)#define ata_id_has_da (id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4)) -#define ata_id_has_ncq_autosense (id) \ - ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7))static inline bool ata_id_has_hipm (const u16 *id) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 449/717 tty: serial: fsl_lpuart: disable dma rx/tx use flags in lpuart_dma_shutdown
In reply to Greg Kroah-HartmanFrom: Sherry Sun <[email protected]>
[ Upstream commit 316ae95c175a7d770d1bfe4c011192712f57aa4a ]
lpuart_dma_shutdown tears down lpuart dma, but lpuart_flush_buffer can still occur which in turn tries to access dma apis if lpuart_dma_tx_use flag is true. At this point since dma is torn down, these dma apis can abort. Set lpuart_dma_tx_use and the corresponding rx flag lpuart_dma_rx_use to false in lpuart_dma_shutdown so that dmas are not accessed after they are relinquished.
Otherwise, when try to kill btattach, kernel may panic. This patch may fix this issue.
root@imx8ulpevk:~# btattach -B /dev/ttyLP2 -S 115200 ^C[ 90.182296] Internal error: synchronous external abort: 96000210 [#1] PREEMPT SMP [ 90.189806] Modules linked in: moal(O) mlan(O) [ 90.194258] CPU: 0 PID: 503 Comm: btattach Tainted: G O 5.15.32-06136-g34eecdf2f9e4 #37 [ 90.203554] Hardware name: NXP i.MX8ULP 9X9 EVK (DT) [ 90.208513] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 90.215470] pc : fsl_edma3_disable_request+0x8/0x60 [ 90.220358] lr : fsl_edma3_terminate_all+0x34/0x20c [ 90.225237] sp : ffff800013f0bac0 [ 90.228548] x29: ffff800013f0bac0 x28: 0000000000000001 x27: ffff000008404800 [ 90.235681] x26: ffff000008404960 x25: ffff000008404a08 x24: ffff000008404a00 [ 90.242813] x23: ffff000008404a60 x22: 0000000000000002 x21: 0000000000000000 [ 90.249946] x20: ffff800013f0baf8 x19: ffff00000559c800 x18: 0000000000000000 [ 90.257078] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [ 90.264211] x14: 0000000000000003 x13: 0000000000000000 x12: 0000000000000040 [ 90.271344] x11: ffff00000600c248 x10: ffff800013f0bb10 x9 : ffff000057bcb090 [ 90.278477] x8 : fffffc0000241a08 x7 : ffff00000534ee00 x6 : ffff000008404804 [ 90.285609] x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff0000055b3480 [ 90.292742] x2 : ffff8000135c0000 x1 : ffff00000534ee00 x0 : ffff00000559c800 [ 90.299876] Call trace: [ 90.302321] fsl_edma3_disable_request+0x8/0x60 [ 90.306851] lpuart_flush_buffer+0x40/0x160 [ 90.311037] uart_flush_buffer+0x88/0x120 [ 90.315050] tty_driver_flush_buffer+0x20/0x30 [ 90.319496] hci_uart_flush+0x44/0x90 [ 90.323162] +0x34/0x12c [ 90.327253] tty_ldisc_close+0x38/0x70 [ 90.331005] tty_ldisc_release+0xa8/0x190 [ 90.335018] tty_release_struct+0x24/0x8c [ 90.339022] tty_release+0x3ec/0x4c0 [ 90.342593] __fput+0x70/0x234 [ 90.345652] ____fput+0x14/0x20 [ 90.348790] task_work_run+0x84/0x17c [ 90.352455] do_exit+0x310/0x96c [ 90.355688] do_group_exit+0x3c/0xa0 [ 90.359259] __arm64_sys_exit_group+0x1c/0x20 [ 90.363609] invoke_syscall+0x48/0x114 [ 90.367362] el0_svc_common.constprop.0+0xd4/0xfc [ 90.372068] do_el0_svc+0x2c/0x94 [ 90.375379] el0_svc+0x28/0x80 [ 90.378438] el0t_64_sync_handler+0xa8/0x130 [ 90.382711] el0t_64_sync+0x1a0/0x1a4 [ 90.386376] Code: 17ffffda d503201f d503233f f9409802 (b9400041) [ 90.392467] ---[ end trace 2f60524b4a43f1f6 ]--- [ 90.397073] note: btattach[503] exited with preempt_count 1 [ 90.402636] Fixing recursive fault but reboot is needed!
--- drivers/tty/serial/fsl_lpuart.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/fsl_lpuart.c +2 -0
@@ -1768,6 +1768,7 @@ static void lpuart_dma_shutdown(struct lpuart_port *sport)if (sport->lpuart_dma_rx_use) {del_timer_sync (&sport->lpuart_timer);lpuart_dma_rx_free (&sport->port); + sport->lpuart_dma_rx_use = false; }if (sport->lpuart_dma_tx_use) {
@@ -1776,6 +1777,7 @@ static void lpuart_dma_shutdown(struct lpuart_port *sport) sport->dma_tx_in_progress = false;dmaengine_terminate_all (sport->dma_tx_chan); } + sport->lpuart_dma_tx_use = false; }if (sport->dma_tx_chan)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 468/717 mfd: lp8788: Fix an error handling path in lp8788_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit becfdcd75126b20b8ec10066c5e85b34f8994ad5 ]
Should an error occurs in mfd_add_devices(), some resources need to be released, as already done in the .remove() function.
Add an error handling path and a lp8788_irq_exit() call to undo a previous lp8788_irq_init().
--- drivers/mfd/lp8788.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/mfd/lp8788.c +10 -2
@@ -195,8 +195,16 @@ static int lp8788_probe(struct i2c_client *cl, const struct i2c_device_id *id)if (ret)return ret; -return mfd_add_devices (lp->dev,-1 , lp8788_devs, -ARRAY_SIZE (lp8788_devs),NULL ,0 ,NULL ); + ret =mfd_add_devices (lp->dev,-1 , lp8788_devs, +ARRAY_SIZE (lp8788_devs),NULL ,0 ,NULL ); +if (ret) + goto err_exit_irq; + +return 0 ; + +err_exit_irq: +lp8788_irq_exit (lp); +return ret; }static int lp8788_remove (struct i2c_client *cl)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 476/717 clk: mediatek: Migrate remaining clk_unregister_*() to clk_hw_unregister_*()
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit fef14676fc4be40b8441745a3c96b7e7d7d8592d ]
During the previous |struct clk| to |struct clk_hw| clk provider API migration in commit 6f691a586296 ("clk: mediatek: Switch to clk_hw provider APIs"), a few clk_unregister_*() calls were missed.
Migrate the remaining ones to the |struct clk_hw| provider API, i.e. change clk_unregister_*() to clk_hw_unregister_*().
--- drivers/clk/mediatek/clk-mtk.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/mediatek/clk-mtk.c +5 -5
@@ -80,7 +80,7 @@ int mtk_clk_register_fixed_clks(const struct mtk_fixed_clk *clks, int num,if (IS_ERR_OR_NULL (clk_data->hws[rc->id]))continue ; -clk_unregister_fixed_rate (clk_data->hws[rc->id]->clk); +clk_hw_unregister_fixed_rate (clk_data->hws[rc->id]); clk_data->hws[rc->id] =ERR_PTR (-ENOENT ); }
@@ -102,7 +102,7 @@ void mtk_clk_unregister_fixed_clks(const struct mtk_fixed_clk *clks, int num,if (IS_ERR_OR_NULL (clk_data->hws[rc->id]))continue ; -clk_unregister_fixed_rate (clk_data->hws[rc->id]->clk); +clk_hw_unregister_fixed_rate (clk_data->hws[rc->id]); clk_data->hws[rc->id] =ERR_PTR (-ENOENT ); } }
@@ -146,7 +146,7 @@ int mtk_clk_register_factors(const struct mtk_fixed_factor *clks, int num,if (IS_ERR_OR_NULL (clk_data->hws[ff->id]))continue ; -clk_unregister_fixed_factor (clk_data->hws[ff->id]->clk); +clk_hw_unregister_fixed_factor (clk_data->hws[ff->id]); clk_data->hws[ff->id] =ERR_PTR (-ENOENT ); }
@@ -168,7 +168,7 @@ void mtk_clk_unregister_factors(const struct mtk_fixed_factor *clks, int num,if (IS_ERR_OR_NULL (clk_data->hws[ff->id]))continue ; -clk_unregister_fixed_factor (clk_data->hws[ff->id]->clk); +clk_hw_unregister_fixed_factor (clk_data->hws[ff->id]); clk_data->hws[ff->id] =ERR_PTR (-ENOENT ); } }
@@ -414,7 +414,7 @@ void mtk_clk_unregister_dividers(const struct mtk_clk_divider *mcds, int num,if (IS_ERR_OR_NULL (clk_data->hws[mcd->id]))continue ; -clk_unregister_divider (clk_data->hws[mcd->id]->clk); +clk_hw_unregister_divider (clk_data->hws[mcd->id]); clk_data->hws[mcd->id] =ERR_PTR (-ENOENT ); } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 428/717 mtd: rawnand: fsl_elbc: Fix none ECC mode
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 049e43b9fd8fd2966940485da163d67e96ee3fea ]
Commit f6424c22aa36 ("mtd: rawnand: fsl_elbc: Make SW ECC work") added support for specifying ECC mode via DTS and skipping autodetection.
But it broke explicit specification of HW ECC mode in DTS as correct settings for HW ECC mode are applied only when NONE mode or nothing was specified in DTS file.
Also it started aliasing NONE mode to be same as when ECC mode was not specified and disallowed usage of ON_DIE mode.
Fix all these issues. Use autodetection of ECC mode only in case when mode was really not specified in DTS file by checking that ecc value is invalid. Set HW ECC settings either when HW ECC was specified in DTS or it was autodetected. And do not fail when ON_DIE mode is set.
--- drivers/mtd/nand/raw/fsl_elbc_nand.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-)
drivers/mtd/nand/raw/fsl_elbc_nand.c +16 -12
@@ -726,36 +726,40 @@ static int fsl_elbc_attach_chip(struct nand_chip *chip)struct fsl_lbc_regs __iomem *lbc = ctrl->regs;unsigned int al; -switch (chip->ecc.engine_type) {/* * if ECC was not chosen in DT, decide whether to use HW or SW ECC from * CS Base Register */ -case NAND_ECC_ENGINE_TYPE_NONE : +if (chip->ecc.engine_type ==NAND_ECC_ENGINE_TYPE_INVALID ) {/* If CS Base Register selects full hardware ECC then use it */ if ((in_be32 (&lbc->bank[priv->bank].br) &BR_DECC ) ==BR_DECC_CHK_GEN ) { - chip->ecc.read_page = fsl_elbc_read_page; - chip->ecc.write_page = fsl_elbc_write_page; - chip->ecc.write_subpage = fsl_elbc_write_subpage; - chip->ecc.engine_type =NAND_ECC_ENGINE_TYPE_ON_HOST ; -mtd_set_ooblayout (mtd, &fsl_elbc_ooblayout_ops); - chip->ecc.size =512 ; - chip->ecc.bytes =3 ; - chip->ecc.strength =1 ; }else {/* otherwise fall back to default software ECC */ chip->ecc.engine_type =NAND_ECC_ENGINE_TYPE_SOFT ; chip->ecc.algo =NAND_ECC_ALGO_HAMMING ; } + } + +switch (chip->ecc.engine_type) { +/* if HW ECC was chosen, setup ecc and oob layout */ +case NAND_ECC_ENGINE_TYPE_ON_HOST : + chip->ecc.read_page = fsl_elbc_read_page; + chip->ecc.write_page = fsl_elbc_write_page; + chip->ecc.write_subpage = fsl_elbc_write_subpage; +mtd_set_ooblayout (mtd, &fsl_elbc_ooblayout_ops); + chip->ecc.size =512 ; + chip->ecc.bytes =3 ; + chip->ecc.strength =1 ;break ; -/* if SW ECC was chosen in DT, we do not need to set anything here */ +/* if none or SW ECC was chosen, we do not need to set anything here */ +case NAND_ECC_ENGINE_TYPE_NONE :case NAND_ECC_ENGINE_TYPE_SOFT : +case NAND_ECC_ENGINE_TYPE_ON_DIE :break ; -/* should we also implement *_ECC_ENGINE_CONTROLLER to do as above? */ default :return -EINVAL ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 448/717 serial: 8250: Toggle IER bits on only after irq has been set up
In reply to Greg Kroah-HartmanFrom: Ilpo Järvinen <[email protected]>
[ Upstream commit 039d4926379b1d1c17b51cf21c500a5eed86899e ]
Invoking TIOCVHANGUP on 8250_mid port on Ice Lake-D and then reopening the port triggers these faults during serial8250_do_startup():
DMAR: DRHD: handling fault status reg 3
DMAR: [DMA Write NO_PASID] Request device [00:1a.0] fault addr 0x0 [fault reason 0x05] PTE Write access is not set
If the IRQ hasn't been set up yet, the UART will have zeroes in its MSI address/data registers. Disabling the IRQ at the interrupt controller won't stop the UART from performing a DMA write to the address programmed in its MSI address register (zero) when it wants to signal an interrupt.
The UARTs (in Ice Lake-D) implement PCI 2.1 style MSI without masking capability, so there is no way to mask the interrupt at the source PCI function level, except disabling the MSI capability entirely, but that would cause it to fall back to INTx# assertion, and the PCI specification prohibits disabling the MSI capability as a way to mask a function's interrupt service request.
The MSI address register is zeroed by the hangup as the irq is freed. The interrupt is signalled during serial8250_do_startup() performing a THRE test that temporarily toggles THRI in IER. The THRE test currently occurs before UART's irq (and MSI address) is properly set up.
Refactor serial8250_do_startup() such that irq is set up before the THRE test. The current irq setup code is intermixed with the timer setup code. As THRE test must be performed prior to the timer setup, extract it into own function and call it only after the THRE test.
The ->setup_timer() needs to be part of the struct uart_8250_ops in order to not create circular dependency between 8250 and 8250_base modules.
--- drivers/tty/serial/8250/8250_core.c | 16 +++++++++++----- drivers/tty/serial/8250/8250_port.c | 8 +++++--- include/linux/serial_8250.h | 1 + 3 files changed, 17 insertions(+), 8 deletions(-)
drivers/tty/serial/8250/8250_core.c +11 -5
@@ -298,10 +298,9 @@ static void serial8250_backup_timeout(struct timer_list *t) jiffies + uart_poll_timeout(&up->port) + HZ / 5); } -static int univ8250_setup_irq (struct uart_8250_port *up) +static void univ8250_setup_timer (struct uart_8250_port *up) {struct uart_port *port = &up->port; -int retval =0 ;/* * The above check will only give an accurate result the first time
@@ -322,10 +321,16 @@ static int univ8250_setup_irq(struct uart_8250_port *up)*/ if (!port->irq)mod_timer (&up->timer, jiffies +uart_poll_timeout (port)); -else - retval =serial_link_irq_chain (up); +} -return retval; +static int univ8250_setup_irq (struct uart_8250_port *up) +{ +struct uart_port *port = &up->port; + +if (port->irq) +return serial_link_irq_chain (up); + +return 0 ; }static void univ8250_release_irq (struct uart_8250_port *up)
@@ -381,6 +386,7 @@ static struct uart_ops univ8250_port_ops;static const struct uart_8250_ops univ8250_driver_ops = { .setup_irq = univ8250_setup_irq, .release_irq = univ8250_release_irq, + .setup_timer = univ8250_setup_timer, };static struct uart_8250_port serial8250_ports[UART_NR ];
drivers/tty/serial/8250/8250_port.c +5 -3
@@ -2303,6 +2303,10 @@ int serial8250_do_startup(struct uart_port *port)if (port->irq && (up->port.flags &UPF_SHARE_IRQ )) up->port.irqflags |=IRQF_SHARED ; + retval = up->ops->setup_irq (up); +if (retval) + goto out; +if (port->irq && !(up->port.flags &UPF_NO_THRE_TEST )) {unsigned char iir1;
@@ -2345,9 +2349,7 @@ int serial8250_do_startup(struct uart_port *port) } } - retval = up->ops->setup_irq (up); -if (retval) - goto out; + up->ops->setup_timer (up);/* * Now, initialize the UART
include/linux/serial_8250.h +1 -0
@@ -74,6 +74,7 @@ struct uart_8250_port;struct uart_8250_ops {int (*setup_irq)(struct uart_8250_port *);void (*release_irq)(struct uart_8250_port *); +void (*setup_timer)(struct uart_8250_port *); };struct uart_8250_em485 {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 471/717 mfd: sm501: Add check for platform_driver_register()
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 8325a6c24ad78b8c1acc3c42b098ee24105d68e5 ]
As platform_driver_register() can return error numbers, it should be better to check platform_driver_register() and deal with the exception.
--- drivers/mfd/sm501.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mfd/sm501.c +6 -1
@@ -1720,7 +1720,12 @@ static struct platform_driver sm501_plat_driver = {static int __init sm501_base_init (void ) { -platform_driver_register (&sm501_plat_driver); +int ret; + + ret =platform_driver_register (&sm501_plat_driver); +if (ret <0 ) +return ret; +return pci_register_driver (&sm501_pci_driver); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 456/717 scsi: libsas: Fix use-after-free bug in smp_execute_task_sg()
In reply to Greg Kroah-HartmanFrom: Duoming Zhou <[email protected]>
[ Upstream commit 46ba53c30666717cb06c2b3c5d896301cd00d0c0 ]
When executing SMP task failed, the smp_execute_task_sg() calls del_timer() to delete "slow_task->timer". However, if the timer handler sas_task_internal_timedout() is running, the del_timer() in smp_execute_task_sg() will not stop it and a UAF will happen. The process is shown below:
(thread 1) | (thread 2)
smp_execute_task_sg() | sas_task_internal_timedout()
... |
del_timer() |
... | ...
sas_free_task(task) |
kfree(task->slow_task) //FREE|
| task->slow_task->... //USEFix by calling del_timer_sync() in smp_execute_task_sg(), which makes sure the timer handler have finished before the "task->slow_task" is deallocated.
--- drivers/scsi/libsas/sas_expander.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/libsas/sas_expander.c +1 -1
@@ -67,7 +67,7 @@ static int smp_execute_task_sg(struct domain_device *dev, res = i->dft->lldd_execute_task (task,GFP_KERNEL );if (res) { -del_timer (&task->slow_task->timer); +del_timer_sync (&task->slow_task->timer);pr_notice ("executing SMP task failed:%d\n" , res);break ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 159/717 blk-wbt: call rq_qos_add() after wb_normal is initialized
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
commit 8c5035dfbb9475b67c82b3fdb7351236525bf52b upstream.
Our test found a problem that wbt inflight counter is negative, which will cause io hang(noted that this problem doesn't exist in mainline):
t1: device create t2: issue ioadd_disk
blk_register_queue
wbt_enable_default
wbt_init
rq_qos_add
// wb_normal is still 0
/*
* in mainline, disk can't be opened before
* bdev_add(), however, in old kernels, disk
* can be opened before blk_register_queue().
*/
blkdev_issue_flush
// disk size is 0, however, it's not checked
submit_bio_wait
submit_bio
blk_mq_submit_bio
rq_qos_throttle
wbt_wait
bio_to_wbt_flags
rwb_enabled
// wb_normal is 0, inflight is not increased
wbt_queue_depth_changed(&rwb->rqos);
wbt_update_limits
// wb_normal is initialized
rq_qos_track
wbt_track
rq->wbt_flags |= bio_to_wbt_flags(rwb, bio);
// wb_normal is not 0,wbt_flags will be sett3: io completionblk_mq_free_request
rq_qos_done
wbt_done
wbt_is_tracked
// return true
__wbt_done
wbt_rqw_done
atomic_dec_return(&rqw->inflight);
// inflight is decreasedcommit 8235b5c1e8c1 ("block: call bdev_add later in device_add_disk") can avoid this problem, however it's better to fix this problem in wbt:
1) Lower kernel can't backport this patch due to lots of refactor.
2) Root cause is that wbt call rq_qos_add() before wb_normal is initialized.
--- block/blk-wbt.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
block/blk-wbt.c +4 -5
@@ -843,6 +843,10 @@ int wbt_init(struct request_queue *q) rwb->enable_state =WBT_STATE_ON_DEFAULT ; rwb->wc =1 ; rwb->rq_depth.default_depth =RWB_DEF_DEPTH ; + rwb->min_lat_nsec =wbt_default_latency_nsec (q); + +wbt_queue_depth_changed (&rwb->rqos); +wbt_set_write_cache (q,test_bit (QUEUE_FLAG_WC , &q->queue_flags));/* * Assign rwb and add the stats callback.
@@ -853,11 +857,6 @@ int wbt_init(struct request_queue *q)blk_stat_add_callback (q, rwb->cb); - rwb->min_lat_nsec =wbt_default_latency_nsec (q); - -wbt_queue_depth_changed (&rwb->rqos); -wbt_set_write_cache (q,test_bit (QUEUE_FLAG_WC , &q->queue_flags)); -return 0 ; err_free:
Greg Kroah-Hartman
maintainerPATCH 175/717 smb3: must initialize two ACL struct fields to zero
In reply to Greg Kroah-HartmanFrom: Steve French <[email protected]>
commit f09bd695af3b8ab46fc24e5d6954a24104c38387 upstream.
Coverity spotted that we were not initalizing Stbz1 and Stbz2 to zero in create_sd_buf.
Addresses-Coverity: 1513848 ("Uninitialized scalar variable")
--- fs/cifs/smb2pdu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/cifs/smb2pdu.c +2 -1
@@ -2410,7 +2410,7 @@ create_sd_buf(umode_t mode, bool set_ownunsigned int acelen, acl_size, ace_count;unsigned int owner_offset =0 ;unsigned int group_offset =0 ; -struct smb3_acl acl; +struct smb3_acl acl = {}; *len =roundup (sizeof (struct crt_sd_ctxt ) + (sizeof (struct cifs_ace ) *4 ),8 );
@@ -2483,6 +2483,7 @@ create_sd_buf(umode_t mode, bool set_own acl.AclRevision =ACL_REVISION ;/* See 2.4.4.1 of MS-DTYP */ acl.AclSize =cpu_to_le16 (acl_size); acl.AceCount =cpu_to_le16 (ace_count); +/* acl.Sbz1 and Sbz2 MBZ so are not set here, but initialized above */ memcpy (aclptr, &acl,sizeof (struct smb3_acl )); buf->ccontext.DataLength =cpu_to_le32 (ptr - (__u8 *)&buf->sd);
Greg Kroah-Hartman
maintainerPATCH 454/717 firmware: google: Test spinlock on panic path to avoid lockups
In reply to Greg Kroah-HartmanFrom: Guilherme G. Piccoli <[email protected]>
[ Upstream commit 3e081438b8e639cc76ef1a5ce0c1bd8a154082c7 ]
Currently the gsmi driver registers a panic notifier as well as reboot and die notifiers. The callbacks registered are called in atomic and very limited context - for instance, panic disables preemption and local IRQs, also all secondary CPUs (not executing the panic path) are shutdown.
With that said, taking a spinlock in this scenario is a dangerous invitation for lockup scenarios. So, fix that by checking if the spinlock is free to acquire in the panic notifier callback - if not, bail-out and avoid a potential hang.
--- drivers/firmware/google/gsmi.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/firmware/google/gsmi.c +9 -0
@@ -681,6 +681,15 @@ static struct notifier_block gsmi_die_notifier = {static int gsmi_panic_callback (struct notifier_block *nb,unsigned long reason,void *arg) { + +/* +* Panic callbacks are executed with all other CPUs stopped, +* so we must not attempt to spin waiting for gsmi_dev.lock +* to be released. +*/ +if (spin_is_locked (&gsmi_dev.lock)) +return NOTIFY_DONE ; +gsmi_shutdown_reason (GSMI_SHUTDOWN_PANIC );return NOTIFY_DONE ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 390/717 clk: samsung: exynosautov9: correct register offsets of peric0/c1
In reply to Greg Kroah-HartmanFrom: Chanho Park <[email protected]>
[ Upstream commit 67d98943408bce835185688cb75ebbb45b91e572 ]
Some register offsets of peric0 and peric1 cmu blocks need to be corrected and re-ordered by numerical order.
--- drivers/clk/samsung/clk-exynosautov9.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/clk/samsung/clk-exynosautov9.c +10 -10
@@ -1170,9 +1170,9 @@ static const struct samsung_cmu_info fsys2_cmu_info __initconst = {#define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_2 0x2058#define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_3 0x205c#define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_4 0x2060 -#define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_7 0x206c#define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_5 0x2064#define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_6 0x2068 +#define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_7 0x206c#define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_8 0x2070#define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_9 0x2074#define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_10 0x204c
@@ -1418,14 +1418,14 @@ static const struct samsung_cmu_info peric0_cmu_info __initconst = {#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_IPCLK_11 0x2020#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_0 0x2044#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_1 0x2048 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_2 0x2058 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_3 0x205c -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_4 0x2060 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_7 0x206c -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_5 0x2064 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_6 0x2068 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_8 0x2070 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_9 0x2074 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_2 0x2054 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_3 0x2058 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_4 0x205c +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_5 0x2060 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_6 0x2064 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_7 0x2068 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_8 0x206c +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_9 0x2070#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_10 0x204c#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_11 0x2050
@@ -1463,9 +1463,9 @@ static const unsigned long peric1_clk_regs[] __initconst = {CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_2 ,CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_3 ,CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_4 , -CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_7 ,CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_5 ,CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_6 , +CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_7 ,CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_8 ,CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_9 , CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_10,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 473/717 clk: mediatek: mt8183: mfgcfg: Propagate rate changes to parent
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 9f94f545f258b15bfa6357eb62e1e307b712851e ]
The only clock in the MT8183 MFGCFG block feeds the GPU. Propagate its rate change requests to its parent, so that DVFS for the GPU can work properly.
--- drivers/clk/mediatek/clk-mt8183-mfgcfg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/mediatek/clk-mt8183-mfgcfg.c +3 -3
@@ -18,9 +18,9 @@ static const struct mtk_gate_regs mfg_cg_regs = { .sta_ofs = 0x0, }; -#define GATE_MFG (_id, _name, _parent, _shift) \ - GATE_MTK(_id, _name, _parent, &mfg_cg_regs, _shift, \ - &mtk_clk_gate_ops_setclr) +#define GATE_MFG (_id, _name, _parent, _shift) \ + GATE_MTK_FLAGS(_id, _name, _parent, &mfg_cg_regs, _shift, \ + &mtk_clk_gate_ops_setclr, CLK_SET_RATE_PARENT)static const struct mtk_gate mfg_clks[] = {GATE_MFG (CLK_MFG_BG3D ,"mfg_bg3d" ,"mfg_sel" ,0 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 119/717 jbd2: fix potential buffer head reference count leak
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
commit e0d5fc7a6d80ac2406c7dfc6bb625201d0250a8a upstream.
As in 'jbd2_fc_wait_bufs' if buffer isn't uptodate, will return -EIO without update 'journal->j_fc_off'. But 'jbd2_fc_release_bufs' will release buffer head from ‘j_fc_off - 1’ if 'bh' is NULL will terminal release which will lead to buffer head buffer head reference count leak.
To solve above issue, update 'journal->j_fc_off' before return -EIO.
--- fs/jbd2/journal.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/jbd2/journal.c +7 -1
@@ -928,8 +928,14 @@ int jbd2_fc_wait_bufs(journal_t *journalwait_on_buffer (bh);put_bh (bh); journal->j_fc_wbuf[i] =NULL ; -if (unlikely (!buffer_uptodate (bh))) +/* +* Update j_fc_off so jbd2_fc_release_bufs can release remain +* buffer head. +*/ +if (unlikely (!buffer_uptodate (bh))) { + journal->j_fc_off = i;return -EIO ; + } }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 329/717 ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit bfb735a3ceff0bab6473bac275da96f9b2a06dec ]
In eukrea_tlv320_probe(), we need to hold the reference returned from of_find_compatible_node() which has increased the refcount and then call of_node_put() with it when done.
--- sound/soc/fsl/eukrea-tlv320.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
sound/soc/fsl/eukrea-tlv320.c +5 -3
@@ -86,7 +86,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev)int ret;int int_port =0 , ext_port;struct device_node *np = pdev->dev.of_node; -struct device_node *ssi_np =NULL , *codec_np =NULL ; +struct device_node *ssi_np =NULL , *codec_np =NULL , *tmp_np =NULL ; eukrea_tlv320.dev = &pdev->dev;if (np) {
@@ -143,7 +143,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) }if (machine_is_eukrea_cpuimx27 () || -of_find_compatible_node (NULL ,NULL ,"fsl,imx21-audmux" )) { + (tmp_np =of_find_compatible_node (NULL ,NULL ,"fsl,imx21-audmux" ))) { imx_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0, IMX_AUDMUX_V1_PCR_SYN | IMX_AUDMUX_V1_PCR_TFSDIR |
@@ -158,10 +158,11 @@ static int eukrea_tlv320_probe(struct platform_device *pdev)IMX_AUDMUX_V1_PCR_SYN |IMX_AUDMUX_V1_PCR_RXDSEL (MX27_AUDMUX_HPCR1_SSI0 ) ); +of_node_put (tmp_np); }else if (machine_is_eukrea_cpuimx25sd () ||machine_is_eukrea_cpuimx35sd () ||machine_is_eukrea_cpuimx51sd () || -of_find_compatible_node (NULL ,NULL ,"fsl,imx31-audmux" )) { + (tmp_np =of_find_compatible_node (NULL ,NULL ,"fsl,imx31-audmux" ))) {if (!np) ext_port =machine_is_eukrea_cpuimx25sd () ?4 :3 ;
@@ -178,6 +179,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev)IMX_AUDMUX_V2_PTCR_SYN ,IMX_AUDMUX_V2_PDCR_RXDSEL (int_port) ); +of_node_put (tmp_np); }else {if (np) {/* The eukrea,asoc-tlv320 driver was explicitly
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 470/717 mfd: fsl-imx25: Fix check for platform_get_irq() errors
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 75db7907355ca5e2ff606e9dd3e86b6c3a455fe2 ]
The mx25_tsadc_remove() function assumes all non-zero returns are success but the platform_get_irq() function returns negative on error and positive non-zero values on success. It never returns zero, but if it did then treat that as a success.
--- drivers/mfd/fsl-imx25-tsadc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/fsl-imx25-tsadc.c +2 -2
@@ -69,7 +69,7 @@ static int mx25_tsadc_setup_irq(struct platform_device *pdev,int irq; irq =platform_get_irq (pdev,0 ); -if (irq <=0 ) +if (irq <0 )return irq; tsadc->domain = irq_domain_add_simple(np, 2, 0, &mx25_tsadc_domain_ops,
@@ -89,7 +89,7 @@ static int mx25_tsadc_unset_irq(struct platform_device *pdev)struct mx25_tsadc *tsadc =platform_get_drvdata (pdev);int irq =platform_get_irq (pdev,0 ); -if (irq) { +if (irq >=0 ) {irq_set_chained_handler_and_data (irq,NULL ,NULL );irq_domain_remove (tsadc->domain); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 458/717 scsi: iscsi: Rename iscsi_conn_queue_work()
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
[ Upstream commit 4b9f8ce4d5e823e42944c5a0a4842b0f936365ad ]
Rename iscsi_conn_queue_work() to iscsi_conn_queue_xmit() to reflect that it handles queueing of xmits only.
Stable-dep-of: 57569c37f0ad ("scsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername()")
--- drivers/scsi/cxgbi/libcxgbi.c | 2 +- drivers/scsi/iscsi_tcp.c | 2 +- drivers/scsi/libiscsi.c | 12 ++++++------ include/scsi/libiscsi.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-)
drivers/scsi/cxgbi/libcxgbi.c +1 -1
@@ -1455,7 +1455,7 @@ void cxgbi_conn_tx_open(struct cxgbi_sock *csk)if (conn) {log_debug (1 <<CXGBI_DBG_SOCK ,"csk 0x%p, cid %d.\n" , csk, conn->id); -iscsi_conn_queue_work (conn); +iscsi_conn_queue_xmit (conn); } }EXPORT_SYMBOL_GPL (cxgbi_conn_tx_open);
drivers/scsi/iscsi_tcp.c +1 -1
@@ -205,7 +205,7 @@ static void iscsi_sw_tcp_write_space(struct sock *sk)old_write_space (sk);ISCSI_SW_TCP_DBG (conn,"iscsi_write_space\n" ); -iscsi_conn_queue_work (conn); +iscsi_conn_queue_xmit (conn); }static void iscsi_sw_tcp_conn_set_callbacks (struct iscsi_conn *conn)
drivers/scsi/libiscsi.c +6 -6
@@ -83,7 +83,7 @@ MODULE_PARM_DESC(debug_libiscsi_eh, "%s " dbg_fmt, __func__, ##arg); \ }while (0 ); -inline void iscsi_conn_queue_work (struct iscsi_conn *conn) +inline void iscsi_conn_queue_xmit (struct iscsi_conn *conn) {struct Scsi_Host *shost = conn->session->host;struct iscsi_host *ihost =shost_priv (shost);
@@ -91,7 +91,7 @@ inline void iscsi_conn_queue_work(struct iscsi_conn *conn)if (ihost->workq)queue_work (ihost->workq, &conn->xmitwork); } -EXPORT_SYMBOL_GPL (iscsi_conn_queue_work); +EXPORT_SYMBOL_GPL (iscsi_conn_queue_xmit);static void __iscsi_update_cmdsn (struct iscsi_session *session,uint32_t exp_cmdsn,uint32_t max_cmdsn)
@@ -765,7 +765,7 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, goto free_task; }else {list_add_tail (&task->running, &conn->mgmtqueue); -iscsi_conn_queue_work (conn); +iscsi_conn_queue_xmit (conn); }return task;
@@ -1513,7 +1513,7 @@ void iscsi_requeue_task(struct iscsi_task *task)*/ iscsi_put_task (task); } -iscsi_conn_queue_work (conn); +iscsi_conn_queue_xmit (conn);spin_unlock_bh (&conn->session->frwd_lock); }EXPORT_SYMBOL_GPL (iscsi_requeue_task);
@@ -1782,7 +1782,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) } }else {list_add_tail (&task->running, &conn->cmdqueue); -iscsi_conn_queue_work (conn); +iscsi_conn_queue_xmit (conn); } session->queued_cmdsn++;
@@ -1963,7 +1963,7 @@ EXPORT_SYMBOL_GPL(iscsi_suspend_tx);static void iscsi_start_tx (struct iscsi_conn *conn) {clear_bit (ISCSI_CONN_FLAG_SUSPEND_TX , &conn->flags); -iscsi_conn_queue_work (conn); +iscsi_conn_queue_xmit (conn); }/*
include/scsi/libiscsi.h +1 -1
@@ -453,7 +453,7 @@ extern int iscsi_conn_get_addr_param(struct sockaddr_storage *addr, enum iscsi_param param, char *buf);extern void iscsi_suspend_tx (struct iscsi_conn *conn);extern void iscsi_suspend_queue (struct iscsi_conn *conn); -extern void iscsi_conn_queue_work (struct iscsi_conn *conn); +extern void iscsi_conn_queue_xmit (struct iscsi_conn *conn); #define iscsi_conn_printk(prefix, _c, fmt, a...) \ iscsi_cls_conn_printk(prefix, ((struct iscsi_conn *)_c)->cls_conn, \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 482/717 clk: baikal-t1: Add shared xGMAC ref/ptp clocks internal parent
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit e2eef312762e0b5a5a70d29fe59a245c0a3cffa0 ]
Baikal-T1 CCU reference manual says that both xGMAC reference and xGMAC PTP clocks are generated by two different wrappers with the same constant divider thus each producing a 156.25 MHz signal. But for some reason both of these clock sources are gated by a single switch-flag in the CCU registers space - CCU_SYS_XGMAC_BASE.BIT(0). In order to make the clocks handled independently we need to define a shared parental gate so the base clock signal would be switched off only if both of the child-clocks are disabled.
Note the ID is intentionally set to -2 since we are going to add a one more internal clock identifier in the next commit.
--- drivers/clk/baikal-t1/ccu-div.c | 1 + drivers/clk/baikal-t1/ccu-div.h | 6 ++++++ drivers/clk/baikal-t1/clk-ccu-div.c | 8 +++++--- 3 files changed, 12 insertions(+), 3 deletions(-)
drivers/clk/baikal-t1/ccu-div.c +1 -0
@@ -579,6 +579,7 @@ struct ccu_div *ccu_div_hw_register(const struct ccu_div_init_data *div_init) goto err_free_div; } parent_data.fw_name = div_init->parent_name; + parent_data.name = div_init->parent_name; hw_init.parent_data = &parent_data; hw_init.num_parents =1 ;
drivers/clk/baikal-t1/ccu-div.h +6 -0
@@ -13,6 +13,12 @@#include <linux/bits.h> #include <linux/of.h> +/* +* CCU Divider private clock IDs +* @CCU_SYS_XGMAC_CLK: CCU XGMAC internal clock +*/ +#define CCU_SYS_XGMAC_CLK -2 +/* * CCU Divider private flags * @CCU_DIV_SKIP_ONE: Due to some reason divider can't be set to 1.
drivers/clk/baikal-t1/clk-ccu-div.c +5 -3
@@ -204,10 +204,12 @@ static const struct ccu_div_info sys_info[] = { "eth_clk", CCU_SYS_GMAC1_BASE, 5),CCU_DIV_FIXED_INFO (CCU_SYS_GMAC1_PTP_CLK ,"sys_gmac1_ptp_clk" ,"eth_clk" ,10 ), -CCU_DIV_GATE_INFO (CCU_SYS_XGMAC_REF_CLK ,"sys_xgmac_ref_clk" , -"eth_clk" ,CCU_SYS_XGMAC_BASE ,8 ), +CCU_DIV_GATE_INFO (CCU_SYS_XGMAC_CLK ,"sys_xgmac_clk" , +"eth_clk" ,CCU_SYS_XGMAC_BASE ,1 ), +CCU_DIV_FIXED_INFO (CCU_SYS_XGMAC_REF_CLK ,"sys_xgmac_ref_clk" , +"sys_xgmac_clk" ,8 ),CCU_DIV_FIXED_INFO (CCU_SYS_XGMAC_PTP_CLK ,"sys_xgmac_ptp_clk" , -"eth_clk" ,8 ), +"sys_xgmac_clk" ,8 ),CCU_DIV_GATE_INFO (CCU_SYS_USB_CLK ,"sys_usb_clk" ,"eth_clk" ,CCU_SYS_USB_BASE ,10 ), CCU_DIV_VAR_INFO(CCU_SYS_PVT_CLK, "sys_pvt_clk",
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 171/717 drm/i915: Fix watermark calculations for DG2 CCS modifiers
In reply to Greg Kroah-HartmanFrom: Ville Syrjälä <[email protected]>
commit ccfa6d35f9233702c924316cdf40c05b6ce88113 upstream.
Take the DG2 CCS modifiers into account when calculating the watermarks. Othwerwise we'll calculate the watermarks thinking these tile-4 modifiers are linear.
The rc_surface part is actually a nop since that is not used for any glk+ platform.
--- drivers/gpu/drm/i915/intel_pm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +6 -2
@@ -5310,13 +5310,17 @@ skl_compute_wm_params(const struct intel modifier == I915_FORMAT_MOD_Yf_TILED_CCS || modifier ==I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || modifier ==I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS || - modifier ==I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC ; + modifier ==I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC || + modifier ==I915_FORMAT_MOD_4_TILED_DG2_RC_CCS || + modifier ==I915_FORMAT_MOD_4_TILED_DG2_MC_CCS ; wp->x_tiled = modifier ==I915_FORMAT_MOD_X_TILED ; wp->rc_surface = modifier ==I915_FORMAT_MOD_Y_TILED_CCS || modifier == I915_FORMAT_MOD_Yf_TILED_CCS || modifier ==I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || modifier ==I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS || - modifier ==I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC ; + modifier ==I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC || + modifier ==I915_FORMAT_MOD_4_TILED_DG2_RC_CCS || + modifier ==I915_FORMAT_MOD_4_TILED_DG2_MC_CCS ; wp->is_planar =intel_format_info_is_yuv_semiplanar (format, modifier); wp->width = width;
Greg Kroah-Hartman
maintainerPATCH 446/717 usb: dwc3: core: fix some leaks in probe
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 2a735e4b5580a2a6bbd6572109b4c4f163c57462 ]
The dwc3_get_properties() function calls:
dwc->usb_psy = power_supply_get_by_name(usb_psy_name);
so there is some additional clean up required on these error paths.
--- drivers/usb/dwc3/core.c | 58 +++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 22 deletions(-)
drivers/usb/dwc3/core.c +36 -22
@@ -1678,8 +1678,10 @@ static int dwc3_probe(struct platform_device *pdev)dwc3_get_properties (dwc); dwc->reset =devm_reset_control_array_get_optional_shared (dev); -if (IS_ERR (dwc->reset)) -return PTR_ERR (dwc->reset); +if (IS_ERR (dwc->reset)) { + ret =PTR_ERR (dwc->reset); + goto put_usb_psy; + }if (dev->of_node) {/*
@@ -1689,45 +1691,57 @@ static int dwc3_probe(struct platform_device *pdev)* check for them to retain backwards compatibility. */ dwc->bus_clk =devm_clk_get_optional (dev,"bus_early" ); -if (IS_ERR (dwc->bus_clk)) -return dev_err_probe (dev,PTR_ERR (dwc->bus_clk), -"could not get bus clock\n" ); +if (IS_ERR (dwc->bus_clk)) { + ret =dev_err_probe (dev,PTR_ERR (dwc->bus_clk), +"could not get bus clock\n" ); + goto put_usb_psy; + }if (dwc->bus_clk ==NULL ) { dwc->bus_clk =devm_clk_get_optional (dev,"bus_clk" ); -if (IS_ERR (dwc->bus_clk)) -return dev_err_probe (dev,PTR_ERR (dwc->bus_clk), -"could not get bus clock\n" ); +if (IS_ERR (dwc->bus_clk)) { + ret =dev_err_probe (dev,PTR_ERR (dwc->bus_clk), +"could not get bus clock\n" ); + goto put_usb_psy; + } } dwc->ref_clk =devm_clk_get_optional (dev,"ref" ); -if (IS_ERR (dwc->ref_clk)) -return dev_err_probe (dev,PTR_ERR (dwc->ref_clk), -"could not get ref clock\n" ); +if (IS_ERR (dwc->ref_clk)) { + ret =dev_err_probe (dev,PTR_ERR (dwc->ref_clk), +"could not get ref clock\n" ); + goto put_usb_psy; + }if (dwc->ref_clk ==NULL ) { dwc->ref_clk =devm_clk_get_optional (dev,"ref_clk" ); -if (IS_ERR (dwc->ref_clk)) -return dev_err_probe (dev,PTR_ERR (dwc->ref_clk), -"could not get ref clock\n" ); +if (IS_ERR (dwc->ref_clk)) { + ret =dev_err_probe (dev,PTR_ERR (dwc->ref_clk), +"could not get ref clock\n" ); + goto put_usb_psy; + } } dwc->susp_clk =devm_clk_get_optional (dev,"suspend" ); -if (IS_ERR (dwc->susp_clk)) -return dev_err_probe (dev,PTR_ERR (dwc->susp_clk), -"could not get suspend clock\n" ); +if (IS_ERR (dwc->susp_clk)) { + ret =dev_err_probe (dev,PTR_ERR (dwc->susp_clk), +"could not get suspend clock\n" ); + goto put_usb_psy; + }if (dwc->susp_clk ==NULL ) { dwc->susp_clk =devm_clk_get_optional (dev,"suspend_clk" ); -if (IS_ERR (dwc->susp_clk)) -return dev_err_probe (dev,PTR_ERR (dwc->susp_clk), -"could not get suspend clock\n" ); +if (IS_ERR (dwc->susp_clk)) { + ret =dev_err_probe (dev,PTR_ERR (dwc->susp_clk), +"could not get suspend clock\n" ); + goto put_usb_psy; + } } } ret =reset_control_deassert (dwc->reset);if (ret) -return ret; + goto put_usb_psy; ret =dwc3_clk_enable (dwc);if (ret)
@@ -1827,7 +1841,7 @@ static int dwc3_probe(struct platform_device *pdev)dwc3_clk_disable (dwc); assert_reset:reset_control_assert (dwc->reset); - +put_usb_psy:if (dwc->usb_psy)power_supply_put (dwc->usb_psy);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 455/717 serial: 8250: Fix restoring termios speed after suspend
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 379a33786d489ab81885ff0b3935cfeb36137fea ]
Since commit edc6afc54968 ("tty: switch to ktermios and new framework") termios speed is no longer stored only in c_cflag member but also in new additional c_ispeed and c_ospeed members. If BOTHER flag is set in c_cflag then termios speed is stored only in these new members.
Since commit 027b57170bf8 ("serial: core: Fix initializing and restoring termios speed") termios speed is available also in struct console.
So properly restore also c_ispeed and c_ospeed members after suspend to fix restoring termios speed which is not represented by Bnnn constant.
--- drivers/tty/serial/8250/8250_port.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_port.c +6 -1
@@ -3325,8 +3325,13 @@ static void serial8250_console_restore(struct uart_8250_port *up)unsigned int baud, quot, frac =0 ; termios.c_cflag = port->cons->cflag; -if (port->state->port.tty && termios.c_cflag ==0 ) + termios.c_ispeed = port->cons->ispeed; + termios.c_ospeed = port->cons->ospeed; +if (port->state->port.tty && termios.c_cflag ==0 ) { termios.c_cflag = port->state->port.tty->termios.c_cflag; + termios.c_ispeed = port->state->port.tty->termios.c_ispeed; + termios.c_ospeed = port->state->port.tty->termios.c_ospeed; + } baud =serial8250_get_baud_rate (port, &termios,NULL ); quot =serial8250_get_divisor (port, baud, &frac);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 463/717 clk: qcom: gcc-sm6115: Override default Alpha PLL regs
In reply to Greg Kroah-HartmanFrom: Adam Skladowski <[email protected]>
[ Upstream commit 068a0605ef5a6b430e7278c169bfcd25b680b28f ]
The DEFAULT and BRAMMO PLL offsets are non-standard in downstream, but currently only BRAMMO ones are overridden. Override DEFAULT ones too.
A very similar thing is happening in gcc-qcm2290 driver.
--- drivers/clk/qcom/gcc-sm6115.c | 46 +++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 16 deletions(-)
drivers/clk/qcom/gcc-sm6115.c +30 -16
@@ -53,11 +53,25 @@ static struct pll_vco gpll10_vco[] = { { 750000000, 1500000000, 1 }, }; +static const u8 clk_alpha_pll_regs_offset[][PLL_OFF_MAX_REGS] = { + [CLK_ALPHA_PLL_TYPE_DEFAULT] = { + [PLL_OFF_L_VAL] = 0x04, + [PLL_OFF_ALPHA_VAL] = 0x08, + [PLL_OFF_ALPHA_VAL_U] = 0x0c, + [PLL_OFF_TEST_CTL] = 0x10, + [PLL_OFF_TEST_CTL_U] = 0x14, + [PLL_OFF_USER_CTL] = 0x18, + [PLL_OFF_USER_CTL_U] = 0x1c, + [PLL_OFF_CONFIG_CTL] = 0x20, + [PLL_OFF_STATUS] = 0x24, + }, +}; + static struct clk_alpha_pll gpll0 = { .offset = 0x0, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(0),
@@ -83,7 +97,7 @@ static struct clk_alpha_pll_postdiv gpll0_out_aux2 = { .post_div_table = post_div_table_gpll0_out_aux2, .num_post_div = ARRAY_SIZE(post_div_table_gpll0_out_aux2), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll0_out_aux2" , .parent_hws = (const struct clk_hw *[]){ &gpll0.clkr.hw },
@@ -115,7 +129,7 @@ static struct clk_alpha_pll_postdiv gpll0_out_main = { .post_div_table = post_div_table_gpll0_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll0_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll0_out_main" , .parent_hws = (const struct clk_hw *[]){ &gpll0.clkr.hw },
@@ -137,7 +151,7 @@ static struct clk_alpha_pll gpll10 = { .offset = 0xa000, .vco_table = gpll10_vco, .num_vco = ARRAY_SIZE(gpll10_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(10),
@@ -163,7 +177,7 @@ static struct clk_alpha_pll_postdiv gpll10_out_main = { .post_div_table = post_div_table_gpll10_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll10_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll10_out_main" , .parent_hws = (const struct clk_hw *[]){ &gpll10.clkr.hw },
@@ -189,7 +203,7 @@ static struct clk_alpha_pll gpll11 = { .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), .flags = SUPPORTS_DYNAMIC_UPDATE, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(11),
@@ -215,7 +229,7 @@ static struct clk_alpha_pll_postdiv gpll11_out_main = { .post_div_table = post_div_table_gpll11_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll11_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll11_out_main" , .parent_hws = (const struct clk_hw *[]){ &gpll11.clkr.hw },
@@ -229,7 +243,7 @@ static struct clk_alpha_pll gpll3 = { .offset = 0x3000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(3),
@@ -248,7 +262,7 @@ static struct clk_alpha_pll gpll4 = { .offset = 0x4000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(4),
@@ -274,7 +288,7 @@ static struct clk_alpha_pll_postdiv gpll4_out_main = { .post_div_table = post_div_table_gpll4_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll4_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll4_out_main" , .parent_hws = (const struct clk_hw *[]){ &gpll4.clkr.hw },
@@ -287,7 +301,7 @@ static struct clk_alpha_pll gpll6 = { .offset = 0x6000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(6),
@@ -313,7 +327,7 @@ static struct clk_alpha_pll_postdiv gpll6_out_main = { .post_div_table = post_div_table_gpll6_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll6_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll6_out_main" , .parent_hws = (const struct clk_hw *[]){ &gpll6.clkr.hw },
@@ -326,7 +340,7 @@ static struct clk_alpha_pll gpll7 = { .offset = 0x7000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(7),
@@ -352,7 +366,7 @@ static struct clk_alpha_pll_postdiv gpll7_out_main = { .post_div_table = post_div_table_gpll7_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll7_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll7_out_main" , .parent_hws = (const struct clk_hw *[]){ &gpll7.clkr.hw },
@@ -380,7 +394,7 @@ static struct clk_alpha_pll gpll8 = { .offset = 0x8000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .flags = SUPPORTS_DYNAMIC_UPDATE, .clkr = { .enable_reg = 0x79000,
@@ -407,7 +421,7 @@ static struct clk_alpha_pll_postdiv gpll8_out_main = { .post_div_table = post_div_table_gpll8_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll8_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data ){ .name ="gpll8_out_main" , .parent_hws = (const struct clk_hw *[]){ &gpll8.clkr.hw },
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 477/717 dmaengine: ioat: stop mod_timer from resurrecting deleted timer in __cleanup()
In reply to Greg Kroah-HartmanFrom: Dave Jiang <[email protected]>
[ Upstream commit 898ec89dbb55b8294695ad71694a0684e62b2a73 ]
User reports observing timer event report channel halted but no error observed in CHANERR register. The driver finished self-test and released channel resources. Debug shows that __cleanup() can call mod_timer() after the timer has been deleted and thus resurrect the timer. While harmless, it causes suprious error message to be emitted. Use mod_timer_pending() call to prevent deleted timer from being resurrected.
--- drivers/dma/ioat/dma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/dma/ioat/dma.c +3 -3
@@ -656,7 +656,7 @@ static void __cleanup(struct ioatdma_chan *ioat_chan, dma_addr_t phys_complete)if (active - i ==0 ) {dev_dbg (to_dev (ioat_chan),"%s: cancel completion timeout\n" , __func__); -mod_timer (&ioat_chan->timer, jiffies +IDLE_TIMEOUT ); +mod_timer_pending (&ioat_chan->timer, jiffies +IDLE_TIMEOUT ); }/* microsecond delay by sysfs variable per pending descriptor */
@@ -682,7 +682,7 @@ static void ioat_cleanup(struct ioatdma_chan *ioat_chan)if (chanerr & (IOAT_CHANERR_HANDLE_MASK |IOAT_CHANERR_RECOVER_MASK )) { -mod_timer (&ioat_chan->timer, jiffies +IDLE_TIMEOUT ); +mod_timer_pending (&ioat_chan->timer, jiffies +IDLE_TIMEOUT );ioat_eh (ioat_chan); } }
@@ -879,7 +879,7 @@ static void check_active(struct ioatdma_chan *ioat_chan) }if (test_and_clear_bit (IOAT_CHAN_ACTIVE , &ioat_chan->state)) -mod_timer (&ioat_chan->timer, jiffies +IDLE_TIMEOUT ); +mod_timer_pending (&ioat_chan->timer, jiffies +IDLE_TIMEOUT ); }static void ioat_reboot_chan (struct ioatdma_chan *ioat_chan)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 486/717 clk: ti: Balance of_node_get() calls for of_find_node_by_name()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 058a3996b888ab60eb1857fb4fd28f1b89a9a95a ]
In ti_find_clock_provider(), of_find_node_by_name() will call of_node_put() for the 'from' argument, possibly putting the node one too many times. Let's maintain the of_node_get() from the previous search and only put when we're exiting the function early. This should avoid a misbalanced reference count on the node.
[[email protected]: Rewrite commit text, maintain reference instead of get again]
--- drivers/clk/ti/clk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clk/ti/clk.c +3 -2
@@ -148,11 +148,12 @@ static struct device_node *ti_find_clock_provider(struct device_node *from,break ; } } -of_node_put (from);kfree (tmp); -if (found) +if (found) { +of_node_put (from);return np; + }/* Fall back to using old node name base provider name */ return of_find_node_by_name (from, name);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 342/717 ASoC: stm: Fix PM disable depth imbalance in stm32_i2s_probe
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit 93618e5e05a3ce4aa6750268c5025bdb4cb7dc6e ]
The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context. We fix it by moving pm_runtime_enable to the endding of stm32_i2s_probe.
--- sound/soc/stm/stm32_i2s.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/stm/stm32_i2s.c +2 -2
@@ -1135,8 +1135,6 @@ static int stm32_i2s_probe(struct platform_device *pdev)return dev_err_probe (&pdev->dev,PTR_ERR (i2s->regmap),"Regmap init error\n" ); -pm_runtime_enable (&pdev->dev); - ret =snd_dmaengine_pcm_register (&pdev->dev, &stm32_i2s_pcm_config,0 );if (ret)return dev_err_probe (&pdev->dev, ret,"PCM DMA register error\n" );
@@ -1179,6 +1177,8 @@ static int stm32_i2s_probe(struct platform_device *pdev) FIELD_GET(I2S_VERR_MIN_MASK, val)); } +pm_runtime_enable (&pdev->dev); +return ret; error:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 431/717 RDMA/srp: Fix srp_abort()
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit 6dbe4a8dead84de474483910b02ec9e6a10fc1a9 ]
Fix the code for converting a SCSI command pointer into an SRP request pointer.
--- drivers/infiniband/ulp/srp/ib_srp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/infiniband/ulp/srp/ib_srp.c +1 -3
@@ -2790,7 +2790,7 @@ static int srp_send_tsk_mgmt(struct srp_rdma_ch *ch, u64 req_tag, u64 lun,static int srp_abort (struct scsi_cmnd *scmnd) {struct srp_target_port *target =host_to_target (scmnd->device->host); -struct srp_request *req = (struct srp_request *) scmnd->host_scribble; +struct srp_request *req =scsi_cmd_priv (scmnd);u32 tag;u16 ch_idx;struct srp_rdma_ch *ch;
@@ -2798,8 +2798,6 @@ static int srp_abort(struct scsi_cmnd *scmnd)shost_printk (KERN_ERR , target->scsi_host,"SRP abort called\n" ); -if (!req) -return SUCCESS ; tag =blk_mq_unique_tag (scsi_cmd_to_rq (scmnd)); ch_idx =blk_mq_unique_tag_to_hwq (tag);if (WARN_ON_ONCE (ch_idx >= target->ch_count))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 127/717 ext4: dont increase iversion counter for ea_inodes
In reply to Greg Kroah-HartmanFrom: Lukas Czerner <[email protected]>
commit 50f094a5580e6297bf10a807d16f0ee23fa576cf upstream.
ea_inodes are using i_version for storing part of the reference count so we really need to leave it alone.
The problem can be reproduced by xfstest ext4/026 when iversion is enabled. Fix it by not calling inode_inc_iversion() for EXT4_EA_INODE_FL inodes in ext4_mark_iloc_dirty().
--- fs/ext4/inode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/ext4/inode.c +6 -1
@@ -5731,7 +5731,12 @@ int ext4_mark_iloc_dirty(handle_t *handl }ext4_fc_track_inode (handle, inode); -if (IS_I_VERSION (inode)) +/* +* ea_inodes are using i_version for storing reference count, don't +* mess with it +*/ +if (IS_I_VERSION (inode) && + !(EXT4_I (inode)->i_flags &EXT4_EA_INODE_FL ))inode_inc_iversion (inode);/* the do_update_inode consumes one bh->b_count */
Greg Kroah-Hartman
maintainerPATCH 504/717 powerpc: Fix SPE Power ISA properties for e500v1 platforms
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 37b9345ce7f4ab17538ea62def6f6d430f091355 ]
Commit 2eb28006431c ("powerpc/e500v2: Add Power ISA properties to comply with ePAPR 1.1") introduced new include file e500v2_power_isa.dtsi and should have used it for all e500v2 platforms. But apparently it was used also for e500v1 platforms mpc8540, mpc8541, mpc8555 and mpc8560.
e500v1 cores compared to e500v2 do not support double precision floating point SPE instructions. Hence power-isa-sp.fd should not be set on e500v1 platforms, which is in e500v2_power_isa.dtsi include file.
Fix this issue by introducing a new e500v1_power_isa.dtsi include file and use it in all e500v1 device tree files.
--- .../boot/dts/fsl/e500v1_power_isa.dtsi | 51 +++++++++++++++++++ arch/powerpc/boot/dts/fsl/mpc8540ads.dts | 2 +- arch/powerpc/boot/dts/fsl/mpc8541cds.dts | 2 +- arch/powerpc/boot/dts/fsl/mpc8555cds.dts | 2 +- arch/powerpc/boot/dts/fsl/mpc8560ads.dts | 2 +- 5 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/e500v1_power_isa.dtsi
arch/powerpc/boot/dts/fsl/e500v1_power_isa.dtsi new file +51 -0
@@ -0,0 +1,51 @@ +/* + * e500v1 Power ISA Device Tree Source (include) + * + * Copyright 2012 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/ { + cpus { + power-isa-version = "2.03"; + power-isa-b; // Base + power-isa-e; // Embedded + power-isa-atb; // Alternate Time Base + power-isa-cs; // Cache Specification + power-isa-e.le; // Embedded.Little-Endian + power-isa-e.pm; // Embedded.Performance Monitor + power-isa-ecl; // Embedded Cache Locking + power-isa-mmc; // Memory Coherence + power-isa-sp; // Signal Processing Engine + power-isa-sp.fs; // SPE.Embedded Float Scalar Single + power-isa-sp.fv; // SPE.Embedded Float Vector + mmu-type = "power-embedded"; + }; +};
arch/powerpc/boot/dts/fsl/mpc8540ads.dts +1 -1
@@ -7,7 +7,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8540ADS";
arch/powerpc/boot/dts/fsl/mpc8541cds.dts +1 -1
@@ -7,7 +7,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8541CDS";
arch/powerpc/boot/dts/fsl/mpc8555cds.dts +1 -1
@@ -7,7 +7,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8555CDS";
arch/powerpc/boot/dts/fsl/mpc8560ads.dts +1 -1
@@ -7,7 +7,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8560ADS";
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 303/717 drm/dp_mst: fix drm_dp_dpcd_read return value checks
In reply to Greg Kroah-HartmanFrom: Simon Ser <[email protected]>
[ Upstream commit 2ac6cdd581f48c8f68747156fde5868486a44985 ]
drm_dp_dpcd_read returns the number of bytes read. The previous code would print garbage on DPCD error, and would exit with on error on success.
--- drivers/gpu/drm/display/drm_dp_mst_topology.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/display/drm_dp_mst_topology.c +3 -3
@@ -4916,14 +4916,14 @@ void drm_dp_mst_dump_topology(struct seq_file *m,seq_printf (m,"dpcd: %*ph\n" ,DP_RECEIVER_CAP_SIZE , buf); ret =drm_dp_dpcd_read (mgr->aux,DP_FAUX_CAP , buf,2 ); -if (ret) { +if (ret !=2 ) {seq_printf (m,"faux/mst read failed\n" ); goto out; }seq_printf (m,"faux/mst: %*ph\n" ,2 , buf); ret =drm_dp_dpcd_read (mgr->aux,DP_MSTM_CTRL , buf,1 ); -if (ret) { +if (ret !=1 ) {seq_printf (m,"mst ctrl read failed\n" ); goto out; }
@@ -4931,7 +4931,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m,/* dump the standard OUI branch header */ ret =drm_dp_dpcd_read (mgr->aux,DP_BRANCH_OUI , buf,DP_BRANCH_OUI_HEADER_SIZE ); -if (ret) { +if (ret !=DP_BRANCH_OUI_HEADER_SIZE ) {seq_printf (m,"branch oui read failed\n" ); goto out; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 472/717 mfd: da9061: Fix Failed to set Two-Wire Bus Mode.
In reply to Greg Kroah-HartmanFrom: Jens Hillenstedt <[email protected]>
[ Upstream commit 834382ea32865a4bdeae83ec2dcb9321dc9489f2 ]
In da9062_i2c_probe() regmap_clear_bits() tries to access CONFIG_J register. As CONFIG_J is not present in da9061_aa_writeable_ranges[] probe of da9061 fails:
da9062 2-0058: Entering I2C mode!
da9062 2-0058: Failed to set Two-Wire Bus Mode.
da9062: probe of 2-0058 failed with error -5
Add CONFIG_J register to da9061_aa_writeable_ranges[].
--- drivers/mfd/da9062-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/da9062-core.c +1 -0
@@ -453,6 +453,7 @@ static const struct regmap_range da9061_aa_writeable_ranges[] = {regmap_reg_range (DA9062AA_VBUCK1_B ,DA9062AA_VBUCK4_B ),regmap_reg_range (DA9062AA_VBUCK3_B ,DA9062AA_VBUCK3_B ),regmap_reg_range (DA9062AA_VLDO1_B ,DA9062AA_VLDO4_B ), +regmap_reg_range (DA9062AA_CONFIG_J ,DA9062AA_CONFIG_J ), regmap_reg_range(DA9062AA_GP_ID_0, DA9062AA_GP_ID_19), };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 430/717 RDMA/irdma: Validate udata inlen and outlen
In reply to Greg Kroah-HartmanFrom: Shiraz Saleem <[email protected]>
[ Upstream commit 34acb833cc83bdea912a160ff99b537e62bb4cf3 ]
Currently ib_copy_from_udata and ib_copy_to_udata could underfill the request and response buffer if the user-space passes an undersized value for udata->inlen or udata->outlen respectively [1] This could lead to undesirable behavior.
Zero initing the buffer only goes as far as preventing using the buffer uninitialized.
Validate udata->inlen and udata->outlen passed from user-space to ensure they are at least the required minimum size.
--- drivers/infiniband/hw/irdma/verbs.c | 67 ++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 7 deletions(-)
drivers/infiniband/hw/irdma/verbs.c +60 -7
@@ -299,13 +299,19 @@ static void irdma_alloc_push_page(struct irdma_qp *iwqp)static int irdma_alloc_ucontext (struct ib_ucontext *uctx,struct ib_udata *udata) { +#define IRDMA_ALLOC_UCTX_MIN_REQ_LEN offsetofend(struct irdma_alloc_ucontext_req, rsvd8) +#define IRDMA_ALLOC_UCTX_MIN_RESP_LEN offsetofend(struct irdma_alloc_ucontext_resp, rsvd)struct ib_device *ibdev = uctx->device;struct irdma_device *iwdev =to_iwdev (ibdev); -struct irdma_alloc_ucontext_req req; +struct irdma_alloc_ucontext_req req = {};struct irdma_alloc_ucontext_resp uresp = {};struct irdma_ucontext *ucontext =to_ucontext (uctx);struct irdma_uk_attrs *uk_attrs; +if (udata->inlen <IRDMA_ALLOC_UCTX_MIN_REQ_LEN || + udata->outlen <IRDMA_ALLOC_UCTX_MIN_RESP_LEN ) +return -EINVAL ; +if (ib_copy_from_udata (&req, udata,min (sizeof (req), udata->inlen)))return -EINVAL ;
@@ -317,7 +323,7 @@ static int irdma_alloc_ucontext(struct ib_ucontext *uctx, uk_attrs = &iwdev->rf->sc_dev.hw_attrs.uk_attrs;/* GEN_1 legacy support with libi40iw */ -if (udata->outlen <sizeof (uresp)) { +if (udata->outlen ==IRDMA_ALLOC_UCTX_MIN_RESP_LEN ) {if (uk_attrs->hw_rev !=IRDMA_GEN_1 )return -EOPNOTSUPP ;
@@ -389,6 +395,7 @@ static void irdma_dealloc_ucontext(struct ib_ucontext *context)*/ static int irdma_alloc_pd (struct ib_pd *pd,struct ib_udata *udata) { +#define IRDMA_ALLOC_PD_MIN_RESP_LEN offsetofend(struct irdma_alloc_pd_resp, rsvd)struct irdma_pd *iwpd =to_iwpd (pd);struct irdma_device *iwdev =to_iwdev (pd->device);struct irdma_sc_dev *dev = &iwdev->rf->sc_dev;
@@ -398,6 +405,9 @@ static int irdma_alloc_pd(struct ib_pd *pd, struct ib_udata *udata)u32 pd_id =0 ;int err; +if (udata && udata->outlen <IRDMA_ALLOC_PD_MIN_RESP_LEN ) +return -EINVAL ; + err =irdma_alloc_rsrc (rf, rf->allocated_pds, rf->max_pd, &pd_id, &rf->next_pd);if (err)
@@ -814,12 +824,14 @@ static int irdma_create_qp(struct ib_qp *ibqp,struct ib_qp_init_attr *init_attr, struct ib_udata *udata) { +#define IRDMA_CREATE_QP_MIN_REQ_LEN offsetofend(struct irdma_create_qp_req, user_compl_ctx) +#define IRDMA_CREATE_QP_MIN_RESP_LEN offsetofend(struct irdma_create_qp_resp, rsvd)struct ib_pd *ibpd = ibqp->pd;struct irdma_pd *iwpd =to_iwpd (ibpd);struct irdma_device *iwdev =to_iwdev (ibpd->device);struct irdma_pci_f *rf = iwdev->rf;struct irdma_qp *iwqp =to_iwqp (ibqp); -struct irdma_create_qp_req req; +struct irdma_create_qp_req req = {};struct irdma_create_qp_resp uresp = {};u32 qp_num =0 ;int err_code;
@@ -836,6 +848,10 @@ static int irdma_create_qp(struct ib_qp *ibqp,if (err_code)return err_code; +if (udata && (udata->inlen <IRDMA_CREATE_QP_MIN_REQ_LEN || + udata->outlen <IRDMA_CREATE_QP_MIN_RESP_LEN )) +return -EINVAL ; + sq_size = init_attr->cap.max_send_wr; rq_size = init_attr->cap.max_recv_wr;
@@ -1120,6 +1136,8 @@ static int irdma_query_pkey(struct ib_device *ibdev, u32 port, u16 index,int irdma_modify_qp_roce (struct ib_qp *ibqp,struct ib_qp_attr *attr,int attr_mask,struct ib_udata *udata) { +#define IRDMA_MODIFY_QP_MIN_REQ_LEN offsetofend(struct irdma_modify_qp_req, rq_flush) +#define IRDMA_MODIFY_QP_MIN_RESP_LEN offsetofend(struct irdma_modify_qp_resp, push_valid)struct irdma_pd *iwpd =to_iwpd (ibqp->pd);struct irdma_qp *iwqp =to_iwqp (ibqp);struct irdma_device *iwdev = iwqp->iwdev;
@@ -1138,6 +1156,13 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr, roce_info = &iwqp->roce_info; udp_info = &iwqp->udp_info; +if (udata) { +/* udata inlen/outlen can be 0 when supporting legacy libi40iw */ +if ((udata->inlen && udata->inlen <IRDMA_MODIFY_QP_MIN_REQ_LEN ) || + (udata->outlen && udata->outlen <IRDMA_MODIFY_QP_MIN_RESP_LEN )) +return -EINVAL ; + } +if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS )return -EOPNOTSUPP ;
@@ -1374,7 +1399,7 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr,if (iwqp->iwarp_state ==IRDMA_QP_STATE_ERROR ) {spin_unlock_irqrestore (&iwqp->lock, flags); -if (udata) { +if (udata && udata->inlen) {if (ib_copy_from_udata (&ureq, udata,min (sizeof (ureq), udata->inlen)))return -EINVAL ;
@@ -1426,7 +1451,7 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr, }else { iwqp->ibqp_state = attr->qp_state; } -if (udata && dev->hw_attrs.uk_attrs.hw_rev >=IRDMA_GEN_2 ) { +if (udata && udata->outlen && dev->hw_attrs.uk_attrs.hw_rev >=IRDMA_GEN_2 ) {struct irdma_ucontext *ucontext; ucontext = rdma_udata_to_drv_context(udata,
@@ -1466,6 +1491,8 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr,int irdma_modify_qp (struct ib_qp *ibqp,struct ib_qp_attr *attr,int attr_mask,struct ib_udata *udata) { +#define IRDMA_MODIFY_QP_MIN_REQ_LEN offsetofend(struct irdma_modify_qp_req, rq_flush) +#define IRDMA_MODIFY_QP_MIN_RESP_LEN offsetofend(struct irdma_modify_qp_resp, push_valid)struct irdma_qp *iwqp =to_iwqp (ibqp);struct irdma_device *iwdev = iwqp->iwdev;struct irdma_sc_dev *dev = &iwdev->rf->sc_dev;
@@ -1480,6 +1507,13 @@ int irdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,int err;unsigned long flags; +if (udata) { +/* udata inlen/outlen can be 0 when supporting legacy libi40iw */ +if ((udata->inlen && udata->inlen <IRDMA_MODIFY_QP_MIN_REQ_LEN ) || + (udata->outlen && udata->outlen <IRDMA_MODIFY_QP_MIN_RESP_LEN )) +return -EINVAL ; + } +if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS )return -EOPNOTSUPP ;
@@ -1565,7 +1599,7 @@ int irdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,case IB_QPS_RESET :if (iwqp->iwarp_state ==IRDMA_QP_STATE_ERROR ) {spin_unlock_irqrestore (&iwqp->lock, flags); -if (udata) { +if (udata && udata->inlen) {if (ib_copy_from_udata (&ureq, udata,min (sizeof (ureq), udata->inlen)))return -EINVAL ;
@@ -1662,7 +1696,7 @@ int irdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, } } } -if (attr_mask &IB_QP_STATE && udata && +if (attr_mask &IB_QP_STATE && udata && udata->outlen && dev->hw_attrs.uk_attrs.hw_rev >=IRDMA_GEN_2 ) {struct irdma_ucontext *ucontext;
@@ -1797,6 +1831,7 @@ static int irdma_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata)static int irdma_resize_cq (struct ib_cq *ibcq,int entries,struct ib_udata *udata) { +#define IRDMA_RESIZE_CQ_MIN_REQ_LEN offsetofend(struct irdma_resize_cq_req, user_cq_buffer)struct irdma_cq *iwcq =to_iwcq (ibcq);struct irdma_sc_dev *dev = iwcq->sc_cq.dev;struct irdma_cqp_request *cqp_request;
@@ -1819,6 +1854,9 @@ static int irdma_resize_cq(struct ib_cq *ibcq, int entries, IRDMA_FEATURE_CQ_RESIZE))return -EOPNOTSUPP ; +if (udata && udata->inlen <IRDMA_RESIZE_CQ_MIN_REQ_LEN ) +return -EINVAL ; +if (entries > rf->max_cqe)return -EINVAL ;
@@ -1951,6 +1989,8 @@ static int irdma_create_cq(struct ib_cq *ibcq,const struct ib_cq_init_attr *attr, struct ib_udata *udata) { +#define IRDMA_CREATE_CQ_MIN_REQ_LEN offsetofend(struct irdma_create_cq_req, user_cq_buf) +#define IRDMA_CREATE_CQ_MIN_RESP_LEN offsetofend(struct irdma_create_cq_resp, cq_size)struct ib_device *ibdev = ibcq->device;struct irdma_device *iwdev =to_iwdev (ibdev);struct irdma_pci_f *rf = iwdev->rf;
@@ -1969,6 +2009,11 @@ static int irdma_create_cq(struct ib_cq *ibcq, err_code =cq_validate_flags (attr->flags, dev->hw_attrs.uk_attrs.hw_rev);if (err_code)return err_code; + +if (udata && (udata->inlen <IRDMA_CREATE_CQ_MIN_REQ_LEN || + udata->outlen <IRDMA_CREATE_CQ_MIN_RESP_LEN )) +return -EINVAL ; + err_code =irdma_alloc_rsrc (rf, rf->allocated_cqs, rf->max_cq, &cq_num, &rf->next_cq);if (err_code)
@@ -2738,6 +2783,7 @@ static struct ib_mr *irdma_reg_user_mr(struct ib_pd *pd, u64 start, u64 len, u64 virt, int access, struct ib_udata *udata) { +#define IRDMA_MEM_REG_MIN_REQ_LEN offsetofend(struct irdma_mem_reg_req, sq_pages) struct irdma_device *iwdev = to_iwdev(pd->device);struct irdma_ucontext *ucontext;struct irdma_pble_alloc *palloc;
@@ -2755,6 +2801,9 @@ static struct ib_mr *irdma_reg_user_mr(struct ib_pd *pd, u64 start, u64 len,if (len > iwdev->rf->sc_dev.hw_attrs.max_mr_size)return ERR_PTR (-EINVAL ); +if (udata->inlen <IRDMA_MEM_REG_MIN_REQ_LEN ) +return ERR_PTR (-EINVAL ); + region =ib_umem_get (pd->device, start, len, access);if (IS_ERR (region)) {
@@ -4290,12 +4339,16 @@ static int irdma_create_user_ah(struct ib_ah *ibah,struct rdma_ah_init_attr *attr, struct ib_udata *udata) { +#define IRDMA_CREATE_AH_MIN_RESP_LEN offsetofend(struct irdma_create_ah_resp, rsvd) struct irdma_ah *ah = container_of(ibah, struct irdma_ah, ibah);struct irdma_device *iwdev =to_iwdev (ibah->pd->device);struct irdma_create_ah_resp uresp;struct irdma_ah *parent_ah;int err; +if (udata && udata->outlen <IRDMA_CREATE_AH_MIN_RESP_LEN ) +return -EINVAL ; + err =irdma_setup_ah (ibah, attr);if (err)return err;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 481/717 clk: baikal-t1: Fix invalid xGMAC PTP clock divider
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 3c742088686ce922704aec5b11d09bcc5a396589 ]
Most likely due to copy-paste mistake the divider has been set to 10 while according to the SoC reference manual it's supposed to be 8 thus having PTP clock frequency of 156.25 MHz.
--- drivers/clk/baikal-t1/clk-ccu-div.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/baikal-t1/clk-ccu-div.c +1 -1
@@ -207,7 +207,7 @@ static const struct ccu_div_info sys_info[] = {CCU_DIV_GATE_INFO (CCU_SYS_XGMAC_REF_CLK ,"sys_xgmac_ref_clk" ,"eth_clk" ,CCU_SYS_XGMAC_BASE ,8 ),CCU_DIV_FIXED_INFO (CCU_SYS_XGMAC_PTP_CLK ,"sys_xgmac_ptp_clk" , -"eth_clk" ,10 ), +"eth_clk" ,8 ),CCU_DIV_GATE_INFO (CCU_SYS_USB_CLK ,"sys_usb_clk" ,"eth_clk" ,CCU_SYS_USB_BASE ,10 ), CCU_DIV_VAR_INFO(CCU_SYS_PVT_CLK, "sys_pvt_clk",
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 373/717 iio: adc: at91-sama5d2_adc: lock around oversampling and sample freq
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 9780a23ed5a0a0a63683e078f576719a98d4fb70 ]
.read_raw()/.write_raw() could be called asynchronously from user space or other in kernel drivers. Without locking on st->lock these could be called asynchronously while there is a conversion in progress. Read will be harmless but changing registers while conversion is in progress may lead to inconsistent results. Thus, to avoid this lock st->lock.
--- drivers/iio/adc/at91-sama5d2_adc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/iio/adc/at91-sama5d2_adc.c +8 -4
@@ -1542,10 +1542,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, ret =at91_adc_read_position (st, chan->channel, &tmp_val); *val = tmp_val; -mutex_unlock (&st->lock); -iio_device_release_direct_mode (indio_dev);if (ret >0 ) ret =at91_adc_adjust_val_osr (st, val); +mutex_unlock (&st->lock); +iio_device_release_direct_mode (indio_dev);return ret; }
@@ -1558,10 +1558,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, ret =at91_adc_read_pressure (st, chan->channel, &tmp_val); *val = tmp_val; -mutex_unlock (&st->lock); -iio_device_release_direct_mode (indio_dev);if (ret >0 ) ret =at91_adc_adjust_val_osr (st, val); +mutex_unlock (&st->lock); +iio_device_release_direct_mode (indio_dev);return ret; }
@@ -1650,16 +1650,20 @@ static int at91_adc_write_raw(struct iio_dev *indio_dev,/* if no change, optimize out */ if (val == st->oversampling_ratio)return 0 ; +mutex_lock (&st->lock); st->oversampling_ratio = val;/* update ratio */ at91_adc_config_emr (st); +mutex_unlock (&st->lock);return 0 ;case IIO_CHAN_INFO_SAMP_FREQ :if (val < st->soc_info.min_sample_rate || val > st->soc_info.max_sample_rate)return -EINVAL ; +mutex_lock (&st->lock);at91_adc_setup_samp_freq (indio_dev, val); +mutex_unlock (&st->lock);return 0 ;default :return -EINVAL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 311/717 ASoC: tas2764: Allow mono streams
In reply to Greg Kroah-HartmanFrom: Martin Povišer <[email protected]>
[ Upstream commit 23204d928a27146d13e11c9383632775345ecca8 ]
The part is a mono speaker amp, but it can do downmix and switch between left and right channel, so the right channel range is 1 to 2.
(This mirrors commit bf54d97a835d ("ASoC: tas2770: Allow mono streams") which was a fix to the tas2770 driver.)
--- sound/soc/codecs/tas2764.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/tas2764.c +1 -1
@@ -485,7 +485,7 @@ static struct snd_soc_dai_driver tas2764_dai_driver[] = { .id = 0, .playback = { .stream_name = "ASI1 Playback", - .channels_min = 2, + .channels_min = 1, .channels_max = 2, .rates = TAS2764_RATES, .formats = TAS2764_FORMATS,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 469/717 mfd: lp8788: Fix an error handling path in lp8788_irq_init() and lp8788_irq_init()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 557244f6284f30613f2d61f14b579303165876c3 ]
In lp8788_irq_init(), if an error occurs after a successful irq_domain_add_linear() call, it must be undone by a corresponding irq_domain_remove() call.
irq_domain_remove() should also be called in lp8788_irq_exit() for the same reason.
--- drivers/mfd/lp8788-irq.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mfd/lp8788-irq.c +3 -0
@@ -175,6 +175,7 @@ int lp8788_irq_init(struct lp8788 *lp, int irq)IRQF_TRIGGER_FALLING |IRQF_ONESHOT , "lp8788-irq", irqd);if (ret) { +irq_domain_remove (lp->irqdm);dev_err (lp->dev,"failed to create a thread for IRQ_N\n" );return ret; }
@@ -188,4 +189,6 @@ void lp8788_irq_exit(struct lp8788 *lp) {if (lp->irq)free_irq (lp->irq, lp->irqdm); +if (lp->irqdm) +irq_domain_remove (lp->irqdm); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 484/717 clk: bcm2835: fix bcm2835_clock_rate_from_divisor declaration
In reply to Greg Kroah-HartmanFrom: Stefan Wahren <[email protected]>
[ Upstream commit 0b919a3728691c172312dee99ba654055ccd8c84 ]
The return value of bcm2835_clock_rate_from_divisor is always unsigned and also all caller expect this. So fix the declaration accordingly.
--- drivers/clk/bcm/clk-bcm2835.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/bcm/clk-bcm2835.c +3 -3
@@ -966,9 +966,9 @@ static u32 bcm2835_clock_choose_div(struct clk_hw *hw,return div; } -static long bcm2835_clock_rate_from_divisor (struct bcm2835_clock *clock, -unsigned long parent_rate, -u32 div) +static unsigned long bcm2835_clock_rate_from_divisor (struct bcm2835_clock *clock, +unsigned long parent_rate, +u32 div) {const struct bcm2835_clock_data *data = clock->data;u64 temp;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 483/717 clk: baikal-t1: Add SATA internal ref clock buffer
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 081a9b7c74eae4e12b2cb1b86720f836a8f29247 ]
It turns out the internal SATA reference clock signal will stay unavailable for the SATA interface consumer until the buffer on it's way is ungated. So aside with having the actual clock divider enabled we need to ungate a buffer placed on the signal way to the SATA controller (most likely some rudiment from the initial SoC release). Seeing the switch flag is placed in the same register as the SATA-ref clock divider at a non-standard ffset, let's implement it as a separate clock controller with the set-rate propagation to the parental clock divider wrapper. As such we'll be able to disable/enable and still change the original clock source rate.
--- drivers/clk/baikal-t1/ccu-div.c | 64 +++++++++++++++++++++++++++++ drivers/clk/baikal-t1/ccu-div.h | 4 ++ drivers/clk/baikal-t1/clk-ccu-div.c | 18 +++++++- 3 files changed, 85 insertions(+), 1 deletion(-)
drivers/clk/baikal-t1/ccu-div.c +64 -0
@@ -34,6 +34,7 @@#define CCU_DIV_CTL_CLKDIV_MASK (_width) \ GENMASK((_width) + CCU_DIV_CTL_CLKDIV_FLD - 1, CCU_DIV_CTL_CLKDIV_FLD)#define CCU_DIV_CTL_LOCK_SHIFTED BIT(27) +#define CCU_DIV_CTL_GATE_REF_BUF BIT(28)#define CCU_DIV_CTL_LOCK_NORMAL BIT(31)#define CCU_DIV_RST_DELAY_US 1
@@ -170,6 +171,40 @@ static int ccu_div_gate_is_enabled(struct clk_hw *hw)return !!(val &CCU_DIV_CTL_EN ); } +static int ccu_div_buf_enable (struct clk_hw *hw) +{ +struct ccu_div *div =to_ccu_div (hw); +unsigned long flags; + +spin_lock_irqsave (&div->lock, flags); +regmap_update_bits (div->sys_regs, div->reg_ctl, +CCU_DIV_CTL_GATE_REF_BUF ,0 ); +spin_unlock_irqrestore (&div->lock, flags); + +return 0 ; +} + +static void ccu_div_buf_disable (struct clk_hw *hw) +{ +struct ccu_div *div =to_ccu_div (hw); +unsigned long flags; + +spin_lock_irqsave (&div->lock, flags); +regmap_update_bits (div->sys_regs, div->reg_ctl, +CCU_DIV_CTL_GATE_REF_BUF ,CCU_DIV_CTL_GATE_REF_BUF ); +spin_unlock_irqrestore (&div->lock, flags); +} + +static int ccu_div_buf_is_enabled (struct clk_hw *hw) +{ +struct ccu_div *div =to_ccu_div (hw); +u32 val =0 ; + +regmap_read (div->sys_regs, div->reg_ctl, &val); + +return !(val &CCU_DIV_CTL_GATE_REF_BUF ); +} +static unsigned long ccu_div_var_recalc_rate (struct clk_hw *hw,unsigned long parent_rate) {
@@ -323,6 +358,7 @@ static const struct ccu_div_dbgfs_bit ccu_div_bits[] = {CCU_DIV_DBGFS_BIT_ATTR ("div_en" ,CCU_DIV_CTL_EN ),CCU_DIV_DBGFS_BIT_ATTR ("div_rst" ,CCU_DIV_CTL_RST ),CCU_DIV_DBGFS_BIT_ATTR ("div_bypass" ,CCU_DIV_CTL_SET_CLKDIV ), +CCU_DIV_DBGFS_BIT_ATTR ("div_buf" ,CCU_DIV_CTL_GATE_REF_BUF ), CCU_DIV_DBGFS_BIT_ATTR("div_lock", CCU_DIV_CTL_LOCK_NORMAL) };
@@ -441,6 +477,9 @@ static void ccu_div_var_debug_init(struct clk_hw *hw, struct dentry *dentry)continue ; } +if (!strcmp ("div_buf" , name)) +continue ; + bits[didx] = ccu_div_bits[bidx]; bits[didx].div = div;
@@ -477,6 +516,21 @@ static void ccu_div_gate_debug_init(struct clk_hw *hw, struct dentry *dentry) &ccu_div_dbgfs_fixed_clkdiv_fops); } +static void ccu_div_buf_debug_init (struct clk_hw *hw,struct dentry *dentry) +{ +struct ccu_div *div =to_ccu_div (hw); +struct ccu_div_dbgfs_bit *bit; + + bit =kmalloc (sizeof (*bit),GFP_KERNEL ); +if (!bit) +return ; + + *bit = ccu_div_bits[3 ]; + bit->div = div; +debugfs_create_file_unsafe (bit->name, ccu_div_dbgfs_mode, dentry, bit, + &ccu_div_dbgfs_bit_fops); +} +static void ccu_div_fixed_debug_init (struct clk_hw *hw,struct dentry *dentry) {struct ccu_div *div =to_ccu_div (hw);
@@ -489,6 +543,7 @@ static void ccu_div_fixed_debug_init(struct clk_hw *hw, struct dentry *dentry)#define ccu_div_var_debug_init NULL#define ccu_div_gate_debug_init NULL +#define ccu_div_buf_debug_init NULL#define ccu_div_fixed_debug_init NULL#endif /* !CONFIG_DEBUG_FS */
@@ -520,6 +575,13 @@ static const struct clk_ops ccu_div_gate_ops = { .debug_init = ccu_div_gate_debug_init }; +static const struct clk_ops ccu_div_buf_ops = { + .enable = ccu_div_buf_enable, + .disable = ccu_div_buf_disable, + .is_enabled = ccu_div_buf_is_enabled, + .debug_init = ccu_div_buf_debug_init +}; +static const struct clk_ops ccu_div_fixed_ops = { .recalc_rate = ccu_div_fixed_recalc_rate, .round_rate = ccu_div_fixed_round_rate,
@@ -566,6 +628,8 @@ struct ccu_div *ccu_div_hw_register(const struct ccu_div_init_data *div_init) }else if (div_init->type ==CCU_DIV_GATE ) { hw_init.ops = &ccu_div_gate_ops; div->divider = div_init->divider; + }else if (div_init->type ==CCU_DIV_BUF ) { + hw_init.ops = &ccu_div_buf_ops; }else if (div_init->type ==CCU_DIV_FIXED ) { hw_init.ops = &ccu_div_fixed_ops; div->divider = div_init->divider;
drivers/clk/baikal-t1/ccu-div.h +4 -0
@@ -15,8 +15,10 @@/* * CCU Divider private clock IDs +* @CCU_SYS_SATA_CLK: CCU SATA internal clock * @CCU_SYS_XGMAC_CLK: CCU XGMAC internal clock */ +#define CCU_SYS_SATA_CLK -1#define CCU_SYS_XGMAC_CLK -2/*
@@ -37,11 +39,13 @@* enum ccu_div_type - CCU Divider types * @CCU_DIV_VAR: Clocks gate with variable divider. * @CCU_DIV_GATE: Clocks gate with fixed divider. +* @CCU_DIV_BUF: Clock gate with no divider. * @CCU_DIV_FIXED: Ungateable clock with fixed divider. */ enum ccu_div_type {CCU_DIV_VAR ,CCU_DIV_GATE , +CCU_DIV_BUF ,CCU_DIV_FIXED };
drivers/clk/baikal-t1/clk-ccu-div.c +17 -1
@@ -76,6 +76,16 @@ .divider = _divider \ } +#define CCU_DIV_BUF_INFO (_id, _name, _pname, _base, _flags) \ + { \ + .id = _id, \ + .name = _name, \ + .parent_name = _pname, \ + .base = _base, \ + .type = CCU_DIV_BUF, \ + .flags = _flags \ + } +#define CCU_DIV_FIXED_INFO (_id, _name, _pname, _divider) \ { \ .id = _id, \
@@ -188,11 +198,14 @@ static const struct ccu_div_rst_map axi_rst_map[] = {* for the SoC devices registers IO-operations. */ static const struct ccu_div_info sys_info[] = { -CCU_DIV_VAR_INFO (CCU_SYS_SATA_REF_CLK ,"sys_sata_ref_clk" , +CCU_DIV_VAR_INFO (CCU_SYS_SATA_CLK ,"sys_sata_clk" ,"sata_clk" ,CCU_SYS_SATA_REF_BASE ,4 ,CLK_SET_RATE_GATE ,CCU_DIV_SKIP_ONE |CCU_DIV_LOCK_SHIFTED |CCU_DIV_RESET_DOMAIN ), +CCU_DIV_BUF_INFO (CCU_SYS_SATA_REF_CLK ,"sys_sata_ref_clk" , +"sys_sata_clk" ,CCU_SYS_SATA_REF_BASE , +CLK_SET_RATE_PARENT ),CCU_DIV_VAR_INFO (CCU_SYS_APB_CLK ,"sys_apb_clk" ,"pcie_clk" ,CCU_SYS_APB_BASE ,5 ,CLK_IS_CRITICAL ,CCU_DIV_RESET_DOMAIN ),
@@ -398,6 +411,9 @@ static int ccu_div_clk_register(struct ccu_div_data *data) init.base = info->base; init.sys_regs = data->sys_regs; init.divider = info->divider; + }else if (init.type ==CCU_DIV_BUF ) { + init.base = info->base; + init.sys_regs = data->sys_regs; }else { init.divider = info->divider; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 360/717 ARM: dts: kirkwood: lsxl: fix serial line
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit 04eabc6ac10fda9424606d9a7ab6ab9a5d95350a ]
Commit 327e15428977 ("ARM: dts: kirkwood: consolidate common pinctrl settings") unknowingly broke the serial output on this board. Before this commit, the pinmux was still configured by the bootloader and the kernel didn't reconfigured it again. This was an oversight by the initial board support where the pinmux for the serial line was never configured by the kernel. But with this commit, the serial line will be reconfigured to the wrong pins. This is especially confusing, because the output still works, but the input doesn't. Presumingly, the input is reconfigured to MPP10, but the output is connected to both MPP11 and MPP5.
Override the pinmux in the board device tree.
--- arch/arm/boot/dts/kirkwood-lsxl.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/boot/dts/kirkwood-lsxl.dtsi +5 -0
@@ -10,6 +10,11 @@ ocp@f1000000 { pinctrl: pin-controller@10000 { + /* Non-default UART pins */ + pmx_uart0: pmx-uart0 { + marvell,pins = "mpp4", "mpp5"; + }; + pmx_power_hdd: pmx-power-hdd { marvell,pins = "mpp10"; marvell,function = "gpo";
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 164/717 staging: greybus: audio_helper: remove unused and wrong debugfs usage
In reply to Greg Kroah-HartmanFrom: Greg Kroah-Hartman <[email protected]>
commit d517cdeb904ddc0cbebcc959d43596426cac40b0 upstream.
In the greybus audio_helper code, the debugfs file for the dapm has the potential to be removed and memory will be leaked. There is also the very real potential for this code to remove ALL debugfs entries from the system, and it seems like this is what will really happen if this code ever runs. This all is very wrong as the greybus audio driver did not create this debugfs file, the sound core did and controls the lifespan of it.
So remove all of the debugfs logic from the audio_helper code as there's no way it could be correct. If this really is needed, it can come back with a fixup for the incorrect usage of the debugfs_lookup() call which is what caused this to be noticed at all.
--- drivers/staging/greybus/audio_helper.c | 11 ----------- 1 file changed, 11 deletions(-)
drivers/staging/greybus/audio_helper.c +0 -11
@@ -3,7 +3,6 @@* Greybus Audio Sound SoC helper APIs */ -#include <linux/debugfs.h> #include <sound/core.h> #include <sound/soc.h> #include <sound/soc-dapm.h>
@@ -116,10 +115,6 @@ int gbaudio_dapm_free_controls(struct sn {int i;struct snd_soc_dapm_widget *w, *next_w; -#ifdef CONFIG_DEBUG_FS -struct dentry *parent = dapm->debugfs_dapm; -struct dentry *debugfs_w =NULL ; -#endif mutex_lock (&dapm->card->dapm_mutex);for (i =0 ; i < num; i++) {
@@ -139,12 +134,6 @@ int gbaudio_dapm_free_controls(struct sncontinue ; } widget++; -#ifdef CONFIG_DEBUG_FS -if (!parent) - debugfs_w =debugfs_lookup (w->name, parent); -debugfs_remove (debugfs_w); - debugfs_w =NULL ; -#endif gbaudio_dapm_free_widget (w); }mutex_unlock (&dapm->card->dapm_mutex);
Greg Kroah-Hartman
maintainerPATCH 461/717 scsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername()
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
[ Upstream commit 57569c37f0add1b6489e1a1563c71519daf732cf ]
Fix a NULL pointer crash that occurs when we are freeing the socket at the same time we access it via sysfs.
The problem is that:
1. iscsi_sw_tcp_conn_get_param() and iscsi_sw_tcp_host_get_param() take the frwd_lock and do sock_hold() then drop the frwd_lock. sock_hold() does a get on the "struct sock".
2. iscsi_sw_tcp_release_conn() does sockfd_put() which does the last put on the "struct socket" and that does __sock_release() which sets the sock->ops to NULL.
3. iscsi_sw_tcp_conn_get_param() and iscsi_sw_tcp_host_get_param() then
call kernel_getpeername() which accesses the NULL sock->ops.
Above we do a get on the "struct sock", but we needed a get on the "struct socket". Originally, we just held the frwd_lock the entire time but in commit bcf3a2953d36 ("scsi: iscsi: iscsi_tcp: Avoid holding spinlock while calling getpeername()") we switched to refcount based because the network layer changed and started taking a mutex in that path, so we could no longer hold the frwd_lock.
Instead of trying to maintain multiple refcounts, this just has us use a mutex for accessing the socket in the interface code paths.
--- drivers/scsi/iscsi_tcp.c | 73 ++++++++++++++++++++++++++++------------ drivers/scsi/iscsi_tcp.h | 3 ++ 2 files changed, 55 insertions(+), 21 deletions(-)
drivers/scsi/iscsi_tcp.c +52 -21
@@ -595,6 +595,8 @@ iscsi_sw_tcp_conn_create(struct iscsi_cls_session *cls_session,INIT_WORK (&conn->recvwork, iscsi_sw_tcp_recv_data_work); tcp_sw_conn->queue_recv = iscsi_recv_from_iscsi_q; +mutex_init (&tcp_sw_conn->sock_lock); + tfm =crypto_alloc_ahash ("crc32c" ,0 ,CRYPTO_ALG_ASYNC );if (IS_ERR (tfm)) goto free_conn;
@@ -629,11 +631,15 @@ iscsi_sw_tcp_conn_create(struct iscsi_cls_session *cls_session,static void iscsi_sw_tcp_release_conn (struct iscsi_conn *conn) { -struct iscsi_session *session = conn->session;struct iscsi_tcp_conn *tcp_conn = conn->dd_data;struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data;struct socket *sock = tcp_sw_conn->sock; +/* +* The iscsi transport class will make sure we are not called in +* parallel with start, stop, bind and destroys. However, this can be +* called twice if userspace does a stop then a destroy. +*/ if (!sock)return ;
@@ -649,9 +655,9 @@ static void iscsi_sw_tcp_release_conn(struct iscsi_conn *conn)iscsi_suspend_rx (conn); -spin_lock_bh (&session->frwd_lock); +mutex_lock (&tcp_sw_conn->sock_lock); tcp_sw_conn->sock =NULL ; -spin_unlock_bh (&session->frwd_lock); +mutex_unlock (&tcp_sw_conn->sock_lock);sockfd_put (sock); }
@@ -703,7 +709,6 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session, struct iscsi_cls_conn *cls_conn, uint64_t transport_eph, int is_leading) { - struct iscsi_session *session = cls_session->dd_data; struct iscsi_conn *conn = cls_conn->dd_data;struct iscsi_tcp_conn *tcp_conn = conn->dd_data;struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data;
@@ -723,10 +728,10 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session,if (err) goto free_socket; -spin_lock_bh (&session->frwd_lock); +mutex_lock (&tcp_sw_conn->sock_lock);/* bind iSCSI connection and socket */ tcp_sw_conn->sock = sock; -spin_unlock_bh (&session->frwd_lock); +mutex_unlock (&tcp_sw_conn->sock_lock);/* setup Socket parameters */ sk = sock->sk;
@@ -763,8 +768,15 @@ static int iscsi_sw_tcp_conn_set_param(struct iscsi_cls_conn *cls_conn,break ;case ISCSI_PARAM_DATADGST_EN :iscsi_set_param (cls_conn, param, buf, buflen); + +mutex_lock (&tcp_sw_conn->sock_lock); +if (!tcp_sw_conn->sock) { +mutex_unlock (&tcp_sw_conn->sock_lock); +return -ENOTCONN ; + } tcp_sw_conn->sendpage = conn->datadgst_en ? sock_no_sendpage : tcp_sw_conn->sock->ops->sendpage; +mutex_unlock (&tcp_sw_conn->sock_lock);break ;case ISCSI_PARAM_MAX_R2T :return iscsi_tcp_set_max_r2t (conn, buf);
@@ -779,8 +791,8 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn, enum iscsi_param param, char *buf) { struct iscsi_conn *conn = cls_conn->dd_data; -struct iscsi_tcp_conn *tcp_conn = conn->dd_data; -struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; +struct iscsi_sw_tcp_conn *tcp_sw_conn; +struct iscsi_tcp_conn *tcp_conn;struct sockaddr_in6 addr;struct socket *sock;int rc;
@@ -790,21 +802,36 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn,case ISCSI_PARAM_CONN_ADDRESS :case ISCSI_PARAM_LOCAL_PORT :spin_lock_bh (&conn->session->frwd_lock); -if (!tcp_sw_conn || !tcp_sw_conn->sock) { +if (!conn->session->leadconn) {spin_unlock_bh (&conn->session->frwd_lock);return -ENOTCONN ; } - sock = tcp_sw_conn->sock; -sock_hold (sock->sk); +/* +* The conn has been setup and bound, so just grab a ref +* incase a destroy runs while we are in the net layer. +*/ +iscsi_get_conn (conn->cls_conn);spin_unlock_bh (&conn->session->frwd_lock); + tcp_conn = conn->dd_data; + tcp_sw_conn = tcp_conn->dd_data; + +mutex_lock (&tcp_sw_conn->sock_lock); + sock = tcp_sw_conn->sock; +if (!sock) { + rc = -ENOTCONN ; + goto sock_unlock; + } +if (param ==ISCSI_PARAM_LOCAL_PORT ) rc =kernel_getsockname (sock, (struct sockaddr *)&addr);else rc =kernel_getpeername (sock, (struct sockaddr *)&addr); -sock_put (sock->sk); +sock_unlock: +mutex_unlock (&tcp_sw_conn->sock_lock); +iscsi_put_conn (conn->cls_conn);if (rc <0 )return rc;
@@ -842,17 +869,21 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost, } tcp_conn = conn->dd_data; tcp_sw_conn = tcp_conn->dd_data; - sock = tcp_sw_conn->sock; -if (!sock) { -spin_unlock_bh (&session->frwd_lock); -return -ENOTCONN ; - } -sock_hold (sock->sk); +/* +* The conn has been setup and bound, so just grab a ref +* incase a destroy runs while we are in the net layer. +*/ +iscsi_get_conn (conn->cls_conn);spin_unlock_bh (&session->frwd_lock); - rc =kernel_getsockname (sock, - (struct sockaddr *)&addr); -sock_put (sock->sk); +mutex_lock (&tcp_sw_conn->sock_lock); + sock = tcp_sw_conn->sock; +if (!sock) + rc = -ENOTCONN ; +else + rc =kernel_getsockname (sock, (struct sockaddr *)&addr); +mutex_unlock (&tcp_sw_conn->sock_lock); +iscsi_put_conn (conn->cls_conn);if (rc <0 )return rc;
drivers/scsi/iscsi_tcp.h +3 -0
@@ -28,6 +28,9 @@ struct iscsi_sw_tcp_send {struct iscsi_sw_tcp_conn {struct socket *sock; +/* Taken when accessing the sock from the netlink/sysfs interface */ +struct mutex sock_lock; +struct work_struct recvwork;bool queue_recv;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 464/717 RDMA/rxe: Fix resize_finish() in rxe_queue.c
In reply to Greg Kroah-HartmanFrom: Bob Pearson <[email protected]>
[ Upstream commit fda5d0cf8aef12f0a4f714a96a4b2fce039a3e55 ]
Currently in resize_finish() in rxe_queue.c there is a loop which copies the entries in the original queue into a newly allocated queue. The termination logic for this loop is incorrect. The call to queue_next_index() updates cons but has no effect on whether the queue is empty. So if the queue starts out empty nothing is copied but if it is not then the loop will run forever. This patch changes the loop to compare the value of cons to the original producer index.
--- drivers/infiniband/sw/rxe/rxe_queue.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/infiniband/sw/rxe/rxe_queue.c +7 -5
@@ -112,23 +112,25 @@ static int resize_finish(struct rxe_queue *q, struct rxe_queue *new_q, unsigned int num_elem) {enum queue_type type = q->type; +u32 new_prod;u32 prod;u32 cons;if (!queue_empty (q, q->type) && (num_elem <queue_count (q, type)))return -EINVAL ; - prod =queue_get_producer (new_q, type); + new_prod =queue_get_producer (new_q, type); + prod =queue_get_producer (q, type); cons =queue_get_consumer (q, type); -while (!queue_empty (q, type)) { -memcpy (queue_addr_from_index (new_q, prod), +while ((prod - cons) & q->index_mask) { +memcpy (queue_addr_from_index (new_q, new_prod),queue_addr_from_index (q, cons), new_q->elem_size); - prod =queue_next_index (new_q, prod); + new_prod =queue_next_index (new_q, new_prod); cons =queue_next_index (q, cons); } - new_q->buf->producer_index = prod; + new_q->buf->producer_index = new_prod; q->buf->consumer_index = cons;/* update private index copies */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 316/717 platform/chrome: cros_ec_typec: Correct alt mode index
In reply to Greg Kroah-HartmanFrom: Prashant Malani <[email protected]>
[ Upstream commit 4e477663e396f48c5cfc5f2d75d4b514f409516a ]
Alt mode indices used by USB PD (Power Delivery) start with 1, not 0.
Update the alt mdoe registration code to factor this in to the alt mode descriptor.
--- drivers/platform/chrome/cros_ec_typec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/chrome/cros_ec_typec.c +1 -1
@@ -669,7 +669,7 @@ static int cros_typec_register_altmodes(struct cros_typec_data *typec, int port_for (j =0 ; j < sop_disc->svids[i].mode_count; j++) {memset (&desc,0 ,sizeof (desc)); desc.svid = sop_disc->svids[i].svid; - desc.mode = j; + desc.mode = j +1 ; desc.vdo = sop_disc->svids[i].mode_vdo[j];if (is_partner)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 505/717 powerpc/kprobes: Fix null pointer reference in arch_prepare_kprobe()
In reply to Greg Kroah-HartmanFrom: Li Huafei <[email protected]>
[ Upstream commit 97f88a3d723162781d6cbfdc7b9617eefab55b19 ]
I found a null pointer reference in arch_prepare_kprobe():
# echo 'p cmdline_proc_show' > kprobe_events
# echo 'p cmdline_proc_show+16' >> kprobe_events
Kernel attempted to read user page (0) - exploit attempt? (uid: 0)
BUG: Kernel NULL pointer dereference on read at 0x00000000
Faulting instruction address: 0xc000000000050bfc
Oops: Kernel access of bad area, sig: 11 [#1]
LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA PowerNV
Modules linked in:
CPU: 0 PID: 122 Comm: sh Not tainted 6.0.0-rc3-00007-gdcf8e5633e2e #10
NIP: c000000000050bfc LR: c000000000050bec CTR: 0000000000005bdc
REGS: c0000000348475b0 TRAP: 0300 Not tainted (6.0.0-rc3-00007-gdcf8e5633e2e)
MSR: 9000000000009033 <SF,HV,EE,ME,IR,DR,RI,LE> CR: 88002444 XER: 20040006
CFAR: c00000000022d100 DAR: 0000000000000000 DSISR: 40000000 IRQMASK: 0
...
NIP arch_prepare_kprobe+0x10c/0x2d0
LR arch_prepare_kprobe+0xfc/0x2d0
Call Trace:
0xc0000000012f77a0 (unreliable)
register_kprobe+0x3c0/0x7a0
__register_trace_kprobe+0x140/0x1a0
__trace_kprobe_create+0x794/0x1040
trace_probe_create+0xc4/0xe0
create_or_delete_trace_kprobe+0x2c/0x80
trace_parse_run_command+0xf0/0x210
probes_write+0x20/0x40
vfs_write+0xfc/0x450
ksys_write+0x84/0x140
system_call_exception+0x17c/0x3a0
system_call_vectored_common+0xe8/0x278
--- interrupt: 3000 at 0x7fffa5682de0
NIP: 00007fffa5682de0 LR: 0000000000000000 CTR: 0000000000000000
REGS: c000000034847e80 TRAP: 3000 Not tainted (6.0.0-rc3-00007-gdcf8e5633e2e)
MSR: 900000000280f033 <SF,HV,VEC,VSX,EE,PR,FP,ME,IR,DR,RI,LE> CR: 44002408 XER: 00000000The address being probed has some special:
cmdline_proc_show: Probe based on ftrace
cmdline_proc_show+16: Probe for the next instruction at the ftrace location
The ftrace-based kprobe does not generate kprobe::ainsn::insn, it gets set to NULL. In arch_prepare_kprobe() it will check for:
...
prev = get_kprobe(p->addr - 1);
preempt_enable_no_resched();
if (prev && ppc_inst_prefixed(ppc_inst_read(prev->ainsn.insn))) {
...If prev is based on ftrace, 'ppc_inst_read(prev->ainsn.insn)' will occur with a null pointer reference. At this point prev->addr will not be a prefixed instruction, so the check can be skipped.
Check if prev is ftrace-based kprobe before reading 'prev->ainsn.insn' to fix this problem.
--- arch/powerpc/kernel/kprobes.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/powerpc/kernel/kprobes.c +7 -1
@@ -161,7 +161,13 @@ int arch_prepare_kprobe(struct kprobe *p)preempt_disable (); prev =get_kprobe (p->addr -1 );preempt_enable_no_resched (); -if (prev &&ppc_inst_prefixed (ppc_inst_read (prev->ainsn.insn))) { + +/* +* When prev is a ftrace-based kprobe, we don't have an insn, and it +* doesn't probe for prefixed instruction. +*/ +if (prev && !kprobe_ftrace (prev) && +ppc_inst_prefixed (ppc_inst_read (prev->ainsn.insn))) {printk ("Cannot register a kprobe on the second word of prefixed instruction\n" ); ret = -EINVAL ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 487/717 clk: ti: dra7-atl: Fix reference leak in of_dra7_atl_clk_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 9c59a01caba26ec06fefd6ca1f22d5fd1de57d63 ]
pm_runtime_get_sync() will increment pm usage counter. Forgetting to putting operation will result in reference leak. Add missing pm_runtime_put_sync in some error paths.
--- drivers/clk/ti/clk-dra7-atl.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/clk/ti/clk-dra7-atl.c +6 -3
@@ -253,14 +253,16 @@ static int of_dra7_atl_clk_probe(struct platform_device *pdev)if (rc) {pr_err ("%s: failed to lookup atl clock %d\n" , __func__, i); -return -EINVAL ; + ret = -EINVAL ; + goto pm_put; } clk =of_clk_get_from_provider (&clkspec);if (IS_ERR (clk)) {pr_err ("%s: failed to get atl clock %d from provider\n" , __func__, i); -return PTR_ERR (clk); + ret =PTR_ERR (clk); + goto pm_put; } cdesc =to_atl_desc (__clk_get_hw (clk));
@@ -293,8 +295,9 @@ static int of_dra7_atl_clk_probe(struct platform_device *pdev)if (cdesc->enabled)atl_clk_enable (__clk_get_hw (clk)); } -pm_runtime_put_sync (cinfo->dev); +pm_put: +pm_runtime_put_sync (cinfo->dev);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 485/717 clk: imx: scu: fix memleak on platform_device_add() fails
In reply to Greg Kroah-HartmanFrom: Lin Yujun <[email protected]>
[ Upstream commit 855ae87a2073ebf1b395e020de54fdf9ce7d166f ]
No error handling is performed when platform_device_add() fails. Add error processing before return, and modified the return value.
--- drivers/clk/imx/clk-scu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/clk/imx/clk-scu.c +5 -1
@@ -695,7 +695,11 @@ struct clk_hw *imx_clk_scu_alloc_dev(const char *name,pr_warn ("%s: failed to attached the power domain %d\n" , name, ret); -platform_device_add (pdev); + ret =platform_device_add (pdev); +if (ret) { +platform_device_put (pdev); +return ERR_PTR (ret); + }/* For API backwards compatiblilty, simply return NULL for success */ return NULL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 515/717 cgroup/cpuset: Enable update_tasks_cpumask() on top_cpuset
In reply to Greg Kroah-HartmanFrom: Waiman Long <[email protected]>
[ Upstream commit ec5fbdfb99d18482619ac42605cb80fbb56068ee ]
Previously, update_tasks_cpumask() is not supposed to be called with top cpuset. With cpuset partition that takes CPUs away from the top cpuset, adjusting the cpus_mask of the tasks in the top cpuset is necessary. Percpu kthreads, however, are ignored.
--- kernel/cgroup/cpuset.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
kernel/cgroup/cpuset.c +11 -7
@@ -33,6 +33,7 @@#include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/kmod.h> +#include <linux/kthread.h> #include <linux/list.h> #include <linux/mempolicy.h> #include <linux/mm.h>
@@ -1127,10 +1128,18 @@ static void update_tasks_cpumask(struct cpuset *cs) {struct css_task_iter it;struct task_struct *task; +bool top_cs = cs == &top_cpuset;css_task_iter_start (&cs->css,0 , &it); -while ((task =css_task_iter_next (&it))) +while ((task =css_task_iter_next (&it))) { +/* +* Percpu kthreads in top_cpuset are ignored +*/ +if (top_cs && (task->flags &PF_KTHREAD ) && +kthread_is_per_cpu (task)) +continue ;set_cpus_allowed_ptr (task, cs->effective_cpus); + }css_task_iter_end (&it); }
@@ -2092,12 +2101,7 @@ static int update_prstate(struct cpuset *cs, int new_prs)update_flag (CS_CPU_EXCLUSIVE , cs,0 ); } -/* -* Update cpumask of parent's tasks except when it is the top -* cpuset as some system daemons cannot be mapped to other CPUs. -*/ -if (parent != &top_cpuset) -update_tasks_cpumask (parent); +update_tasks_cpumask (parent);if (parent->child_ecpus_count)update_sibling_cpumasks (parent, cs, &tmpmask);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 349/717 memory: of: Fix refcount leak bug in of_get_ddr_timings()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 05215fb32010d4afb68fbdbb4d237df6e2d4567b ]
We should add the of_node_put() when breaking out of for_each_child_of_node() as it will automatically increase and decrease the refcount.
--- drivers/memory/of_memory.c | 1 + 1 file changed, 1 insertion(+)
drivers/memory/of_memory.c +1 -0
@@ -134,6 +134,7 @@ const struct lpddr2_timings *of_get_ddr_timings(struct device_node *np_ddr,for_each_child_of_node (np_ddr, np_tim) {if (of_device_is_compatible (np_tim, tim_compat)) {if (of_do_get_timings (np_tim, &timings[i])) { +of_node_put (np_tim);devm_kfree (dev, timings); goto default_timings; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 140/717 ring-buffer: Allow splice to read previous partially read pages
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (Google) <[email protected]>
commit fa8f4a89736b654125fb254b0db753ac68a5fced upstream.
If a page is partially read, and then the splice system call is run against the ring buffer, it will always fail to read, no matter how much is in the ring buffer. That's because the code path for a partial read of the page does will fail if the "full" flag is set.
The splice system call wants full pages, so if the read of the ring buffer is not yet full, it should return zero, and the splice will block. But if a previous read was done, where the beginning has been consumed, it should still be given to the splice caller if the rest of the page has been written to.
This caused the splice command to never consume data in this scenario, and let the ring buffer just fill up and lose events.
--- kernel/trace/ring_buffer.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
kernel/trace/ring_buffer.c +9 -1
@@ -5616,7 +5616,15 @@ int ring_buffer_read_page(struct trace_bunsigned int pos =0 ;unsigned int size; -if (full) +/* +* If a full page is expected, this can still be returned +* if there's been a previous partial read and the +* rest of the page can be read and the commit page is off +* the reader page. +*/ +if (full && + (!read || (len < (commit - read)) || + cpu_buffer->reader_page == cpu_buffer->commit_page)) goto out_unlock;if (len > (commit - read))
Greg Kroah-Hartman
maintainerPATCH 510/717 crypto: ccp - Fail the PSP initialization when writing psp data file failed
In reply to Greg Kroah-HartmanFrom: Jacky Li <[email protected]>
[ Upstream commit efb4b01c1c993d245e6608076684ff2162cf9dc6 ]
Currently the OS continues the PSP initialization when there is a write failure to the init_ex_file. Therefore, the userspace would be told that SEV is properly INIT'd even though the psp data file is not updated. This is problematic because later when asked for the SEV data, the OS won't be able to provide it.
--- drivers/crypto/ccp/sev-dev.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/crypto/ccp/sev-dev.c +15 -11
@@ -231,7 +231,7 @@ static int sev_read_init_ex_file(void)return 0 ; } -static void sev_write_init_ex_file (void ) +static int sev_write_init_ex_file (void ) {struct sev_device *sev = psp_master->sev_data;struct file *fp;
@@ -241,14 +241,16 @@ static void sev_write_init_ex_file(void)lockdep_assert_held (&sev_cmd_mutex);if (!sev_init_ex_buffer) -return ; +return 0 ; fp =open_file_as_root (init_ex_path,O_CREAT |O_WRONLY ,0600 );if (IS_ERR (fp)) { +int ret =PTR_ERR (fp); +dev_err (sev->dev, -"SEV: could not open file for write, error %ld\n" , -PTR_ERR (fp)); -return ; +"SEV: could not open file for write, error %d\n" , + ret); +return ret; } nwrite =kernel_write (fp, sev_init_ex_buffer,NV_LENGTH , &offset);
@@ -259,18 +261,20 @@ static void sev_write_init_ex_file(void)dev_err (sev->dev,"SEV: failed to write %u bytes to non volatile memory area, ret %ld\n" ,NV_LENGTH , nwrite); -return ; +return -EIO ; }dev_dbg (sev->dev,"SEV: write successful to NV file\n" ); + +return 0 ; } -static void sev_write_init_ex_file_if_required (int cmd_id) +static int sev_write_init_ex_file_if_required (int cmd_id) {lockdep_assert_held (&sev_cmd_mutex);if (!sev_init_ex_buffer) -return ; +return 0 ;/* * Only a few platform commands modify the SPI/NV area, but none of the
@@ -285,10 +289,10 @@ static void sev_write_init_ex_file_if_required(int cmd_id)case SEV_CMD_PEK_GEN :break ;default : -return ; +return 0 ; } -sev_write_init_ex_file (); +return sev_write_init_ex_file (); }static int __sev_do_cmd_locked (int cmd,void *data,int *psp_ret)
@@ -361,7 +365,7 @@ static int __sev_do_cmd_locked(int cmd, void *data, int *psp_ret) cmd, reg & PSP_CMDRESP_ERR_MASK); ret = -EIO ; }else { -sev_write_init_ex_file_if_required (cmd); + ret =sev_write_init_ex_file_if_required (cmd); } print_hex_dump_debug("(out): ", DUMP_PREFIX_OFFSET, 16, 2, data,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 384/717 clk: qoriq: Hold reference returned by of_get_parent()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit a8ea4273bc26256ce3cce83164f0f51c5bf6e127 ]
In legacy_init_clockgen(), we need to hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance.
Beside, in create_sysclk(), we need to call of_node_put() on 'sysclk' also for refcount balance.
--- drivers/clk/clk-qoriq.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/clk/clk-qoriq.c +8 -2
@@ -1063,8 +1063,13 @@ static void __init _clockgen_init(struct device_node *np, bool legacy);*/ static void __init legacy_init_clockgen (struct device_node *np) { -if (!clockgen.node) -_clockgen_init (of_get_parent (np), true); +if (!clockgen.node) { +struct device_node *parent_np; + + parent_np =of_get_parent (np); +_clockgen_init (parent_np, true); +of_node_put (parent_np); + } }/* Legacy node */
@@ -1159,6 +1164,7 @@ static struct clk * __init create_sysclk(const char *name) sysclk =of_get_child_by_name (clockgen.node,"sysclk" );if (sysclk) { clk =sysclk_from_fixed (sysclk, name); +of_node_put (sysclk);if (!IS_ERR (clk))return clk; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 508/717 crypto: hisilicon/zip - fix mismatch in get/set sgl_sge_nr
In reply to Greg Kroah-HartmanFrom: Ye Weihua <[email protected]>
[ Upstream commit d74f9340097a881869c4c22ca376654cc2516ecc ]
KASAN reported this Bug:
[17619.659757] BUG: KASAN: global-out-of-bounds in param_get_int+0x34/0x60 [17619.673193] Read of size 4 at addr fffff01332d7ed00 by task read_all/1507958 ... [17619.698934] The buggy address belongs to the variable: [17619.708371] sgl_sge_nr+0x0/0xffffffffffffa300 [hisi_zip]
There is a mismatch in hisi_zip when get/set the variable sgl_sge_nr. The type of sgl_sge_nr is u16, and get/set sgl_sge_nr by param_get/set_int.
Replacing param_get/set_int to param_get/set_ushort can fix this bug.
--- drivers/crypto/hisilicon/zip/zip_crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/hisilicon/zip/zip_crypto.c +2 -2
@@ -122,12 +122,12 @@ static int sgl_sge_nr_set(const char *val, const struct kernel_param *kp)if (ret || n ==0 || n >HISI_ACC_SGL_SGE_NR_MAX )return -EINVAL ; -return param_set_int (val, kp); +return param_set_ushort (val, kp); }static const struct kernel_param_ops sgl_sge_nr_ops = { .set = sgl_sge_nr_set, - .get = param_get_int, + .get = param_get_ushort, };static u16 sgl_sge_nr =HZIP_SGL_SGE_NR ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 491/717 mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg
In reply to Greg Kroah-HartmanFrom: Jack Wang <[email protected]>
[ Upstream commit 6b207ce8a96a71e966831e3a13c38143ba9a73c1 ]
dma_map_sg return 0 on error, fix the error check, and return -EIO to caller.
--- drivers/mailbox/bcm-flexrm-mailbox.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mailbox/bcm-flexrm-mailbox.c +4 -4
@@ -632,15 +632,15 @@ static int flexrm_spu_dma_map(struct device *dev, struct brcm_message *msg) rc =dma_map_sg (dev, msg->spu.src,sg_nents (msg->spu.src),DMA_TO_DEVICE ); -if (rc <0 ) -return rc; +if (!rc) +return -EIO ; rc =dma_map_sg (dev, msg->spu.dst,sg_nents (msg->spu.dst),DMA_FROM_DEVICE ); -if (rc <0 ) { +if (!rc) {dma_unmap_sg (dev, msg->spu.src,sg_nents (msg->spu.src),DMA_TO_DEVICE ); -return rc; +return -EIO ; }return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 501/717 powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 58ec7f06b74e0d6e76c4110afce367c8b5f0837d ]
Big-endian GENERIC_CPU supports 970, but builds with -mcpu=power5. POWER5 is ISA v2.02 whereas 970 is v2.01 plus Altivec. 2.02 added the popcntb instruction which a compiler might use.
Use -mcpu=power4.
--- arch/powerpc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/Makefile +1 -1
@@ -152,7 +152,7 @@ CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8 CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power9,-mtune=power8) else CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5)) -CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mcpu=power5,-mcpu=power4) +CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power4 endif else ifdef CONFIG_PPC_BOOK3E_64 CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 488/717 clk: ast2600: BCLK comes from EPLL
In reply to Greg Kroah-HartmanFrom: Joel Stanley <[email protected]>
[ Upstream commit b8c1dc9c00b252b3be853720a71b05ed451ddd9f ]
This correction was made in the u-boot SDK recently. There are no in-tree users of this clock so the impact is minimal.
--- drivers/clk/clk-ast2600.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-ast2600.c +1 -1
@@ -622,7 +622,7 @@ static int aspeed_g6_clk_probe(struct platform_device *pdev)regmap_write (map,0x308 ,0x12000 );/* 3x3 = 9 */ /* P-Bus (BCLK) clock divider */ - hw =clk_hw_register_divider_table (dev,"bclk" ,"hpll" ,0 , + hw =clk_hw_register_divider_table (dev,"bclk" ,"epll" ,0 , scu_g6_base +ASPEED_G6_CLK_SELECTION1 ,20 ,3 ,0 , ast2600_div_table, &aspeed_g6_clk_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 516/717 iommu/omap: Fix buffer overflow in debugfs
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 184233a5202786b20220acd2d04ddf909ef18f29 ]
There are two issues here:
1) The "len" variable needs to be checked before the very first write. Otherwise if omap2_iommu_dump_ctx() with "bytes" less than 32 it is a buffer overflow.
2) The snprintf() function returns the number of bytes that *would* have been copied if there were enough space. But we want to know the number of bytes which were *actually* copied so use scnprintf() instead.
--- drivers/iommu/omap-iommu-debug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iommu/omap-iommu-debug.c +3 -3
@@ -32,12 +32,12 @@ static inline bool is_omap_iommu_detached(struct omap_iommu *obj)ssize_t bytes; \const char *str ="%20s: %08x\n" ; \const int maxcol =32 ; \ - bytes =snprintf (p, maxcol, str,__stringify (name), \ +if (len < maxcol) \ + goto out; \ + bytes =scnprintf (p, maxcol, str,__stringify (name), \ iommu_read_reg(obj, MMU_##name)); \ p += bytes; \ len -= bytes; \ -if (len < maxcol) \ - goto out; \ }while (0 ) static ssize_t
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 137/717 livepatch: fix race between fork and KLP transition
In reply to Greg Kroah-HartmanFrom: Rik van Riel <[email protected]>
commit 747f7a2901174c9afa805dddfb7b24db6f65e985 upstream.
The KLP transition code depends on the TIF_PATCH_PENDING and the task->patch_state to stay in sync. On a normal (forward) transition, TIF_PATCH_PENDING will be set on every task in the system, while on a reverse transition (after a failed forward one) first TIF_PATCH_PENDING will be cleared from every task, followed by it being set on tasks that need to be transitioned back to the original code.
However, the fork code copies over the TIF_PATCH_PENDING flag from the parent to the child early on, in dup_task_struct and setup_thread_stack. Much later, klp_copy_process will set child->patch_state to match that of the parent.
However, the parent's patch_state may have been changed by KLP loading or unloading since it was initially copied over into the child.
This results in the KLP code occasionally hitting this warning in klp_complete_transition:
for_each_process_thread(g, task) {
WARN_ON_ONCE(test_tsk_thread_flag(task, TIF_PATCH_PENDING));
task->patch_state = KLP_UNDEFINED;
}Set, or clear, the TIF_PATCH_PENDING flag in the child task depending on whether or not it is needed at the time klp_copy_process is called, at a point in copy_process where the tasklist_lock is held exclusively, preventing races with the KLP code.
The KLP code does have a few places where the state is changed without the tasklist_lock held, but those should not cause problems because klp_update_patch_state(current) cannot be called while the current task is in the middle of fork, klp_check_and_switch_task() which is called under the pi_lock, which prevents rescheduling, and manipulation of the patch state of idle tasks, which do not fork.
This should prevent this warning from triggering again in the future, and close the race for both normal and reverse transitions.
--- kernel/livepatch/transition.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
kernel/livepatch/transition.c +16 -2
@@ -610,9 +610,23 @@ void klp_reverse_transition(void)/* Called from copy_process() during fork */ void klp_copy_process (struct task_struct *child) { - child->patch_state = current->patch_state; -/* TIF_PATCH_PENDING gets copied in setup_thread_stack() */ +/* +* The parent process may have gone through a KLP transition since +* the thread flag was copied in setup_thread_stack earlier. Bring +* the task flag up to date with the parent here. +* +* The operation is serialized against all klp_*_transition() +* operations by the tasklist_lock. The only exception is +* klp_update_patch_state(current), but we cannot race with +* that because we are current. +*/ +if (test_tsk_thread_flag (current,TIF_PATCH_PENDING )) +set_tsk_thread_flag (child,TIF_PATCH_PENDING ); +else +clear_tsk_thread_flag (child,TIF_PATCH_PENDING ); + + child->patch_state = current->patch_state; }/*
Greg Kroah-Hartman
maintainerPATCH 511/717 cgroup: Honor callers cgroup NS when resolving path
In reply to Greg Kroah-HartmanFrom: Michal Koutný <[email protected]>
[ Upstream commit 74e4b956eb1cac0e4c10c240339b1bbfbc9a4c48 ]
cgroup_get_from_path() is not widely used function. Its callers presume the path is resolved under cgroup namespace. (There is one caller currently and resolving in init NS won't make harm (netfilter). However, future users may be subject to different effects when resolving globally.)
Since, there's currently no use for the global resolution, modify the existing function to take cgroup NS into account.
--- kernel/cgroup/cgroup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
kernel/cgroup/cgroup.c +5 -1
@@ -6615,8 +6615,12 @@ struct cgroup *cgroup_get_from_path(const char *path) {struct kernfs_node *kn;struct cgroup *cgrp =ERR_PTR (-ENOENT ); +struct cgroup *root_cgrp; - kn =kernfs_walk_and_get (cgrp_dfl_root.cgrp.kn, path); +spin_lock_irq (&css_set_lock); + root_cgrp =current_cgns_cgroup_from_root (&cgrp_dfl_root); + kn =kernfs_walk_and_get (root_cgrp->kn, path); +spin_unlock_irq (&css_set_lock);if (!kn) goto out;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 509/717 hwrng: arm-smccc-trng - fix NO_ENTROPY handling
In reply to Greg Kroah-HartmanFrom: James Cowgill <[email protected]>
[ Upstream commit 042b4b169c6fb9d4df268d66282d7302dd73d37b ]
The SMCCC_RET_TRNG_NO_ENTROPY switch arm is never used because the NO_ENTROPY return value is negative and negative values are handled above the switch by immediately returning.
Fix by handling errors using a default arm in the switch.
--- drivers/char/hw_random/arm_smccc_trng.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/hw_random/arm_smccc_trng.c +2 -2
@@ -71,8 +71,6 @@ static int smccc_trng_read(struct hwrng *rng, void *data, size_t max, bool wait) MAX_BITS_PER_CALL);arm_smccc_1_1_invoke (ARM_SMCCC_TRNG_RND , bits, &res); -if ((int )res.a0 <0 ) -return (int )res.a0;switch ((int )res.a0) {case SMCCC_RET_SUCCESS :
@@ -88,6 +86,8 @@ static int smccc_trng_read(struct hwrng *rng, void *data, size_t max, bool wait)return copied;cond_resched ();break ; +default : +return -EIO ; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 497/717 powerpc/powernv: add missing of_node_put() in opal_export_attrs()
In reply to Greg Kroah-HartmanFrom: Zheng Yongjun <[email protected]>
[ Upstream commit 71a92e99c47900cc164620948b3863382cec4f1a ]
After using 'np' returned by of_find_node_by_path(), of_node_put() need be called to decrease the refcount.
--- arch/powerpc/platforms/powernv/opal.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/powernv/opal.c +1 -0
@@ -892,6 +892,7 @@ static void opal_export_attrs(void) kobj =kobject_create_and_add ("exports" , opal_kobj);if (!kobj) {pr_warn ("kobject_create_and_add() of exports failed\n" ); +of_node_put (np);return ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 532/717 crypto: cavium - prevent integer overflow loading firmware
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 2526d6bf27d15054bb0778b2f7bc6625fd934905 ]
The "code_length" value comes from the firmware file. If your firmware is untrusted realistically there is probably very little you can do to protect yourself. Still we try to limit the damage as much as possible. Also Smatch marks any data read from the filesystem as untrusted and prints warnings if it not capped correctly.
The "ntohl(ucode->code_length) * 2" multiplication can have an integer overflow.
--- drivers/crypto/cavium/cpt/cptpf_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/crypto/cavium/cpt/cptpf_main.c +4 -2
@@ -253,6 +253,7 @@ static int cpt_ucode_load_fw(struct cpt_device *cpt, const u8 *fw, bool is_ae)const struct firmware *fw_entry;struct device *dev = &cpt->pdev->dev;struct ucode_header *ucode; +unsigned int code_length;struct microcode *mcode;int j, ret =0 ;
@@ -263,11 +264,12 @@ static int cpt_ucode_load_fw(struct cpt_device *cpt, const u8 *fw, bool is_ae) ucode = (struct ucode_header *)fw_entry->data; mcode = &cpt->mcode[cpt->next_mc_idx];memcpy (mcode->version, (u8 *)fw_entry->data,CPT_UCODE_VERSION_SZ ); - mcode->code_size =ntohl (ucode->code_length) *2 ; -if (!mcode->code_size) { + code_length =ntohl (ucode->code_length); +if (code_length ==0 || code_length >=INT_MAX /2 ) { ret = -EINVAL ; goto fw_release; } + mcode->code_size = code_length *2 ; mcode->is_ae = is_ae; mcode->core_mask =0ULL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 512/717 hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear()
In reply to Greg Kroah-HartmanFrom: Kshitiz Varshney <[email protected]>
[ Upstream commit 10a2199caf437e893d9027d97700b3c6010048b7 ]
Issue:
While servicing interrupt, if the IRQ happens to be because of a SEED_DONE due to a previous boot stage, you end up completing the completion prematurely, hence causing kernel to crash while booting.
Fix:
Moving IRQ handler registering after imx_rngc_irq_mask_clear()
--- drivers/char/hw_random/imx-rngc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/char/hw_random/imx-rngc.c +7 -7
@@ -270,13 +270,6 @@ static int imx_rngc_probe(struct platfor goto err; } - ret =devm_request_irq (&pdev->dev, - irq, imx_rngc_irq,0 , pdev->name, (void *)rngc); -if (ret) { -dev_err (rngc->dev,"Can't get interrupt working.\n" ); - goto err; - } -init_completion (&rngc->rng_op_done); rngc->rng.name = pdev->name;
@@ -290,6 +283,13 @@ static int imx_rngc_probe(struct platforimx_rngc_irq_mask_clear (rngc); + ret =devm_request_irq (&pdev->dev, + irq, imx_rngc_irq,0 , pdev->name, (void *)rngc); +if (ret) { +dev_err (rngc->dev,"Can't get interrupt working.\n" ); +return ret; + } +if (self_test) { ret =imx_rngc_self_test (rngc);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 534/717 thermal/drivers/qcom/tsens-v0_1: Fix MSM8939 fourth sensor hw_id
In reply to Greg Kroah-HartmanFrom: Vincent Knecht <[email protected]>
[ Upstream commit b0c883e900702f408d62cf92b0ef01303ed69be9 ]
Reading temperature from this sensor fails with 'Invalid argument'.
Looking at old vendor dts [1], its hw_id should be 3 instead of 4. Change this hw_id accordingly.
--- drivers/thermal/qcom/tsens-v0_1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/qcom/tsens-v0_1.c +1 -1
@@ -604,7 +604,7 @@ static const struct tsens_ops ops_8939 = {struct tsens_plat_data data_8939 = { .num_sensors =10 , .ops = &ops_8939, - .hw_ids = (unsigned int []){0 ,1 ,2 ,4 ,5 ,6 ,7 ,8 ,9 ,10 }, + .hw_ids = (unsigned int []){0 ,1 ,2 ,3 ,5 ,6 ,7 ,8 ,9 ,10 }, .feat = &tsens_v0_1_feat, .fields = tsens_v0_1_regfields,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 145/717 tracing: Disable interrupt or preemption before acquiring arch_spinlock_t
In reply to Greg Kroah-HartmanFrom: Waiman Long <[email protected]>
commit c0a581d7126c0bbc96163276f585fd7b4e4d8d0e upstream.
It was found that some tracing functions in kernel/trace/trace.c acquire an arch_spinlock_t with preemption and irqs enabled. An example is the tracing_saved_cmdlines_size_read() function which intermittently causes a "BUG: using smp_processor_id() in preemptible" warning when the LTP read_all_proc test is run.
That can be problematic in case preemption happens after acquiring the lock. Add the necessary preemption or interrupt disabling code in the appropriate places before acquiring an arch_spinlock_t.
The convention here is to disable preemption for trace_cmdline_lock and interupt for max_lock.
--- kernel/trace/trace.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
kernel/trace/trace.c +23 -0
@@ -1193,12 +1193,14 @@ void *tracing_cond_snapshot_data(struct {void *cond_data =NULL ; +local_irq_disable ();arch_spin_lock (&tr->max_lock);if (tr->cond_snapshot) cond_data = tr->cond_snapshot->cond_data;arch_spin_unlock (&tr->max_lock); +local_irq_enable ();return cond_data; }
@@ -1334,9 +1336,11 @@ int tracing_snapshot_cond_enable(struct goto fail_unlock; } +local_irq_disable ();arch_spin_lock (&tr->max_lock); tr->cond_snapshot = cond_snapshot;arch_spin_unlock (&tr->max_lock); +local_irq_enable ();mutex_unlock (&trace_types_lock);
@@ -1363,6 +1367,7 @@ int tracing_snapshot_cond_disable(struct {int ret =0 ; +local_irq_disable ();arch_spin_lock (&tr->max_lock);if (!tr->cond_snapshot)
@@ -1373,6 +1378,7 @@ int tracing_snapshot_cond_disable(struct }arch_spin_unlock (&tr->max_lock); +local_irq_enable ();return ret; }
@@ -2200,6 +2206,11 @@ static size_t tgid_map_max;#define SAVED_CMDLINES_DEFAULT 128#define NO_CMDLINE_MAP UINT_MAX +/* +* Preemption must be disabled before acquiring trace_cmdline_lock. +* The various trace_arrays' max_lock must be acquired in a context +* where interrupt is disabled. +*/ static arch_spinlock_t trace_cmdline_lock = __ARCH_SPIN_LOCK_UNLOCKED;struct saved_cmdlines_buffer {unsigned map_pid_to_cmdline[PID_MAX_DEFAULT +1 ];
@@ -2412,7 +2423,11 @@ static int trace_save_cmdline(struct tas* the lock, but we also don't want to spin * nor do we want to disable interrupts, * so if we miss here, then better luck next time. +* +* This is called within the scheduler and wake up, so interrupts +* had better been disabled and run queue lock been held. */ +lockdep_assert_preemption_disabled ();if (!arch_spin_trylock (&trace_cmdline_lock))return 0 ;
@@ -5890,9 +5905,11 @@ tracing_saved_cmdlines_size_read(structchar buf[64 ];int r; +preempt_disable ();arch_spin_lock (&trace_cmdline_lock); r =scnprintf (buf,sizeof (buf),"%u\n" , savedcmd->cmdline_num);arch_spin_unlock (&trace_cmdline_lock); +preempt_enable ();return simple_read_from_buffer (ubuf, cnt, ppos, buf, r); }
@@ -5917,10 +5934,12 @@ static int tracing_resize_saved_cmdlinesreturn -ENOMEM ; } +preempt_disable ();arch_spin_lock (&trace_cmdline_lock); savedcmd_temp = savedcmd; savedcmd = s;arch_spin_unlock (&trace_cmdline_lock); +preempt_enable ();free_saved_cmdlines_buffer (savedcmd_temp);return 0 ;
@@ -6373,10 +6392,12 @@ int tracing_set_tracer(struct trace_arra#ifdef CONFIG_TRACER_SNAPSHOT if (t->use_max_tr) { +local_irq_disable ();arch_spin_lock (&tr->max_lock);if (tr->cond_snapshot) ret = -EBUSY ;arch_spin_unlock (&tr->max_lock); +local_irq_enable ();if (ret) goto out; }
@@ -7436,10 +7457,12 @@ tracing_snapshot_write(struct file *filp goto out; } +local_irq_disable ();arch_spin_lock (&tr->max_lock);if (tr->cond_snapshot) ret = -EBUSY ;arch_spin_unlock (&tr->max_lock); +local_irq_enable ();if (ret) goto out;
Greg Kroah-Hartman
maintainerPATCH 514/717 crypto: hisilicon/qm - fix missing put dfx access
In reply to Greg Kroah-HartmanFrom: Weili Qian <[email protected]>
[ Upstream commit 5afc904f443de2afd31c4e0686ba178beede86fe ]
In function qm_cmd_write(), if function returns from branch 'atomic_read(&qm->status.flags) == QM_STOP', the got dfx access is forgotten to put.
--- drivers/crypto/hisilicon/qm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/crypto/hisilicon/qm.c +4 -2
@@ -2229,8 +2229,10 @@ static ssize_t qm_cmd_write(struct file *filp, const char __user *buffer,return ret;/* Judge if the instance is being reset. */ -if (unlikely (atomic_read (&qm->status.flags) ==QM_STOP )) -return 0 ; +if (unlikely (atomic_read (&qm->status.flags) ==QM_STOP )) { + ret =0 ; + goto put_dfx_access; + }if (count >QM_DBG_WRITE_LEN ) { ret = -ENOSPC ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 503/717 powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit e485f6c751e0a969327336c635ca602feea117f0 ]
If a synchronous interrupt (e.g., hash fault) is taken inside an irqs-disabled region which has MSR[EE]=1, then an asynchronous interrupt that is PACA_IRQ_MUST_HARD_MASK (e.g., PMI) is taken inside the synchronous interrupt handler, then the synchronous interrupt will return with MSR[EE]=1 and the asynchronous interrupt fires again.
If the asynchronous interrupt is a PMI and the original context does not have PMIs disabled (only Linux IRQs), the asynchronous interrupt will fire despite having the PMI marked soft pending. This can confuse the perf code and cause warnings.
This patch changes the interrupt return so that irqs-disabled MSR[EE]=1 contexts will be returned to with MSR[EE]=0 if a PACA_IRQ_MUST_HARD_MASK interrupt has become pending in the meantime.
The longer explanation for what happens:
1. local_irq_disable()
2. Hash fault interrupt fires, do_hash_fault handler runs
3. interrupt_enter_prepare() sets IRQS_ALL_DISABLED
4. interrupt_enter_prepare() sets MSR[EE]=1
5. PMU interrupt fires, masked handler runs
6. Masked handler marks PMI pending
7. Masked handler returns with PACA_IRQ_HARD_DIS set, MSR[EE]=0
8. do_hash_fault interrupt return handler runs
9. interrupt_exit_kernel_prepare() clears PACA_IRQ_HARD_DIS
10. interrupt returns with MSR[EE]=1
11. PMU interrupt fires, perf handler runs
--- arch/powerpc/kernel/interrupt.c | 10 --------- arch/powerpc/kernel/interrupt_64.S | 34 +++++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 13 deletions(-)
arch/powerpc/kernel/interrupt.c +0 -10
@@ -592,16 +592,6 @@ notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs)if (unlikely (stack_store))__hard_EE_RI_disable (); -/* -* Returning to a kernel context with local irqs disabled. -* Here, if EE was enabled in the interrupted context, enable -* it on return as well. A problem exists here where a soft -* masked interrupt may have cleared MSR[EE] and set HARD_DIS -* here, and it will still exist on return to the caller. This -* will be resolved by the masked interrupt firing again. -*/ -if (regs->msr &MSR_EE ) - local_paca->irq_happened &= ~PACA_IRQ_HARD_DIS ;#endif /* CONFIG_PPC64 */ }
arch/powerpc/kernel/interrupt_64.S +31 -3
@@ -559,15 +559,43 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\srr\()_kernel) ld r11,SOFTE(r1) cmpwi r11,IRQS_ENABLED stb r11,PACAIRQSOFTMASK(r13) - bne 1f + beq .Linterrupt_return_\srr\()_soft_enabled + + /* + * Returning to soft-disabled context. + * Check if a MUST_HARD_MASK interrupt has become pending, in which + * case we need to disable MSR[EE] in the return context. + */ + ld r12,_MSR(r1) + andi. r10,r12,MSR_EE + beq .Lfast_kernel_interrupt_return_\srr\() // EE already disabled + lbz r11,PACAIRQHAPPENED(r13) + andi. r10,r11,PACA_IRQ_MUST_HARD_MASK + beq 1f // No HARD_MASK pending + + /* Must clear MSR_EE from _MSR */ +#ifdef CONFIG_PPC_BOOK3S + li r10,0 + /* Clear valid before changing _MSR */ + .ifc \srr,srr + stb r10,PACASRR_VALID(r13) + .else + stb r10,PACAHSRR_VALID(r13) + .endif +#endif + xori r12,r12,MSR_EE + std r12,_MSR(r1) + b .Lfast_kernel_interrupt_return_\srr\() + +.Linterrupt_return_\srr\()_soft_enabled: #ifdef CONFIG_PPC_BOOK3S lbz r11,PACAIRQHAPPENED(r13) andi. r11,r11,(~PACA_IRQ_HARD_DIS)@l bne- interrupt_return_\srr\()_kernel_restart #endif - li r11,0 - stb r11,PACAIRQHAPPENED(r13) # clear out possible HARD_DIS 1: + li r11,0 + stb r11,PACAIRQHAPPENED(r13) // clear the possible HARD_DIS .Lfast_kernel_interrupt_return_\srr\(): cmpdi cr1,r3,0
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 492/717 ipc: mqueue: fix possible memory leak in init_mqueue_fs()
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
[ Upstream commit c579d60f0d0cd87552f64fdebe68b5d941d20309 ]
commit db7cfc380900 ("ipc: Free mq_sysctls if ipc namespace creation failed")
Here's a similar memory leak to the one fixed by the patch above. retire_mq_sysctls need to be called when init_mqueue_fs fails after setup_mq_sysctls.
--- ipc/mqueue.c | 1 + 1 file changed, 1 insertion(+)
ipc/mqueue.c +1 -0
@@ -1746,6 +1746,7 @@ static int __init init_mqueue_fs(void)unregister_filesystem (&mqueue_fs_type); out_sysctl:kmem_cache_destroy (mqueue_inode_cachep); +retire_mq_sysctls (&init_ipc_ns);return error; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 518/717 crypto: ccp - Release dma channels before dmaengine unrgister
In reply to Greg Kroah-HartmanFrom: Koba Ko <[email protected]>
[ Upstream commit 68dbe80f5b510c66c800b9e8055235c5b07e37d1 ]
A warning is shown during shutdown,
__dma_async_device_channel_unregister called while 2 clients hold a reference
WARNING: CPU: 15 PID: 1 at drivers/dma/dmaengine.c:1110 __dma_async_device_channel_unregister+0xb7/0xc0
Call dma_release_channel for occupied channles before dma_async_device_unregister.
--- drivers/crypto/ccp/ccp-dmaengine.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/crypto/ccp/ccp-dmaengine.c +5 -1
@@ -641,6 +641,10 @@ static void ccp_dma_release(struct ccp_device *ccp)for (i =0 ; i < ccp->cmd_q_count; i++) { chan = ccp->ccp_dma_chan + i; dma_chan = &chan->dma_chan; + +if (dma_chan->client_count) +dma_release_channel (dma_chan); +tasklet_kill (&chan->cleanup_tasklet);list_del_rcu (&dma_chan->device_node); }
@@ -766,8 +770,8 @@ void ccp_dmaengine_unregister(struct ccp_device *ccp)if (!dmaengine)return ; -dma_async_device_unregister (dma_dev);ccp_dma_release (ccp); +dma_async_device_unregister (dma_dev);kmem_cache_destroy (ccp->dma_desc_cache);kmem_cache_destroy (ccp->dma_cmd_cache);
Signature · 1 line
2.35.1