mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
ALSA: pcmtest: Reject invalid fill_mode values
The fill_block() function handles only fill_mode 0 (random) and 1
(pattern). With any other value it writes nothing and does not move the
buffer position. A capture stream then gets no data, and a read fails
with -EIO after the timeout. Nothing in the kernel log says why.
Check the value in a set callback, so a bad value is rejected both when
the module is loaded and when the parameter is written.
Fixes: 315a3d57c6 ("ALSA: Implement the new Virtual PCM Test Driver")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
Link: https://patch.msgid.link/20261026031655.2699561-1-sammiee5311@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
6b186281a1
commit
5deb9c57ba
|
|
@ -72,13 +72,32 @@ static u8 playback_capture_test;
|
|||
static u8 ioctl_reset_test;
|
||||
static struct dentry *driver_debug_dir;
|
||||
|
||||
static int fill_mode_set(const char *val, const struct kernel_param *kp)
|
||||
{
|
||||
short mode;
|
||||
int err;
|
||||
|
||||
err = kstrtos16(val, 0, &mode);
|
||||
if (err)
|
||||
return err;
|
||||
if (mode != FILL_MODE_RAND && mode != FILL_MODE_PAT)
|
||||
return -EINVAL;
|
||||
fill_mode = mode;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct kernel_param_ops fill_mode_ops = {
|
||||
.set = fill_mode_set,
|
||||
.get = param_get_short,
|
||||
};
|
||||
|
||||
module_param(index, int, 0444);
|
||||
MODULE_PARM_DESC(index, "Index value for pcmtest soundcard");
|
||||
module_param(id, charp, 0444);
|
||||
MODULE_PARM_DESC(id, "ID string for pcmtest soundcard");
|
||||
module_param(enable, bool, 0444);
|
||||
MODULE_PARM_DESC(enable, "Enable pcmtest soundcard.");
|
||||
module_param(fill_mode, short, 0600);
|
||||
module_param_cb(fill_mode, &fill_mode_ops, &fill_mode, 0600);
|
||||
MODULE_PARM_DESC(fill_mode, "Buffer fill mode: rand(0) or pattern(1)");
|
||||
module_param(inject_delay, int, 0600);
|
||||
MODULE_PARM_DESC(inject_delay, "Inject delays during playback/capture (in jiffies)");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user