diff options
author | Geoffrey D. Bennett <g@b4.vu> | 2023-12-24 20:25:10 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2023-12-29 15:41:22 +0100 |
commit | 43222a612374facb3408300ea1a789cc1b33fb9b (patch) | |
tree | 5d7591e26ffa8e96a46cb3f387ec50cb4ea90eb2 /sound/usb/mixer_scarlett2.c | |
parent | ALSA: scarlett2: Remove scarlett2_config_sets array (diff) | |
download | linux-43222a612374facb3408300ea1a789cc1b33fb9b.tar.xz linux-43222a612374facb3408300ea1a789cc1b33fb9b.zip |
ALSA: scarlett2: Add check for config_item presence
Update scarlett2_usb_get_config() and scarlett2_usb_set_config() to
make sure that the config_item_num is valid for the device.
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/b0572b23291ffd1b208f21d298adaf4d9f1fe4bc.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/mixer_scarlett2.c')
-rw-r--r-- | sound/usb/mixer_scarlett2.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sound/usb/mixer_scarlett2.c b/sound/usb/mixer_scarlett2.c index 74bcecbd6923..ad92c3d1f8f5 100644 --- a/sound/usb/mixer_scarlett2.c +++ b/sound/usb/mixer_scarlett2.c @@ -1528,6 +1528,12 @@ static int scarlett2_usb_get_config( u8 *buf_8; u8 value; + /* Check that the configuration item is present in the + * configuration set used by this device + */ + if (!config_item->offset) + return -EFAULT; + /* For byte-sized parameters, retrieve directly into buf */ if (config_item->size >= 8) { size = config_item->size / 8 * count; @@ -1594,6 +1600,12 @@ static int scarlett2_usb_set_config( int offset, size; int err; + /* Check that the configuration item is present in the + * configuration set used by this device + */ + if (!config_item->offset) + return -EFAULT; + /* Cancel any pending NVRAM save */ cancel_delayed_work_sync(&private->work); |