From: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
To: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
Nicolas Ferre <nicolas.ferre@atmel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.cz>
Subject: Re: [PATCH] tty/serial_core: Introduce lock mechanism for RS485
Date: Mon, 13 Oct 2014 14:52:29 +0100 [thread overview]
Message-ID: <20141013145229.4849f07a@alan.etchedpixels.co.uk> (raw)
In-Reply-To: <1412948280-30993-1-git-send-email-ricardo.ribalda@gmail.com>
> @@ -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
next prev parent reply other threads:[~2014-10-13 13:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-10 13:38 Ricardo Ribalda Delgado
2014-10-12 5:23 ` Nicolas Ferre
2014-10-13 19:03 ` Ricardo Ribalda Delgado
2014-10-13 21:48 ` Nicolas Ferre
2014-10-13 13:52 ` One Thousand Gnomes [this message]
2014-10-13 19:02 ` Ricardo Ribalda Delgado
2014-10-16 9:04 Ricardo Ribalda Delgado
2014-10-16 9:06 ` Ricardo Ribalda Delgado
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141013145229.4849f07a@alan.etchedpixels.co.uk \
--to=gnomes@lxorguk.ukuu.org.uk \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=nicolas.ferre@atmel.com \
--cc=ricardo.ribalda@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome