Commit 18c1c3f6 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] Return error if no user TLV is defined

Retrun error to user TLV_READ ioctl if no TLV is defined.
(Until now, nothing was written and rerunred successfully.)
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent 86148e84
...@@ -951,6 +951,8 @@ static int snd_ctl_elem_user_tlv(struct snd_kcontrol *kcontrol, ...@@ -951,6 +951,8 @@ static int snd_ctl_elem_user_tlv(struct snd_kcontrol *kcontrol,
ue->tlv_data = new_data; ue->tlv_data = new_data;
ue->tlv_data_size = size; ue->tlv_data_size = size;
} else { } else {
if (! ue->tlv_data_size || ! ue->tlv_data)
return -ENXIO;
if (size < ue->tlv_data_size) if (size < ue->tlv_data_size)
return -ENOSPC; return -ENOSPC;
if (copy_to_user(tlv, ue->tlv_data, ue->tlv_data_size)) if (copy_to_user(tlv, ue->tlv_data, ue->tlv_data_size))
......
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