Re: [PATCH] tty/serial_core: Introduce lock mechanism for RS485

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

 



> @@ -1154,8 +1154,16 @@ static int uart_get_icount(struct tty_struct *tty,
>  static int uart_get_rs485_config(struct uart_port *port,
>  			 struct serial_rs485 __user *rs485)
>  {
> -	if (copy_to_user(rs485, &port->rs485, sizeof(port->rs485)))
> +	unsigned long flags;
> +	int ret;
> +
> +	spin_lock_irqsave(&port->lock, flags);
> +	ret = copy_to_user(rs485, &port->rs485, sizeof(port->rs485));
> +	spin_unlock_irqrestore(&port->lock, flags);

Looks good apart from this bit.. The copy needs to go to a temporary
before the lock is taken otherwise we may sleep on a pagefault with irqs
off

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