Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'tty-6.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty / serial driver fixes from Greg KH:
"Here are some small tty and serial driver fixes for reported problems
for 6.11-rc3. Included in here are:

- sc16is7xx serial driver fixes

- uartclk bugfix for a divide by zero issue

- conmakehash userspace build issue fix

All of these have been in linux-next for a while with no reported
issues"

* tag 'tty-6.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
tty: vt: conmakehash: cope with abs_srctree no longer in env
serial: sc16is7xx: fix invalid FIFO access with special register set
serial: sc16is7xx: fix TX fifo corruption
serial: core: check uartclk for zero to avoid divide by zero

+30 -23
+15 -10
drivers/tty/serial/sc16is7xx.c
··· 327 327 struct kthread_work reg_work; 328 328 struct kthread_delayed_work ms_work; 329 329 struct sc16is7xx_one_config config; 330 + unsigned char buf[SC16IS7XX_FIFO_SIZE]; /* Rx buffer. */ 330 331 unsigned int old_mctrl; 331 332 u8 old_lcr; /* Value before EFR access. */ 332 333 bool irda_mode; ··· 341 340 unsigned long gpio_valid_mask; 342 341 #endif 343 342 u8 mctrl_mask; 344 - unsigned char buf[SC16IS7XX_FIFO_SIZE]; 345 343 struct kthread_worker kworker; 346 344 struct task_struct *kworker_task; 347 345 struct sc16is7xx_one p[]; ··· 592 592 SC16IS7XX_MCR_CLKSEL_BIT, 593 593 prescaler == 1 ? 0 : SC16IS7XX_MCR_CLKSEL_BIT); 594 594 595 + mutex_lock(&one->efr_lock); 596 + 595 597 /* Backup LCR and access special register set (DLL/DLH) */ 596 598 lcr = sc16is7xx_port_read(port, SC16IS7XX_LCR_REG); 597 599 sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, ··· 608 606 /* Restore LCR and access to general register set */ 609 607 sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, lcr); 610 608 609 + mutex_unlock(&one->efr_lock); 610 + 611 611 return DIV_ROUND_CLOSEST((clk / prescaler) / 16, div); 612 612 } 613 613 614 614 static void sc16is7xx_handle_rx(struct uart_port *port, unsigned int rxlen, 615 615 unsigned int iir) 616 616 { 617 - struct sc16is7xx_port *s = dev_get_drvdata(port->dev); 617 + struct sc16is7xx_one *one = to_sc16is7xx_one(port, port); 618 618 unsigned int lsr = 0, bytes_read, i; 619 619 bool read_lsr = (iir == SC16IS7XX_IIR_RLSE_SRC) ? true : false; 620 620 u8 ch, flag; 621 621 622 - if (unlikely(rxlen >= sizeof(s->buf))) { 622 + if (unlikely(rxlen >= sizeof(one->buf))) { 623 623 dev_warn_ratelimited(port->dev, 624 624 "ttySC%i: Possible RX FIFO overrun: %d\n", 625 625 port->line, rxlen); 626 626 port->icount.buf_overrun++; 627 627 /* Ensure sanity of RX level */ 628 - rxlen = sizeof(s->buf); 628 + rxlen = sizeof(one->buf); 629 629 } 630 630 631 631 while (rxlen) { ··· 640 636 lsr = 0; 641 637 642 638 if (read_lsr) { 643 - s->buf[0] = sc16is7xx_port_read(port, SC16IS7XX_RHR_REG); 639 + one->buf[0] = sc16is7xx_port_read(port, SC16IS7XX_RHR_REG); 644 640 bytes_read = 1; 645 641 } else { 646 - sc16is7xx_fifo_read(port, s->buf, rxlen); 642 + sc16is7xx_fifo_read(port, one->buf, rxlen); 647 643 bytes_read = rxlen; 648 644 } 649 645 ··· 676 672 } 677 673 678 674 for (i = 0; i < bytes_read; ++i) { 679 - ch = s->buf[i]; 675 + ch = one->buf[i]; 680 676 if (uart_handle_sysrq_char(port, ch)) 681 677 continue; 682 678 ··· 694 690 695 691 static void sc16is7xx_handle_tx(struct uart_port *port) 696 692 { 697 - struct sc16is7xx_port *s = dev_get_drvdata(port->dev); 698 693 struct tty_port *tport = &port->state->port; 699 694 unsigned long flags; 700 695 unsigned int txlen; 696 + unsigned char *tail; 701 697 702 698 if (unlikely(port->x_char)) { 703 699 sc16is7xx_port_write(port, SC16IS7XX_THR_REG, port->x_char); ··· 722 718 txlen = 0; 723 719 } 724 720 725 - txlen = uart_fifo_out(port, s->buf, txlen); 726 - sc16is7xx_fifo_write(port, s->buf, txlen); 721 + txlen = kfifo_out_linear_ptr(&tport->xmit_fifo, &tail, txlen); 722 + sc16is7xx_fifo_write(port, tail, txlen); 723 + uart_xmit_advance(port, txlen); 727 724 728 725 uart_port_lock_irqsave(port, &flags); 729 726 if (kfifo_len(&tport->xmit_fifo) < WAKEUP_CHARS)
+8
drivers/tty/serial/serial_core.c
··· 881 881 new_flags = (__force upf_t)new_info->flags; 882 882 old_custom_divisor = uport->custom_divisor; 883 883 884 + if (!(uport->flags & UPF_FIXED_PORT)) { 885 + unsigned int uartclk = new_info->baud_base * 16; 886 + /* check needs to be done here before other settings made */ 887 + if (uartclk == 0) { 888 + retval = -EINVAL; 889 + goto exit; 890 + } 891 + } 884 892 if (!capable(CAP_SYS_ADMIN)) { 885 893 retval = -EPERM; 886 894 if (change_irq || change_port ||
+7 -13
drivers/tty/vt/conmakehash.c
··· 11 11 * Copyright (C) 1995-1997 H. Peter Anvin 12 12 */ 13 13 14 + #include <libgen.h> 15 + #include <linux/limits.h> 14 16 #include <stdio.h> 15 17 #include <stdlib.h> 16 18 #include <sysexits.h> ··· 78 76 int main(int argc, char *argv[]) 79 77 { 80 78 FILE *ctbl; 81 - const char *tblname, *rel_tblname; 82 - const char *abs_srctree; 79 + const char *tblname; 80 + char base_tblname[PATH_MAX]; 83 81 char buffer[65536]; 84 82 int fontlen; 85 83 int i, nuni, nent; ··· 103 101 exit(EX_NOINPUT); 104 102 } 105 103 } 106 - 107 - abs_srctree = getenv("abs_srctree"); 108 - if (abs_srctree && !strncmp(abs_srctree, tblname, strlen(abs_srctree))) 109 - { 110 - rel_tblname = tblname + strlen(abs_srctree); 111 - while (*rel_tblname == '/') 112 - ++rel_tblname; 113 - } 114 - else 115 - rel_tblname = tblname; 116 104 117 105 /* For now we assume the default font is always 256 characters. */ 118 106 fontlen = 256; ··· 245 253 for ( i = 0 ; i < fontlen ; i++ ) 246 254 nuni += unicount[i]; 247 255 256 + strncpy(base_tblname, tblname, PATH_MAX); 257 + base_tblname[PATH_MAX - 1] = 0; 248 258 printf("\ 249 259 /*\n\ 250 260 * Do not edit this file; it was automatically generated by\n\ ··· 258 264 #include <linux/types.h>\n\ 259 265 \n\ 260 266 u8 dfont_unicount[%d] = \n\ 261 - {\n\t", rel_tblname, fontlen); 267 + {\n\t", basename(base_tblname), fontlen); 262 268 263 269 for ( i = 0 ; i < fontlen ; i++ ) 264 270 {