diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-09-10 08:05:45 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-10 08:05:45 -0400 |
commit | 3ce9bcb583536c45a46c7302747029450e22279c (patch) | |
tree | 7a4167189ffc6dc909151d1a5d040f9f0656a9f4 /drivers/char | |
parent | 26fd10517e810dd59ea050b052de24a75ee6dc07 (diff) | |
parent | f7d0b926ac8c8ec0c7a83ee69409bd2e6bb39f81 (diff) |
Merge branch 'core/xen' into x86/xen
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/random.c | 19 | ||||
-rw-r--r-- | drivers/char/tty_io.c | 7 | ||||
-rw-r--r-- | drivers/char/tty_ioctl.c | 6 |
3 files changed, 18 insertions, 14 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index 1838aa3d24fe..7ce1ac4baa6d 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -407,7 +407,7 @@ struct entropy_store { | |||
407 | /* read-write data: */ | 407 | /* read-write data: */ |
408 | spinlock_t lock; | 408 | spinlock_t lock; |
409 | unsigned add_ptr; | 409 | unsigned add_ptr; |
410 | int entropy_count; | 410 | int entropy_count; /* Must at no time exceed ->POOLBITS! */ |
411 | int input_rotate; | 411 | int input_rotate; |
412 | }; | 412 | }; |
413 | 413 | ||
@@ -520,6 +520,7 @@ static void mix_pool_bytes(struct entropy_store *r, const void *in, int bytes) | |||
520 | static void credit_entropy_bits(struct entropy_store *r, int nbits) | 520 | static void credit_entropy_bits(struct entropy_store *r, int nbits) |
521 | { | 521 | { |
522 | unsigned long flags; | 522 | unsigned long flags; |
523 | int entropy_count; | ||
523 | 524 | ||
524 | if (!nbits) | 525 | if (!nbits) |
525 | return; | 526 | return; |
@@ -527,20 +528,20 @@ static void credit_entropy_bits(struct entropy_store *r, int nbits) | |||
527 | spin_lock_irqsave(&r->lock, flags); | 528 | spin_lock_irqsave(&r->lock, flags); |
528 | 529 | ||
529 | DEBUG_ENT("added %d entropy credits to %s\n", nbits, r->name); | 530 | DEBUG_ENT("added %d entropy credits to %s\n", nbits, r->name); |
530 | r->entropy_count += nbits; | 531 | entropy_count = r->entropy_count; |
531 | if (r->entropy_count < 0) { | 532 | entropy_count += nbits; |
533 | if (entropy_count < 0) { | ||
532 | DEBUG_ENT("negative entropy/overflow\n"); | 534 | DEBUG_ENT("negative entropy/overflow\n"); |
533 | r->entropy_count = 0; | 535 | entropy_count = 0; |
534 | } else if (r->entropy_count > r->poolinfo->POOLBITS) | 536 | } else if (entropy_count > r->poolinfo->POOLBITS) |
535 | r->entropy_count = r->poolinfo->POOLBITS; | 537 | entropy_count = r->poolinfo->POOLBITS; |
538 | r->entropy_count = entropy_count; | ||
536 | 539 | ||
537 | /* should we wake readers? */ | 540 | /* should we wake readers? */ |
538 | if (r == &input_pool && | 541 | if (r == &input_pool && entropy_count >= random_read_wakeup_thresh) { |
539 | r->entropy_count >= random_read_wakeup_thresh) { | ||
540 | wake_up_interruptible(&random_read_wait); | 542 | wake_up_interruptible(&random_read_wait); |
541 | kill_fasync(&fasync, SIGIO, POLL_IN); | 543 | kill_fasync(&fasync, SIGIO, POLL_IN); |
542 | } | 544 | } |
543 | |||
544 | spin_unlock_irqrestore(&r->lock, flags); | 545 | spin_unlock_irqrestore(&r->lock, flags); |
545 | } | 546 | } |
546 | 547 | ||
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index a27160ba21d7..daeb8f766971 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -2498,7 +2498,7 @@ static int tiocgwinsz(struct tty_struct *tty, struct winsize __user *arg) | |||
2498 | /** | 2498 | /** |
2499 | * tty_do_resize - resize event | 2499 | * tty_do_resize - resize event |
2500 | * @tty: tty being resized | 2500 | * @tty: tty being resized |
2501 | * @real_tty: real tty (if using a pty/tty pair) | 2501 | * @real_tty: real tty (not the same as tty if using a pty/tty pair) |
2502 | * @rows: rows (character) | 2502 | * @rows: rows (character) |
2503 | * @cols: cols (character) | 2503 | * @cols: cols (character) |
2504 | * | 2504 | * |
@@ -2512,7 +2512,8 @@ int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty, | |||
2512 | struct pid *pgrp, *rpgrp; | 2512 | struct pid *pgrp, *rpgrp; |
2513 | unsigned long flags; | 2513 | unsigned long flags; |
2514 | 2514 | ||
2515 | mutex_lock(&tty->termios_mutex); | 2515 | /* For a PTY we need to lock the tty side */ |
2516 | mutex_lock(&real_tty->termios_mutex); | ||
2516 | if (!memcmp(ws, &tty->winsize, sizeof(*ws))) | 2517 | if (!memcmp(ws, &tty->winsize, sizeof(*ws))) |
2517 | goto done; | 2518 | goto done; |
2518 | /* Get the PID values and reference them so we can | 2519 | /* Get the PID values and reference them so we can |
@@ -2533,7 +2534,7 @@ int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty, | |||
2533 | tty->winsize = *ws; | 2534 | tty->winsize = *ws; |
2534 | real_tty->winsize = *ws; | 2535 | real_tty->winsize = *ws; |
2535 | done: | 2536 | done: |
2536 | mutex_unlock(&tty->termios_mutex); | 2537 | mutex_unlock(&real_tty->termios_mutex); |
2537 | return 0; | 2538 | return 0; |
2538 | } | 2539 | } |
2539 | 2540 | ||
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index ea9fc5d03b99..bf34e4597421 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
@@ -937,12 +937,14 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file, | |||
937 | return 0; | 937 | return 0; |
938 | #endif | 938 | #endif |
939 | case TIOCGSOFTCAR: | 939 | case TIOCGSOFTCAR: |
940 | return put_user(C_CLOCAL(tty) ? 1 : 0, | 940 | /* FIXME: for correctness we may need to take the termios |
941 | lock here - review */ | ||
942 | return put_user(C_CLOCAL(real_tty) ? 1 : 0, | ||
941 | (int __user *)arg); | 943 | (int __user *)arg); |
942 | case TIOCSSOFTCAR: | 944 | case TIOCSSOFTCAR: |
943 | if (get_user(arg, (unsigned int __user *) arg)) | 945 | if (get_user(arg, (unsigned int __user *) arg)) |
944 | return -EFAULT; | 946 | return -EFAULT; |
945 | return tty_change_softcar(tty, arg); | 947 | return tty_change_softcar(real_tty, arg); |
946 | default: | 948 | default: |
947 | return -ENOIOCTLCMD; | 949 | return -ENOIOCTLCMD; |
948 | } | 950 | } |