Re: [PATCH v4] uart: fix race between uart_put_char() and uart_shutdown()

2018-07-13 Thread Tycho Andersen
On Fri, Jul 13, 2018 at 11:28:28AM +0200, Greg Kroah-Hartman wrote: > On Thu, Jul 12, 2018 at 12:30:01PM -0600, Tycho Andersen wrote: > > On Thu, Jul 12, 2018 at 08:25:45PM +0200, Greg Kroah-Hartman wrote: > > > On Thu, Jul 12, 2018 at 12:18:46PM -0600, Tycho Andersen wrote: > > > > On Thu, Jul 12,

Re: [PATCH v4] uart: fix race between uart_put_char() and uart_shutdown()

2018-07-13 Thread Greg Kroah-Hartman
On Thu, Jul 12, 2018 at 12:30:01PM -0600, Tycho Andersen wrote: > On Thu, Jul 12, 2018 at 08:25:45PM +0200, Greg Kroah-Hartman wrote: > > On Thu, Jul 12, 2018 at 12:18:46PM -0600, Tycho Andersen wrote: > > > On Thu, Jul 12, 2018 at 05:40:15PM +0200, Greg Kroah-Hartman wrote: > > > > On Thu, Jul 12,

Re: [PATCH v4] uart: fix race between uart_put_char() and uart_shutdown()

2018-07-12 Thread Tycho Andersen
On Thu, Jul 12, 2018 at 08:25:45PM +0200, Greg Kroah-Hartman wrote: > On Thu, Jul 12, 2018 at 12:18:46PM -0600, Tycho Andersen wrote: > > On Thu, Jul 12, 2018 at 05:40:15PM +0200, Greg Kroah-Hartman wrote: > > > On Thu, Jul 12, 2018 at 09:08:22AM -0600, Tycho Andersen wrote: > > > > On Thu, Jul 12,

Re: [PATCH v4] uart: fix race between uart_put_char() and uart_shutdown()

2018-07-12 Thread Greg Kroah-Hartman
On Thu, Jul 12, 2018 at 12:18:46PM -0600, Tycho Andersen wrote: > On Thu, Jul 12, 2018 at 05:40:15PM +0200, Greg Kroah-Hartman wrote: > > On Thu, Jul 12, 2018 at 09:08:22AM -0600, Tycho Andersen wrote: > > > On Thu, Jul 12, 2018 at 05:04:38PM +0200, Greg Kroah-Hartman wrote: > > > > On Wed, Jul 11,

Re: [PATCH v4] uart: fix race between uart_put_char() and uart_shutdown()

2018-07-12 Thread Tycho Andersen
On Thu, Jul 12, 2018 at 05:40:15PM +0200, Greg Kroah-Hartman wrote: > On Thu, Jul 12, 2018 at 09:08:22AM -0600, Tycho Andersen wrote: > > On Thu, Jul 12, 2018 at 05:04:38PM +0200, Greg Kroah-Hartman wrote: > > > On Wed, Jul 11, 2018 at 10:07:44AM -0600, Tycho Andersen wrote: > > > > + if (upo

Re: [PATCH v4] uart: fix race between uart_put_char() and uart_shutdown()

2018-07-12 Thread Greg Kroah-Hartman
On Thu, Jul 12, 2018 at 09:08:22AM -0600, Tycho Andersen wrote: > On Thu, Jul 12, 2018 at 05:04:38PM +0200, Greg Kroah-Hartman wrote: > > On Wed, Jul 11, 2018 at 10:07:44AM -0600, Tycho Andersen wrote: > > > + if (uport) > > > + spin_lock_irqsave(&uport->lock, flags); > > > > That's the sa

Re: [PATCH v4] uart: fix race between uart_put_char() and uart_shutdown()

2018-07-12 Thread Tycho Andersen
On Thu, Jul 12, 2018 at 05:04:38PM +0200, Greg Kroah-Hartman wrote: > On Wed, Jul 11, 2018 at 10:07:44AM -0600, Tycho Andersen wrote: > > + if (uport) > > + spin_lock_irqsave(&uport->lock, flags); > > That's the same thing as just calling uart_port_lock(), why aren't you > doing that?

Re: [PATCH v4] uart: fix race between uart_put_char() and uart_shutdown()

2018-07-12 Thread Greg Kroah-Hartman
On Wed, Jul 11, 2018 at 02:00:56PM -0600, Tycho Andersen wrote: > On Wed, Jul 11, 2018 at 02:49:08PM -0500, Serge E. Hallyn wrote: > > Quoting Tycho Andersen (ty...@tycho.ws): > > > We have reports of the following crash: > > > > > > PID: 7 TASK: 88085c6d61c0 CPU: 1 COMMAND: "kworker/u25:0

Re: [PATCH v4] uart: fix race between uart_put_char() and uart_shutdown()

2018-07-12 Thread Greg Kroah-Hartman
On Wed, Jul 11, 2018 at 10:07:44AM -0600, Tycho Andersen wrote: > + if (uport) > + spin_lock_irqsave(&uport->lock, flags); That's the same thing as just calling uart_port_lock(), why aren't you doing that? thanks, greg k-h

Re: [PATCH v4] uart: fix race between uart_put_char() and uart_shutdown()

2018-07-12 Thread Tycho Andersen
Hi Andy, On Thu, Jul 12, 2018 at 12:03:08PM +0300, Andy Shevchenko wrote: > On Wed, Jul 11, 2018 at 7:07 PM, Tycho Andersen wrote: > > > Anyway, since the lock is not acquired, if uart_shutdown() is called, the > > last chunk of that function may release state->xmit.buf before its assigned > > t

Re: [PATCH v4] uart: fix race between uart_put_char() and uart_shutdown()

2018-07-12 Thread Andy Shevchenko
On Wed, Jul 11, 2018 at 7:07 PM, Tycho Andersen wrote: > Anyway, since the lock is not acquired, if uart_shutdown() is called, the > last chunk of that function may release state->xmit.buf before its assigned > to null, and cause the race above. > > To fix it, let's lock uport->lock when allocati

Re: [PATCH v4] uart: fix race between uart_put_char() and uart_shutdown()

2018-07-11 Thread Tycho Andersen
On Wed, Jul 11, 2018 at 02:49:08PM -0500, Serge E. Hallyn wrote: > Quoting Tycho Andersen (ty...@tycho.ws): > > We have reports of the following crash: > > > > PID: 7 TASK: 88085c6d61c0 CPU: 1 COMMAND: "kworker/u25:0" > > #0 [88085c6db710] machine_kexec at 81046239 > >

Re: [PATCH v4] uart: fix race between uart_put_char() and uart_shutdown()

2018-07-11 Thread Serge E. Hallyn
Quoting Tycho Andersen (ty...@tycho.ws): > We have reports of the following crash: > > PID: 7 TASK: 88085c6d61c0 CPU: 1 COMMAND: "kworker/u25:0" > #0 [88085c6db710] machine_kexec at 81046239 > #1 [88085c6db760] crash_kexec at 810fc248 > #2 [88085c6db

Re: [PATCH v4] uart: fix race between uart_put_char() and uart_shutdown()

2018-07-11 Thread Serge E. Hallyn
Quoting Tycho Andersen (ty...@tycho.ws): > We have reports of the following crash: > > PID: 7 TASK: 88085c6d61c0 CPU: 1 COMMAND: "kworker/u25:0" > #0 [88085c6db710] machine_kexec at 81046239 > #1 [88085c6db760] crash_kexec at 810fc248 > #2 [88085c6db

[PATCH v4] uart: fix race between uart_put_char() and uart_shutdown()

2018-07-11 Thread Tycho Andersen
We have reports of the following crash: PID: 7 TASK: 88085c6d61c0 CPU: 1 COMMAND: "kworker/u25:0" #0 [88085c6db710] machine_kexec at 81046239 #1 [88085c6db760] crash_kexec at 810fc248 #2 [88085c6db830] oops_end at 81008ae7 #3 [88085c6