lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231206151046.25773-1-ivan.orlov0322@gmail.com>
Date:   Wed,  6 Dec 2023 15:10:46 +0000
From:   Ivan Orlov <ivan.orlov0322@...il.com>
To:     tiwai@...e.com, perex@...ex.cz
Cc:     Ivan Orlov <ivan.orlov0322@...il.com>, linux-sound@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH v2] ALSA: pcmtest: stop timer in the hw_free callback

Stop timer in the 'hw_free' callback instead of the 'close' callback
since we want the timer to be stopped before the DMA buffer is released.
Otherwise, it could trigger a kernel panic in some circumstances, for
instance when the DMA buffer is already released but the timer callback
is still running.

Signed-off-by: Ivan Orlov <ivan.orlov0322@...il.com>
---
V1 -> V2:
- Remove useless NULLing of v_iter->substream. It will be released in
'close' callback.

 sound/drivers/pcmtest.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sound/drivers/pcmtest.c b/sound/drivers/pcmtest.c
index b59b78a09224..8a78fa56106f 100644
--- a/sound/drivers/pcmtest.c
+++ b/sound/drivers/pcmtest.c
@@ -396,8 +396,6 @@ static int snd_pcmtst_pcm_close(struct snd_pcm_substream *substream)
 {
 	struct pcmtst_buf_iter *v_iter = substream->runtime->private_data;
 
-	timer_shutdown_sync(&v_iter->timer_instance);
-	v_iter->substream = NULL;
 	playback_capture_test = !v_iter->is_buf_corrupted;
 	kfree(v_iter);
 	return 0;
@@ -499,6 +497,10 @@ static int snd_pcmtst_pcm_hw_params(struct snd_pcm_substream *substream,
 
 static int snd_pcmtst_pcm_hw_free(struct snd_pcm_substream *substream)
 {
+	struct pcmtst_buf_iter *v_iter = substream->runtime->private_data;
+
+	timer_shutdown_sync(&v_iter->timer_instance);
+
 	return 0;
 }
 
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ