* Re: ALSA: hda - hdmi: Do not expose eld data when eld is invalid
@ 2016-02-05 6:05 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2016-02-05 6:05 UTC (permalink / raw)
To: david.henningsson; +Cc: alsa-devel
Hello David Henningsson,
The patch 68e03de98507: "ALSA: hda - hdmi: Do not expose eld data
when eld is invalid" from Feb 19, 2013, leads to the following static
checker warning:
sound/pci/hda/patch_hdmi.c:460 hdmi_eld_ctl_get()
error: __memcpy() 'eld->eld_buffer' too small (256 vs 512)
sound/pci/hda/patch_hdmi.c
437 static int hdmi_eld_ctl_get(struct snd_kcontrol *kcontrol,
438 struct snd_ctl_elem_value *ucontrol)
439 {
440 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
441 struct hdmi_spec *spec = codec->spec;
442 struct hdmi_spec_per_pin *per_pin;
443 struct hdmi_eld *eld;
444 int pin_idx;
445
446 pin_idx = kcontrol->private_value;
447 per_pin = get_pin(spec, pin_idx);
448 eld = &per_pin->sink_eld;
449
450 mutex_lock(&per_pin->lock);
451 if (eld->eld_size > ARRAY_SIZE(ucontrol->value.bytes.data)) {
In the original code we always copied ELD_MAX_SIZE (256) bytes. Now it
looks like we can copy up to 512 bytes which seems like an information
leak. I don't know where eld->eld_size is set so I can't say if this is
a real issue or not. Perhaps it's always a valid value.
452 mutex_unlock(&per_pin->lock);
453 snd_BUG();
454 return -EINVAL;
455 }
456
457 memset(ucontrol->value.bytes.data, 0,
458 ARRAY_SIZE(ucontrol->value.bytes.data));
459 if (eld->eld_valid)
460 memcpy(ucontrol->value.bytes.data, eld->eld_buffer,
461 eld->eld_size);
462 mutex_unlock(&per_pin->lock);
463
464 return 0;
465 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-02-05 6:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-05 6:05 ALSA: hda - hdmi: Do not expose eld data when eld is invalid Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.