diff options
Diffstat (limited to 'drivers/char')
| -rw-r--r-- | drivers/char/random.c | 19 | ||||
| -rw-r--r-- | drivers/char/tty_io.c | 21 | ||||
| -rw-r--r-- | drivers/char/tty_ioctl.c | 6 | ||||
| -rw-r--r-- | drivers/char/xilinx_hwicap/buffer_icap.h | 1 | ||||
| -rw-r--r-- | drivers/char/xilinx_hwicap/fifo_icap.h | 1 | ||||
| -rw-r--r-- | drivers/char/xilinx_hwicap/xilinx_hwicap.h | 1 |
6 files changed, 30 insertions, 19 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..e4dce8709541 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
| @@ -695,13 +695,23 @@ struct tty_driver *tty_find_polling_driver(char *name, int *line) | |||
| 695 | { | 695 | { |
| 696 | struct tty_driver *p, *res = NULL; | 696 | struct tty_driver *p, *res = NULL; |
| 697 | int tty_line = 0; | 697 | int tty_line = 0; |
| 698 | int len; | ||
| 698 | char *str; | 699 | char *str; |
| 699 | 700 | ||
| 701 | for (str = name; *str; str++) | ||
| 702 | if ((*str >= '0' && *str <= '9') || *str == ',') | ||
| 703 | break; | ||
| 704 | if (!*str) | ||
| 705 | return NULL; | ||
| 706 | |||
| 707 | len = str - name; | ||
| 708 | tty_line = simple_strtoul(str, &str, 10); | ||
| 709 | |||
| 700 | mutex_lock(&tty_mutex); | 710 | mutex_lock(&tty_mutex); |
| 701 | /* Search through the tty devices to look for a match */ | 711 | /* Search through the tty devices to look for a match */ |
| 702 | list_for_each_entry(p, &tty_drivers, tty_drivers) { | 712 | list_for_each_entry(p, &tty_drivers, tty_drivers) { |
| 703 | str = name + strlen(p->name); | 713 | if (strncmp(name, p->name, len) != 0) |
| 704 | tty_line = simple_strtoul(str, &str, 10); | 714 | continue; |
| 705 | if (*str == ',') | 715 | if (*str == ',') |
| 706 | str++; | 716 | str++; |
| 707 | if (*str == '\0') | 717 | if (*str == '\0') |
| @@ -2498,7 +2508,7 @@ static int tiocgwinsz(struct tty_struct *tty, struct winsize __user *arg) | |||
| 2498 | /** | 2508 | /** |
| 2499 | * tty_do_resize - resize event | 2509 | * tty_do_resize - resize event |
| 2500 | * @tty: tty being resized | 2510 | * @tty: tty being resized |
| 2501 | * @real_tty: real tty (if using a pty/tty pair) | 2511 | * @real_tty: real tty (not the same as tty if using a pty/tty pair) |
| 2502 | * @rows: rows (character) | 2512 | * @rows: rows (character) |
| 2503 | * @cols: cols (character) | 2513 | * @cols: cols (character) |
| 2504 | * | 2514 | * |
| @@ -2512,7 +2522,8 @@ int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty, | |||
| 2512 | struct pid *pgrp, *rpgrp; | 2522 | struct pid *pgrp, *rpgrp; |
| 2513 | unsigned long flags; | 2523 | unsigned long flags; |
| 2514 | 2524 | ||
| 2515 | mutex_lock(&tty->termios_mutex); | 2525 | /* For a PTY we need to lock the tty side */ |
| 2526 | mutex_lock(&real_tty->termios_mutex); | ||
| 2516 | if (!memcmp(ws, &tty->winsize, sizeof(*ws))) | 2527 | if (!memcmp(ws, &tty->winsize, sizeof(*ws))) |
| 2517 | goto done; | 2528 | goto done; |
| 2518 | /* Get the PID values and reference them so we can | 2529 | /* Get the PID values and reference them so we can |
| @@ -2533,7 +2544,7 @@ int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty, | |||
| 2533 | tty->winsize = *ws; | 2544 | tty->winsize = *ws; |
| 2534 | real_tty->winsize = *ws; | 2545 | real_tty->winsize = *ws; |
| 2535 | done: | 2546 | done: |
| 2536 | mutex_unlock(&tty->termios_mutex); | 2547 | mutex_unlock(&real_tty->termios_mutex); |
| 2537 | return 0; | 2548 | return 0; |
| 2538 | } | 2549 | } |
| 2539 | 2550 | ||
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 | } |
diff --git a/drivers/char/xilinx_hwicap/buffer_icap.h b/drivers/char/xilinx_hwicap/buffer_icap.h index c5b1840906b2..8b0252bf06e2 100644 --- a/drivers/char/xilinx_hwicap/buffer_icap.h +++ b/drivers/char/xilinx_hwicap/buffer_icap.h | |||
| @@ -38,7 +38,6 @@ | |||
| 38 | 38 | ||
| 39 | #include <linux/types.h> | 39 | #include <linux/types.h> |
| 40 | #include <linux/cdev.h> | 40 | #include <linux/cdev.h> |
| 41 | #include <linux/version.h> | ||
| 42 | #include <linux/platform_device.h> | 41 | #include <linux/platform_device.h> |
| 43 | 42 | ||
| 44 | #include <asm/io.h> | 43 | #include <asm/io.h> |
diff --git a/drivers/char/xilinx_hwicap/fifo_icap.h b/drivers/char/xilinx_hwicap/fifo_icap.h index ffabd3ba2bd8..62bda453c90b 100644 --- a/drivers/char/xilinx_hwicap/fifo_icap.h +++ b/drivers/char/xilinx_hwicap/fifo_icap.h | |||
| @@ -38,7 +38,6 @@ | |||
| 38 | 38 | ||
| 39 | #include <linux/types.h> | 39 | #include <linux/types.h> |
| 40 | #include <linux/cdev.h> | 40 | #include <linux/cdev.h> |
| 41 | #include <linux/version.h> | ||
| 42 | #include <linux/platform_device.h> | 41 | #include <linux/platform_device.h> |
| 43 | 42 | ||
| 44 | #include <asm/io.h> | 43 | #include <asm/io.h> |
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.h b/drivers/char/xilinx_hwicap/xilinx_hwicap.h index 1f9c8b082dbe..24d0d9b938fb 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.h +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.h | |||
| @@ -38,7 +38,6 @@ | |||
| 38 | 38 | ||
| 39 | #include <linux/types.h> | 39 | #include <linux/types.h> |
| 40 | #include <linux/cdev.h> | 40 | #include <linux/cdev.h> |
| 41 | #include <linux/version.h> | ||
| 42 | #include <linux/platform_device.h> | 41 | #include <linux/platform_device.h> |
| 43 | 42 | ||
| 44 | #include <asm/io.h> | 43 | #include <asm/io.h> |
