Re: [PATCH] tty: fix data race in n_tty_receive_buf_common

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

 



On Fri, 5 Jan 2018 13:15:45 +0530
"Kohli, Gaurav" <gkohli@xxxxxxxxxxxxxx> wrote:

> Hi Alan,
> >>>
> >>> Can you make that code available otherwise it's impossible to see 
> >>> what the problem might be.  
> >
> >  
>   https://source.codeaurora.org/quic/la/kernel/msm-4.9/tree/drivers/tty/serial?h=msm-4.9
>   As discussed , there not seems a problem as we are getting print 
> request even when port seems to closed.
> 
> 
> tty_ldisc_lock(tty, 5 * HZ);
>   tty_ldisc_setup(tty);
>   tty_ldisc_unlock(tty)
> 
> But in above lock,  there is a chance when flush_to_ldisc will occur 
> first and acquired a lock in
> tty_ldisc_ref itself.

Which is fine.

If the flush_to_ldisc gets there first then it will find there is a NULL
ldisc and do nothing. When it finishes the tty_init_dev will run and will
be protected from a further re-entry.

If the init_dev gets there first it will complete the init before the
flush_to_ldisc is permitted to proceed.

In other words we restore the intended invariant that ldisc's do not get
entered while their setup routine is running.

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



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux