Re: [PATCH 03/12] serial_core: Handle TIOC[GS]RS485 ioctls.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2014-10-08 at 21:57 +0200, Ricardo Ribalda Delgado wrote:
> The following drivers: 8250_core, atmel_serial, max310x, mcf, omap-serial
> and sci16is7xx implement code to handle RS485 ioctls.

>  
> +static int uart_get_rs485_config(struct uart_port *port,
> +			 struct serial_rs485 __user *rs485)
> +{
> +	if (!port->rs485_config)
> +		return -ENOIOCTLCMD;
> +
> +	if (copy_to_user(rs485, &port->rs485, sizeof(port->rs485)))
> +		return -EFAULT;
> +	return 0;
> +}
> +
> +static int uart_set_rs485_config(struct uart_port *port,
> +			 struct serial_rs485 __user *rs485_user)
> +{
> +	struct serial_rs485 rs485;
> +	int ret;
> +
> +	if (!port->rs485_config)
> +		return -ENOIOCTLCMD;
> +
> +	if (copy_from_user(&rs485, rs485_user, sizeof(rs485_user)))
> +		return -EFAULT;
> +
> +	ret = port->rs485_config(port, &rs485);
> +	if (ret)
> +		return ret;
> +
> +	if (copy_to_user(rs485_user, &port->rs485, sizeof(port->rs485)))
> +		return -EFAULT;
> +
> +	return 0;
> +

What is the locking between setting/getting/driver use of the config ?
This really needs a lock (termios sem I think is perhaps appropriate
given when the values are normally referenced).

Alan


--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux