lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <s5hlir8igp2.wl%tiwai@suse.de>
Date:	Tue, 22 Nov 2011 11:39:53 +0100
From:	Takashi Iwai <tiwai@...e.de>
To:	Wu Fengguang <fengguang.wu@...el.com>
Cc:	"alsa-devel@...a-project.org" <alsa-devel@...a-project.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [alsa-devel] [PATCH] hda - fail ELD reading early

At Tue, 22 Nov 2011 16:46:23 +0800,
Wu Fengguang wrote:
> 
> With the ELD repoll mechanism, we can (and should) fail the ELD reading
> immediately when find something obviously wrong and let the caller retry
> after some delay.
> 
> Signed-off-by: Wu Fengguang <fengguang.wu@...el.com>
> ---
>  sound/pci/hda/hda_eld.c |   28 +++++++++++++++++++---------
>  1 file changed, 19 insertions(+), 9 deletions(-)
> 
> --- linux.orig/sound/pci/hda/hda_eld.c	2011-11-22 16:02:58.000000000 +0800
> +++ linux/sound/pci/hda/hda_eld.c	2011-11-22 16:36:10.000000000 +0800
> @@ -347,18 +347,28 @@ int snd_hdmi_get_eld(struct hdmi_eld *el
>  
>  	for (i = 0; i < size; i++) {
>  		unsigned int val = hdmi_get_eld_data(codec, nid, i);
> +		/*
> +		 * Graphics driver might be writing to ELD buffer right now.
> +		 * Just abort. The caller will repoll after a while.
> +		 */
>  		if (!(val & AC_ELDD_ELD_VALID)) {
> -			if (!i) {
> -				snd_printd(KERN_INFO
> -					   "HDMI: invalid ELD data\n");
> -				ret = -EINVAL;
> -				goto error;
> -			}
>  			snd_printd(KERN_INFO
>  				  "HDMI: invalid ELD data byte %d\n", i);
> -			val = 0;
> -		} else
> -			val &= AC_ELDD_ELD_DATA;
> +			ret = -EINVAL;
> +			goto error;
> +		}
> +		val &= AC_ELDD_ELD_DATA;
> +		/*
> +		 * The first byte cannot be zero. This can happen on some DVI
> +		 * connections. Some Intel chips may also need some 250ms delay
> +		 * to return non-zero ELD data, even when the graphics driver
> +		 * correctly writes ELD content before setting ELD_valid bit.
> +		 */
> +		if (!val && !i) {
> +			snd_printdd(KERN_INFO "HDMI: 0 ELD data\n");
> +			ret = -EINVAL;
> +			goto error;
> +		}

Shouldn't this zero-check be before the valid-bit check?
Otherwise it'll never reach there.


thanks,

Takashi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ