From: Ilya Zykov <ilya@ilyx.ru>
To: Paul Fulghum <paulkf@microgate.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
linux-kernel@vger.kernel.org, Alan Cox <alan@linux.intel.com>,
Ilya Zykov <ilya@ilyx.ru>
Subject: PROBLEM: n_hdlc not atomic use tty->flags.
Date: Mon, 07 Nov 2011 11:32:46 +0400 [thread overview]
Message-ID: <4EB7899E.5090006@ilyx.ru> (raw)
N_HDLC can spoil tty->flags because use not atomic operations on tty->flags.
I use n_hdlc line discipline and it happens.
Signed-off-by: Ilya Zykov <ilya@ilyx.ru>
---
diff -uprN -X ../../dontdiff a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c
--- a/drivers/tty/n_hdlc.c 2011-05-19 08:06:34.000000000 +0400
+++ b/drivers/tty/n_hdlc.c 2011-11-06 16:30:13.000000000 +0400
@@ -417,7 +417,7 @@ static void n_hdlc_send_frames(struct n_
__FILE__,__LINE__,tbuf,tbuf->count);
/* Send the next block of data to device */
- tty->flags |= (1 << TTY_DO_WRITE_WAKEUP);
+ set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
actual = tty->ops->write(tty, tbuf->buf, tbuf->count);
/* rollback was possible and has been done */
@@ -459,7 +459,7 @@ static void n_hdlc_send_frames(struct n_
}
if (!tbuf)
- tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP);
+ clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
/* Clear the re-entry flag */
spin_lock_irqsave(&n_hdlc->tx_buf_list.spinlock, flags);
@@ -491,7 +491,7 @@ static void n_hdlc_tty_wakeup(struct tty
return;
if (tty != n_hdlc->tty) {
- tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP);
+ clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
return;
}
next reply other threads:[~2011-11-07 7:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-07 7:32 Ilya Zykov [this message]
2011-11-07 10:24 ` PROBLEM: n_hdlc not atomic use tty->flags Alan Cox
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=4EB7899E.5090006@ilyx.ru \
--to=ilya@ilyx.ru \
--cc=alan@linux.intel.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=paulkf@microgate.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.