[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180105141504.0e399394@alans-desktop>
Date: Fri, 5 Jan 2018 14:15:04 +0000
From: Alan Cox <gnomes@...rguk.ukuu.org.uk>
To: "Kohli, Gaurav" <gkohli@...eaurora.org>
Cc: jslaby@...e.com, gregkh@...uxfoundation.org, mikey@...ling.org,
linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH] tty: fix data race in n_tty_receive_buf_common
> But in above case , there we can hit another race, if we have a sequence
> like this
> tty_init_dev->alloc_tty_struct -> tty_ldisc_init -> this will initialize
> ldisc ,
> but at this moment disc_data is still NULL
>
> And if flush_to_ldisc comes in between, it will take ldisc reference and
> proceeds receive buffer.
So you need to move the lock up one line to protect the assignment to
tty->port->itty. We can do that.
At that point your flush_to_ldisc should see either port->itty = NULL or a
valid initialized ldisc.
Alan
Powered by blists - more mailing lists