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: <20100408111310.524f7354@lxorguk.ukuu.org.uk>
Date:	Thu, 8 Apr 2010 11:13:10 +0100
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	Claudio Scordino <claudio@...dence.eu.com>
Cc:	Ryan Mallon <ryan@...ewatersys.com>,
	Linux Kernel <linux-kernel@...r.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
	John Nicholls <john@...nlinx.com>, Rick Bronson <rick@....org>,
	Sebastian Heutling <Sebastian.Heutling@...-ing.de>,
	michael trimarchi <michael@...dence.eu.com>,
	rmk@....linux.org.uk, hskinnemoen@...el.com, linux@...im.org.za
Subject: Re: [PATCH] atmel_serial: Atmel RS485 support v2

NAK - assorted problems, notably locking ones caused by the sysfs stuff
which should probably be dropped.

> +#define TIOCSRS485	0x5461

Please provide TIOCGRS485 as well



> +static ssize_t show_rs485(struct device *dev, struct device_attribute *attr,
> +			   char *buf)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +	struct uart_port *port = platform_get_drvdata(pdev);
> +	unsigned int current_mode;
> +
> +	current_mode = UART_GET_MR(port) & ATMEL_US_USMODE;
> +	return snprintf(buf, PAGE_SIZE, "%u\n", current_mode);
> +}

You should have TIOCGRS485 for providing the info back as part of the API

> +
> +static ssize_t set_rs485(struct device *dev, struct device_attribute *attr,
> +			  const char *buf, size_t len)

Expain the locking on this could you - I don't see what protects against
parallel ioctl and sysfs stuff ?

> +static DEVICE_ATTR(rs485, 0644, show_rs485, set_rs485);

Why should this be public read ?

> +	/* Resetting serial mode to RS232 (0x0) */
> +	mode &= ~ATMEL_US_USMODE;
> +
> +	if (atmel_port->rs485.flags & SER_RS485_ENABLED) {
> +		dev_dbg(port->dev, "Setting UART to RS485\n");
> +		UART_PUT_TTGR(port, atmel_port->rs485.delay_rts_before_send);
> +		mode |= ATMEL_US_USMODE_RS485;
> +	} else {
> +		dev_dbg(port->dev, "Setting UART to RS232\n");

Locking versus sysfs ?

> +	UART_PUT_IDR(port, atmel_port->tx_done_mask);
> +
> +	if (atmel_port->rs485.flags & SER_RS485_ENABLED)
> +		atmel_start_rx(port);
>  }

Ditto

> -		UART_PUT_IER(port, ATMEL_US_ENDTX | ATMEL_US_TXBUFE);
> +		if (atmel_port->rs485.flags & SER_RS485_ENABLED)
> +			atmel_stop_rx(port);
> +

Ditto


Given the locking mess you are going to create I would suggest dropping
the sysfs stuff.

Alan
--
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