diff options
Diffstat (limited to 'sound/core/control.c')
| -rw-r--r-- | sound/core/control.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sound/core/control.c b/sound/core/control.c index 494389fb966c..50fa16022f1f 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
| 26 | #include <linux/vmalloc.h> | 26 | #include <linux/vmalloc.h> |
| 27 | #include <linux/time.h> | 27 | #include <linux/time.h> |
| 28 | #include <linux/mm.h> | ||
| 28 | #include <linux/sched/signal.h> | 29 | #include <linux/sched/signal.h> |
| 29 | #include <sound/core.h> | 30 | #include <sound/core.h> |
| 30 | #include <sound/minors.h> | 31 | #include <sound/minors.h> |
| @@ -1129,7 +1130,7 @@ static int replace_user_tlv(struct snd_kcontrol *kctl, unsigned int __user *buf, | |||
| 1129 | if (size > 1024 * 128) /* sane value */ | 1130 | if (size > 1024 * 128) /* sane value */ |
| 1130 | return -EINVAL; | 1131 | return -EINVAL; |
| 1131 | 1132 | ||
| 1132 | container = memdup_user(buf, size); | 1133 | container = vmemdup_user(buf, size); |
| 1133 | if (IS_ERR(container)) | 1134 | if (IS_ERR(container)) |
| 1134 | return PTR_ERR(container); | 1135 | return PTR_ERR(container); |
| 1135 | 1136 | ||
| @@ -1137,7 +1138,7 @@ static int replace_user_tlv(struct snd_kcontrol *kctl, unsigned int __user *buf, | |||
| 1137 | if (!change) | 1138 | if (!change) |
| 1138 | change = memcmp(ue->tlv_data, container, size) != 0; | 1139 | change = memcmp(ue->tlv_data, container, size) != 0; |
| 1139 | if (!change) { | 1140 | if (!change) { |
| 1140 | kfree(container); | 1141 | kvfree(container); |
| 1141 | return 0; | 1142 | return 0; |
| 1142 | } | 1143 | } |
| 1143 | 1144 | ||
| @@ -1148,7 +1149,7 @@ static int replace_user_tlv(struct snd_kcontrol *kctl, unsigned int __user *buf, | |||
| 1148 | mask = SNDRV_CTL_EVENT_MASK_INFO; | 1149 | mask = SNDRV_CTL_EVENT_MASK_INFO; |
| 1149 | } | 1150 | } |
| 1150 | 1151 | ||
| 1151 | kfree(ue->tlv_data); | 1152 | kvfree(ue->tlv_data); |
| 1152 | ue->tlv_data = container; | 1153 | ue->tlv_data = container; |
| 1153 | ue->tlv_data_size = size; | 1154 | ue->tlv_data_size = size; |
| 1154 | 1155 | ||
| @@ -1197,7 +1198,7 @@ static int snd_ctl_elem_init_enum_names(struct user_element *ue) | |||
| 1197 | if (ue->info.value.enumerated.names_length > 64 * 1024) | 1198 | if (ue->info.value.enumerated.names_length > 64 * 1024) |
| 1198 | return -EINVAL; | 1199 | return -EINVAL; |
| 1199 | 1200 | ||
| 1200 | names = memdup_user((const void __user *)user_ptrval, | 1201 | names = vmemdup_user((const void __user *)user_ptrval, |
| 1201 | ue->info.value.enumerated.names_length); | 1202 | ue->info.value.enumerated.names_length); |
| 1202 | if (IS_ERR(names)) | 1203 | if (IS_ERR(names)) |
| 1203 | return PTR_ERR(names); | 1204 | return PTR_ERR(names); |
| @@ -1208,7 +1209,7 @@ static int snd_ctl_elem_init_enum_names(struct user_element *ue) | |||
| 1208 | for (i = 0; i < ue->info.value.enumerated.items; ++i) { | 1209 | for (i = 0; i < ue->info.value.enumerated.items; ++i) { |
| 1209 | name_len = strnlen(p, buf_len); | 1210 | name_len = strnlen(p, buf_len); |
| 1210 | if (name_len == 0 || name_len >= 64 || name_len == buf_len) { | 1211 | if (name_len == 0 || name_len >= 64 || name_len == buf_len) { |
| 1211 | kfree(names); | 1212 | kvfree(names); |
| 1212 | return -EINVAL; | 1213 | return -EINVAL; |
| 1213 | } | 1214 | } |
| 1214 | p += name_len + 1; | 1215 | p += name_len + 1; |
| @@ -1225,8 +1226,8 @@ static void snd_ctl_elem_user_free(struct snd_kcontrol *kcontrol) | |||
| 1225 | { | 1226 | { |
| 1226 | struct user_element *ue = kcontrol->private_data; | 1227 | struct user_element *ue = kcontrol->private_data; |
| 1227 | 1228 | ||
| 1228 | kfree(ue->tlv_data); | 1229 | kvfree(ue->tlv_data); |
| 1229 | kfree(ue->priv_data); | 1230 | kvfree(ue->priv_data); |
| 1230 | kfree(ue); | 1231 | kfree(ue); |
| 1231 | } | 1232 | } |
| 1232 | 1233 | ||
