Skip to content

Commit 5885615

Browse files
Dan Carpentertiwai
authored andcommitted
ALSA: emux: stop if copy_from_user() fails
If we can't fill the "patch" struct because "count" is too small (it can be as low as 4 bytes) or because copy_from_user() failed, then just return instead of using unintialized data. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 03a1f48 commit 5885615

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎sound/synth/emux/emux_oss.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ snd_emux_load_patch_seq_oss(struct snd_seq_oss_arg *arg, int format,
225225
else if (format == SNDRV_OSS_SOUNDFONT_PATCH) {
226226
struct soundfont_patch_info patch;
227227
if (count < (int)sizeof(patch))
228-
rc = -EINVAL;
228+
return -EINVAL;
229229
if (copy_from_user(&patch, buf, sizeof(patch)))
230-
rc = -EFAULT;
230+
return -EFAULT;
231231
if (patch.type >= SNDRV_SFNT_LOAD_INFO &&
232232
patch.type <= SNDRV_SFNT_PROBE_DATA)
233233
rc = snd_soundfont_load(emu->sflist, buf, count, SF_CLIENT_NO(p->chset.port));

0 commit comments

Comments
 (0)