IO and WQE buffers are allocated once per HW and can be reused later. If
WQE buffers allocation fails then the whole allocation is marked as failed
but already created IO array internal objects are not freed. hw->io is
freed but not nullified in that specific case - it may become a problem
later as efct_hw_setup_io() is supposed to be reusable for the same HW.
While at it, use kcalloc instead of kmalloc_array/memset-zero combination
and get rid of some needless NULL assignments: nullifying hw->io[i]
elements just before freeing hw->io is not really useful.
Found by Linux Verification Center (linuxtesting.org).
Fixes: 4df84e846624 ("scsi: elx: efct: Driver initialization routines")
Cc: stable(a)vger.kernel.org
Signed-off-by: Fedor Pchelkin <pchelkin(a)ispras.ru>
---
drivers/scsi/elx/efct/efct_hw.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/scsi/elx/efct/efct_hw.c b/drivers/scsi/elx/efct/efct_hw.c
index 5a5525054d71..e5486e6949f9 100644
--- a/drivers/scsi/elx/efct/efct_hw.c
+++ b/drivers/scsi/elx/efct/efct_hw.c
@@ -487,12 +487,10 @@ efct_hw_setup_io(struct efct_hw *hw)
struct efct *efct = hw->os;
if (!hw->io) {
- hw->io = kmalloc_array(hw->config.n_io, sizeof(io), GFP_KERNEL);
+ hw->io = kcalloc(hw->config.n_io, sizeof(io), GFP_KERNEL);
if (!hw->io)
return -ENOMEM;
- memset(hw->io, 0, hw->config.n_io * sizeof(io));
-
for (i = 0; i < hw->config.n_io; i++) {
hw->io[i] = kzalloc(sizeof(*io), GFP_KERNEL);
if (!hw->io[i])
@@ -502,10 +500,8 @@ efct_hw_setup_io(struct efct_hw *hw)
/* Create WQE buffs for IO */
hw->wqe_buffs = kzalloc((hw->config.n_io * hw->sli.wqe_size),
GFP_KERNEL);
- if (!hw->wqe_buffs) {
- kfree(hw->io);
- return -ENOMEM;
- }
+ if (!hw->wqe_buffs)
+ goto error;
} else {
/* re-use existing IOs, including SGLs */
@@ -586,10 +582,8 @@ efct_hw_setup_io(struct efct_hw *hw)
return 0;
error:
- for (i = 0; i < hw->config.n_io && hw->io[i]; i++) {
+ for (i = 0; i < hw->config.n_io && hw->io[i]; i++)
kfree(hw->io[i]);
- hw->io[i] = NULL;
- }
kfree(hw->io);
hw->io = NULL;
--
2.39.2
The driver uses regmap APIs so it should make sure they are available.
Fixes: c75f4bf6800b ("power: supply: Introduce MM8013 fuel gauge driver")
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Thomas Weißschuh <linux(a)weissschuh.net>
---
drivers/power/supply/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig
index f21cb05815ec..3e31375491d5 100644
--- a/drivers/power/supply/Kconfig
+++ b/drivers/power/supply/Kconfig
@@ -978,6 +978,7 @@ config CHARGER_QCOM_SMB2
config FUEL_GAUGE_MM8013
tristate "Mitsumi MM8013 fuel gauge driver"
depends on I2C
+ select REGMAP_I2C
help
Say Y here to enable the Mitsumi MM8013 fuel gauge driver.
It enables the monitoring of many battery parameters, including
---
base-commit: 54be6c6c5ae8e0d93a6c4641cb7528eb0b6ba478
change-id: 20240204-mm8013-regmap-d8d18ada07c2
Best regards,
--
Thomas Weißschuh <linux(a)weissschuh.net>
Hi,
please consider applying the following patch to v5.15.y to fix
a build error seen with various test builds (m68k:allmodconfig,
powerpc:allmodconfig, powerpc:ppc32_allmodconfig, and
xtensa:allmodconfig).
b4909252da9b ("drivers: lkdtm: fix clang -Wformat warning")
Thanks,
Guenter
Correction: The subject line in my previous message erroneously stated
"5.10.y" in patch 2/3 and 3/3, instead of the correct "5.15.y." Sending
again after correction.
Here are the three backported patches aimed at addressing a potential
crash and an actual crash.
Patch 1 Fix potential OOB access in receive_encrypted_standard() if
server returned a large shdr->NextCommand in cifs.
Patch 2 fix validate offsets and lengths before dereferencing create
contexts in smb2_parse_contexts().
Patch 3 fix issue in patch 2.
The original patches were authored by Paulo Alcantara <pc(a)manguebit.com>.
Original Patches:
1. eec04ea11969 ("smb: client: fix OOB in receive_encrypted_standard()")
2. af1689a9b770 ("smb: client: fix potential OOBs in smb2_parse_contexts()")
3. 76025cc2285d ("smb: client: fix parsing of SMB3.1.1 POSIX create context")
Please review and consider applying these patches.
https://lore.kernel.org/all/2023121834-semisoft-snarl-49ad@gregkh/
fs/cifs/smb2ops.c | 4 +++-
fs/cifs/smb2pdu.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------
fs/cifs/smb2proto.h | 12 +++++++-----
3 files changed, 66 insertions(+), 43 deletions(-)
This reverts commit 1e35f074399dece73d5df11847d4a0d7a6f49434.
Given that ERROR_RECOVERY calls into PORT_RESET for Hi-Zing
the CC pins, setting CC pins to default state during PORT_RESET
breaks error recovery.
4.5.2.2.2.1 ErrorRecovery State Requirements
The port shall not drive VBUS or VCONN, and shall present a
high-impedance to ground (above zOPEN) on its CC1 and CC2 pins.
Hi-Zing the CC pins is the inteded behavior for PORT_RESET.
CC pins are set to default state after tErrorRecovery in
PORT_RESET_WAIT_OFF.
4.5.2.2.2.2 Exiting From ErrorRecovery State
A Sink shall transition to Unattached.SNK after tErrorRecovery.
A Source shall transition to Unattached.SRC after tErrorRecovery.
Cc: stable(a)vger.kernel.org
Cc: Frank Wang <frank.wang(a)rock-chips.com>
Fixes: 1e35f074399d ("usb: typec: tcpm: fix cc role at port reset")
Signed-off-by: Badhri Jagan Sridharan <badhri(a)google.com>
---
drivers/usb/typec/tcpm/tcpm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 5945e3a2b0f7..9d410718eaf4 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -4876,8 +4876,7 @@ static void run_state_machine(struct tcpm_port *port)
break;
case PORT_RESET:
tcpm_reset_port(port);
- tcpm_set_cc(port, tcpm_default_state(port) == SNK_UNATTACHED ?
- TYPEC_CC_RD : tcpm_rp_cc(port));
+ tcpm_set_cc(port, TYPEC_CC_OPEN);
tcpm_set_state(port, PORT_RESET_WAIT_OFF,
PD_T_ERROR_RECOVERY);
break;
base-commit: 933bb7b878ddd0f8c094db45551a7daddf806e00
--
2.43.0.429.g432eaa2c6b-goog
I'm relatively new here, first time reporting a regression, so apologies in
advance if I'm doing something wrong.
I'm using Arch Linux (linux-mainline kernel) on my chromebook Acer Spin 713-2W
(Voxel), and after upgrading linux-mainline from 6.7-rc4 to 6.7-rc5 the audio
setup isn't working anymore. Firstly I suspected its some changes in the sof-
firmware, yet got no luck in upgrading sof-firmware (2023.09.2 -> 2023.12).
On certain chromebooks, audio setup needs custom ALSA ucm confs [1], but after
contacting the chromebook-linux-audio developer [2], I think it's not a conf
problem, but rather a kernel regression.
After hours of bisecting, the first bad commit 31ed8da (ASoC: SOF: sof-audio:
Modify logic for enabling/disabling topology cores) ensures the regression.
demsg log pasted below:
// before 31ed8da, working
[ 61.572587] sof-audio-pci-intel-tgl 0000:00:1f.3: ipc tx error for
0x60010000 (msg/reply size: 108/20): -22
[ 61.572593] sof-audio-pci-intel-tgl 0000:00:1f.3: HW params ipc failed for
stream 1
[ 61.572594] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at
snd_soc_pcm_component_hw_params on 0000:00:1f.3: -22
[ 61.573247] sof-audio-pci-intel-tgl 0000:00:1f.3: ipc tx error for
0x60010000 (msg/reply size: 108/20): -22
[ 61.573250] sof-audio-pci-intel-tgl 0000:00:1f.3: HW params ipc failed for
stream 1
[ 61.573251] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at
snd_soc_pcm_component_hw_params on 0000:00:1f.3: -22
[ 61.573888] sof-audio-pci-intel-tgl 0000:00:1f.3: ipc tx error for
0x60010000 (msg/reply size: 108/20): -22
[ 61.573892] sof-audio-pci-intel-tgl 0000:00:1f.3: HW params ipc failed for
stream 1
[ 61.573893] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at
snd_soc_pcm_component_hw_params on 0000:00:1f.3: -22
[ 61.574570] sof-audio-pci-intel-tgl 0000:00:1f.3: ipc tx error for
0x60010000 (msg/reply size: 108/20): -22
[ 61.574572] sof-audio-pci-intel-tgl 0000:00:1f.3: HW params ipc failed for
stream 1
[ 61.574573] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at
snd_soc_pcm_component_hw_params on 0000:00:1f.3: -22
// after 31ed8da, broken
[ 48.930740] sof-audio-pci-intel-tgl 0000:00:1f.3: ipc tx error for
0x30020000 (msg/reply size: 12/0): -13
[ 48.930762] sof-audio-pci-intel-tgl 0000:00:1f.3: failed to free widget
DMIC0.IN
[ 57.235697] sof-audio-pci-intel-tgl 0000:00:1f.3: ipc tx error for
0x30030000 (msg/reply size: 16/0): -22
[ 57.235701] sof-audio-pci-intel-tgl 0000:00:1f.3: sof_ipc3_route_setup:
route DMIC0.IN -> BUF4.0 failed
[ 57.235703] sof-audio-pci-intel-tgl 0000:00:1f.3:
sof_ipc3_set_up_all_pipelines: route set up failed
[ 57.235704] sof-audio-pci-intel-tgl 0000:00:1f.3: Failed to restore
pipeline after resume -22
[ 57.235706] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at
snd_soc_pcm_component_pm_runtime_get on 0000:00:1f.3: -22
[ 57.235926] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at
snd_soc_pcm_component_pm_runtime_get on 0000:00:1f.3: -22
[ 57.235966] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at
snd_soc_pcm_component_pm_runtime_get on 0000:00:1f.3: -22
[ 57.236006] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at
snd_soc_pcm_component_pm_runtime_get on 0000:00:1f.3: -22
[ 57.236041] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at
snd_soc_pcm_component_pm_runtime_get on 0000:00:1f.3: -22
[ 57.236074] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at
snd_soc_pcm_component_pm_runtime_get on 0000:00:1f.3: -22
[ 57.236107] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at
snd_soc_pcm_component_pm_runtime_get on 0000:00:1f.3: -22
[ 57.236141] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at
snd_soc_pcm_component_pm_runtime_get on 0000:00:1f.3: -22
[ 57.236173] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at
snd_soc_pcm_component_pm_runtime_get on 0000:00:1f.3: -22
[ 57.236205] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at
snd_soc_pcm_component_pm_runtime_get on 0000:00:1f.3: -22
[ 57.236239] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at
snd_soc_pcm_component_pm_runtime_get on 0000:00:1f.3: -22
Steps to reproduce:
- Run chromebook-linux-audio script [2] (this would install custom sof-rt5682
ucm confs [1] into /usr/share/alsa/ucm2/conf.d/sof-rt5682 and write a line
`options snd-intel-dspcfg dsp_driver=3` to /etc/modprobe.d/snd-sof.conf)
- Reboot, gets audio working on kernels before 31ed8da
- Install latest stable kernel (6.7.3), audio broken
- Install latest git kernel (6.8-rc2), audio broken
- Revert 31ed8da, build upon latest linux-git (6.8-rc2), audio working
Apologies for my busyiness that I should have reported it long before the
regression enters stable and lts, but sadly linux-lts (6.6.13) seems to be
affected too [3].
Please let me know if there's any other thing that I can help debugging.
-- Mole Shang
[1]: https://github.com/WeirdTreeThing/chromebook-ucm-conf/tree/main/sof-rt5682
[2]: https://github.com/WeirdTreeThing/chromebook-linux-audio/issues/70
[3]: https://github.com/WeirdTreeThing/chromebook-linux-audio/issues/
70#issuecomment-1911048309
#regzbot introduced: 31ed8da1c8e5e504710bb36863700e3389f8fc81