public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soundwire: fix double free of pointer
@ 2024-02-11 15:09 Daniil Dulov
  2024-02-12 14:49 ` Pierre-Louis Bossart
  0 siblings, 1 reply; 2+ messages in thread
From: Daniil Dulov @ 2024-02-11 15:09 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Daniil Dulov, Bard Liao, Pierre-Louis Bossart, Sanyog Kale,
	alsa-devel, linux-kernel, lvc-project

If sdw_ml_sync_bank_switch() returns error not on the first iteration,
it leads to freeing prevously freed memory. So, set the pointer to NULL
after each successful bank switch.

Signed-off-by: Daniil Dulov <d.dulov@aladdin.ru>
---
 drivers/soundwire/stream.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
index 304ff2ee7d75..d650e6f0f8e7 100644
--- a/drivers/soundwire/stream.c
+++ b/drivers/soundwire/stream.c
@@ -833,6 +833,7 @@ static int do_bank_switch(struct sdw_stream_runtime *stream)
 				"multi link bank switch failed: %d\n", ret);
 			goto error;
 		}
+		bus->defer_msg.msg = NULL;
 
 		if (multi_link)
 			mutex_unlock(&bus->msg_lock);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-12 14:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-11 15:09 [PATCH] soundwire: fix double free of pointer Daniil Dulov
2024-02-12 14:49 ` Pierre-Louis Bossart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox