Commit 43222a61 authored by Geoffrey D. Bennett's avatar Geoffrey D. Bennett Committed by Takashi Iwai

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: default avatarGeoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/b0572b23291ffd1b208f21d298adaf4d9f1fe4bc.1703444932.git.g@b4.vuSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent cbd6f148
...@@ -1528,6 +1528,12 @@ static int scarlett2_usb_get_config( ...@@ -1528,6 +1528,12 @@ static int scarlett2_usb_get_config(
u8 *buf_8; u8 *buf_8;
u8 value; 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 */ /* For byte-sized parameters, retrieve directly into buf */
if (config_item->size >= 8) { if (config_item->size >= 8) {
size = config_item->size / 8 * count; size = config_item->size / 8 * count;
...@@ -1594,6 +1600,12 @@ static int scarlett2_usb_set_config( ...@@ -1594,6 +1600,12 @@ static int scarlett2_usb_set_config(
int offset, size; int offset, size;
int err; 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 any pending NVRAM save */
cancel_delayed_work_sync(&private->work); cancel_delayed_work_sync(&private->work);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment