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]
Date:	Mon, 23 Sep 2013 14:10:27 -0700
From:	Tim Gardner <tim.gardner@...onical.com>
To:	Rob Herring <robherring2@...il.com>, linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org
CC:	Rob Herring <rob.herring@...xeda.com>,
	Paolo Pisati <paolo.pisati@...onical.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Jiri Slaby <jslaby@...e.cz>
Subject: Re: [PATCH] TTY: hvc_dcc: probe for a JTAG connection before registering

On 09/23/2013 01:30 PM, Rob Herring wrote:
> From: Rob Herring <rob.herring@...xeda.com>
> 
> Enabling the ARM DCC console and using without a JTAG connection will
> simply hang the system. Since distros like to turn on all options, this
> is a reoccurring problem to debug. We can do better by checking if
> anything is attached and handling characters. There is no way to probe
> this, so send a newline and check that it is handled.
> 
> Cc: Paolo Pisati <paolo.pisati@...onical.com>
> Cc: Tim Gardner <tim.gardner@...onical.com>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: Jiri Slaby <jslaby@...e.cz>
> Signed-off-by: Rob Herring <rob.herring@...xeda.com>
> ---
>  drivers/tty/hvc/hvc_dcc.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/tty/hvc/hvc_dcc.c b/drivers/tty/hvc/hvc_dcc.c
> index 44fbeba..44c8aff 100644
> --- a/drivers/tty/hvc/hvc_dcc.c
> +++ b/drivers/tty/hvc/hvc_dcc.c
> @@ -86,6 +86,21 @@ static int hvc_dcc_get_chars(uint32_t vt, char *buf, int count)
>  	return i;
>  }
>  
> +static bool hvc_dcc_check(void)
> +{
> +	unsigned long time = jiffies;
> +
> +	/* Write a test character to check if it is handled */
> +	__dcc_putchar('\n');
> +
> +	while (jiffies < time + (HZ / 10)) {
> +		if (!(__dcc_getstatus() & DCC_STATUS_TX))
> +			return true;
> +	}

I think you should use one of the jiffies time comparison functions, e.g.,

	time = jiffies + (HZ / 10);
	while (time_before(jiffies,time) {
		...
	}

What is the possibility that __dcc_getstatus() will return garbage if no
JTAG is connected ? In that event you're likely to get a false positive
on DCC_STATUS_TX.

rtg


-- 
Tim Gardner tim.gardner@...onical.com
--
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