[LTP] [PATCH] snd_timer01: Add missing tst_fzsync_start_race_*() calls

Martin Doucha mdoucha@suse.cz
Mon Aug 22 17:47:35 CEST 2022


Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---

The missing start_race() calls made the test essentially useless. Now it
works correctly, tested on SLE-12SP2 GM kernel which was vulnerable.

 testcases/kernel/sound/snd_timer01.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/testcases/kernel/sound/snd_timer01.c b/testcases/kernel/sound/snd_timer01.c
index 3d8e715e3..123d1a2cb 100644
--- a/testcases/kernel/sound/snd_timer01.c
+++ b/testcases/kernel/sound/snd_timer01.c
@@ -50,15 +50,11 @@ static void *ioctl_thread(void *unused)
 	tp.filter = 0xf;
 
 	while (tst_fzsync_run_b(&fzsync_pair)) {
-
+		tst_fzsync_start_race_b(&fzsync_pair);
 		ioctl(snd_fd, SNDRV_TIMER_IOCTL_TREAD, &tread_arg);
-
 		ioctl(snd_fd, SNDRV_TIMER_IOCTL_SELECT, &ts);
-
 		ioctl(snd_fd, SNDRV_TIMER_IOCTL_PARAMS, &tp);
-
 		ioctl(snd_fd, SNDRV_TIMER_IOCTL_START, 0);
-
 		tst_fzsync_end_race_b(&fzsync_pair);
 	}
 	return unused;
@@ -101,8 +97,9 @@ static void run(void)
 	while (tst_fzsync_run_a(&fzsync_pair)) {
 		nz = 0;
 		memset(read_buf, 0, sizeof(read_buf));
-		size = readv(snd_fd, &iov, 1);
 
+		tst_fzsync_start_race_a(&fzsync_pair);
+		size = readv(snd_fd, &iov, 1);
 		tst_fzsync_end_race_a(&fzsync_pair);
 
 		/* check if it could be a valid ioctl result */
-- 
2.37.2



More information about the ltp mailing list