From nobody Mon Feb 9 01:22:19 2026 Received: from mail-out.aladdin-rd.ru (mail-out.aladdin-rd.ru [91.199.251.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F10B249E6; Mon, 4 Mar 2024 09:56:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.199.251.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709546175; cv=none; b=EUbjb6sPTUcMcFvdTwH+A5HKBVSajVFxXKmkVkG1Vs5nTPZ/pT62N9IkMbQx0EuGFIKEYicZec+49RAZZxx65IYjZuIwkau1IN/Evm+IzaEEr7aYy5DitjlcFtHOnpeK+X3IQXr0q3sKPLJSmaVvAdLzz+4doiCDyvnfyOA9KHU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709546175; c=relaxed/simple; bh=lPMlhZe6Zu/FURCZR//Lp7oBo0dSFp8zW5k/9lO6GAk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=D0nL3BLixh0opcXjWfE4Ix0HRYC1nBXZopoo4PkV7xGNsCGIosXBOrzNeLfG00I3NZaPQFoCQpqs7xElwMJtYpuWPi3D85JmsxxKq1Hubkhx6rAheMJlGQw6Wikjb7vLeV606/hI/VuAHxYJR6YEo5qyEB9o46gzH3xn1sLyNf4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru; spf=pass smtp.mailfrom=aladdin.ru; arc=none smtp.client-ip=91.199.251.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aladdin.ru From: Daniil Dulov To: Greg Kroah-Hartman , CC: Daniil Dulov , Vinod Koul , Bard Liao , Pierre-Louis Bossart , Sanyog Kale , , , , Ranjani Sridharan Subject: [PATCH 5.10/5.15/6.1 1/1] soundwire: stream: use consistent pattern for freeing buffers Date: Mon, 4 Mar 2024 12:55:42 +0300 Message-ID: <20240304095542.4799-2-d.dulov@aladdin.ru> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240304095542.4799-1-d.dulov@aladdin.ru> References: <20240304095542.4799-1-d.dulov@aladdin.ru> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: EXCH-2016-03.aladdin.ru (192.168.1.103) To EXCH-2016-01.aladdin.ru (192.168.1.101) Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart commit 5ec0c8721c06fc55d8a0bb32c403228358987eb6 upstream The code should free the message buffer used for data, the message structure used for control and assign the latter to NULL. The last part is missing for multi-link cases, and the order is inconsistent for single-link cases. Link: https://github.com/thesofproject/linux/issues/4056 Signed-off-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao Link: https://lore.kernel.org/r/20230119073211.85979-2-yung-chuan.liao@linu= x.intel.com Signed-off-by: Vinod Koul Signed-off-by: Daniil Dulov --- drivers/soundwire/stream.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c index a377c3d02c55..ecde6fcb8be0 100644 --- a/drivers/soundwire/stream.c +++ b/drivers/soundwire/stream.c @@ -703,8 +703,8 @@ static int sdw_bank_switch(struct sdw_bus *bus, int m_r= t_count) } =20 if (!multi_link) { - kfree(wr_msg); kfree(wbuf); + kfree(wr_msg); bus->defer_msg.msg =3D NULL; bus->params.curr_bank =3D !bus->params.curr_bank; bus->params.next_bank =3D !bus->params.next_bank; @@ -750,6 +750,7 @@ static int sdw_ml_sync_bank_switch(struct sdw_bus *bus,= bool multi_link) if (bus->defer_msg.msg) { kfree(bus->defer_msg.msg->buf); kfree(bus->defer_msg.msg); + bus->defer_msg.msg =3D NULL; } =20 return 0; @@ -847,6 +848,7 @@ static int do_bank_switch(struct sdw_stream_runtime *st= ream) if (bus->defer_msg.msg) { kfree(bus->defer_msg.msg->buf); kfree(bus->defer_msg.msg); + bus->defer_msg.msg =3D NULL; } } =20 --=20 2.25.1