mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: snakky.zhang@gmail.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: Is this a bug that n_tty_set_room not serialized? If so please correct it.
Date: Wed, 23 Jan 2013 14:35:41 +0000	[thread overview]
Message-ID: <20130123143541.0abfa379@www.etchedpixels.co.uk> (raw)
In-Reply-To: <50FF69C6.2040705@gmail.com>

On Wed, 23 Jan 2013 12:40:38 +0800
snakky.zhang@gmail.com wrote:

> Hi experts,
> 
> Seems there is an bug related to function n_tty_set_roomin source file
> drivers/tty/n_tty.c. This function is used to set receive_room based on
> the read_cntby both the consumer and the producer of the tty's read buffer.
> 
> But this function is not serialized, so I am afraid there is
> a risk like: The producer make the buffer full and then call this 
> function to

It's not entirely robust - it should be ok for current usage. The proper
fix IMHO is to make the ldisc receive function return the number of bytes
actually consumed. That cures the problem rather than patching around it.

It's an interesting little project for someone, and as I think only n_tty
uses that level of flow control probably not too horrible now.

Alan

  reply	other threads:[~2013-01-23 14:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-23  4:40 snakky.zhang
2013-01-23 14:35 ` Alan Cox [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-01-23  2:46 snakky.zhang

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=20130123143541.0abfa379@www.etchedpixels.co.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=snakky.zhang@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

all inboxes | Powered by JetHome®