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-5.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty into master

Pull tty/serial/fbcon fixes from Greg KH:
"Here are some small tty and serial and fbcon fixes for 5.8-rc7 to
resolve some reported issues.

The fbcon fix is in here as it was simpler to take it this way (and it
was acked by the maintainer) as it was related to the vt console fix
as well, both of which resolve syzbot-found issues in the console
handling code.

The other serial driver fixes are for small issues reported in the -rc
releases.

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

* tag 'tty-5.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
serial: exar: Fix GPIO configuration for Sealevel cards based on XR17V35X
fbdev: Detect integer underflow at "struct fbcon_ops"->clear_margins.
serial: 8250_mtk: Fix high-speed baud rates clamping
serial: 8250: fix null-ptr-deref in serial8250_start_tx()
serial: tegra: drop bogus NULL tty-port checks
serial: tegra: fix CREAD handling for PIO
tty: xilinx_uartps: Really fix id assignment
vt: Reject zero-sized screen buffer size.

+69 -32
+1 -1
drivers/tty/serial/8250/8250_core.c
··· 524 524 */ 525 525 up->mcr_mask = ~ALPHA_KLUDGE_MCR; 526 526 up->mcr_force = ALPHA_KLUDGE_MCR; 527 + serial8250_set_defaults(up); 527 528 } 528 529 529 530 /* chain base port ops to support Remote Supervisor Adapter */ ··· 548 547 port->membase = old_serial_port[i].iomem_base; 549 548 port->iotype = old_serial_port[i].io_type; 550 549 port->regshift = old_serial_port[i].iomem_reg_shift; 551 - serial8250_set_defaults(up); 552 550 553 551 port->irqflags |= irqflag; 554 552 if (serial8250_isa_config != NULL)
+11 -1
drivers/tty/serial/8250/8250_exar.c
··· 326 326 * devices will export them as GPIOs, so we pre-configure them safely 327 327 * as inputs. 328 328 */ 329 - u8 dir = pcidev->vendor == PCI_VENDOR_ID_EXAR ? 0xff : 0x00; 329 + 330 + u8 dir = 0x00; 331 + 332 + if ((pcidev->vendor == PCI_VENDOR_ID_EXAR) && 333 + (pcidev->subsystem_vendor != PCI_VENDOR_ID_SEALEVEL)) { 334 + // Configure GPIO as inputs for Commtech adapters 335 + dir = 0xff; 336 + } else { 337 + // Configure GPIO as outputs for SeaLevel adapters 338 + dir = 0x00; 339 + } 330 340 331 341 writeb(0x00, p + UART_EXAR_MPIOINT_7_0); 332 342 writeb(0x00, p + UART_EXAR_MPIOLVL_7_0);
+18
drivers/tty/serial/8250/8250_mtk.c
··· 306 306 } 307 307 #endif 308 308 309 + /* 310 + * Store the requested baud rate before calling the generic 8250 311 + * set_termios method. Standard 8250 port expects bauds to be 312 + * no higher than (uartclk / 16) so the baud will be clamped if it 313 + * gets out of that bound. Mediatek 8250 port supports speed 314 + * higher than that, therefore we'll get original baud rate back 315 + * after calling the generic set_termios method and recalculate 316 + * the speed later in this method. 317 + */ 318 + baud = tty_termios_baud_rate(termios); 319 + 309 320 serial8250_do_set_termios(port, termios, old); 321 + 322 + tty_termios_encode_baud_rate(termios, baud, baud); 310 323 311 324 /* 312 325 * Mediatek UARTs use an extra highspeed register (MTK_UART_HIGHS) ··· 351 338 * interrupts disabled. 352 339 */ 353 340 spin_lock_irqsave(&port->lock, flags); 341 + 342 + /* 343 + * Update the per-port timeout. 344 + */ 345 + uart_update_timeout(port, termios->c_cflag, baud); 354 346 355 347 /* set DLAB we have cval saved in up->lcr from the call to the core */ 356 348 serial_port_out(port, UART_LCR, up->lcr | UART_LCR_DLAB);
+7 -9
drivers/tty/serial/serial-tegra.c
··· 635 635 } 636 636 637 637 static void tegra_uart_handle_rx_pio(struct tegra_uart_port *tup, 638 - struct tty_port *tty) 638 + struct tty_port *port) 639 639 { 640 640 do { 641 641 char flag = TTY_NORMAL; ··· 653 653 ch = (unsigned char) tegra_uart_read(tup, UART_RX); 654 654 tup->uport.icount.rx++; 655 655 656 - if (!uart_handle_sysrq_char(&tup->uport, ch) && tty) 657 - tty_insert_flip_char(tty, ch, flag); 656 + if (uart_handle_sysrq_char(&tup->uport, ch)) 657 + continue; 658 658 659 659 if (tup->uport.ignore_status_mask & UART_LSR_DR) 660 660 continue; 661 + 662 + tty_insert_flip_char(port, ch, flag); 661 663 } while (1); 662 664 } 663 665 664 666 static void tegra_uart_copy_rx_to_tty(struct tegra_uart_port *tup, 665 - struct tty_port *tty, 667 + struct tty_port *port, 666 668 unsigned int count) 667 669 { 668 670 int copied; ··· 674 672 return; 675 673 676 674 tup->uport.icount.rx += count; 677 - if (!tty) { 678 - dev_err(tup->uport.dev, "No tty port\n"); 679 - return; 680 - } 681 675 682 676 if (tup->uport.ignore_status_mask & UART_LSR_DR) 683 677 return; 684 678 685 679 dma_sync_single_for_cpu(tup->uport.dev, tup->rx_dma_buf_phys, 686 680 count, DMA_FROM_DEVICE); 687 - copied = tty_insert_flip_string(tty, 681 + copied = tty_insert_flip_string(port, 688 682 ((unsigned char *)(tup->rx_dma_buf_virt)), count); 689 683 if (copied != count) { 690 684 WARN_ON(1);
+6 -2
drivers/tty/serial/xilinx_uartps.c
··· 1580 1580 * If register_console() don't assign value, then console_port pointer 1581 1581 * is cleanup. 1582 1582 */ 1583 - if (!console_port) 1583 + if (!console_port) { 1584 + cdns_uart_console.index = id; 1584 1585 console_port = port; 1586 + } 1585 1587 #endif 1586 1588 1587 1589 rc = uart_add_one_port(&cdns_uart_uart_driver, port); ··· 1596 1594 #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE 1597 1595 /* This is not port which is used for console that's why clean it up */ 1598 1596 if (console_port == port && 1599 - !(cdns_uart_uart_driver.cons->flags & CON_ENABLED)) 1597 + !(cdns_uart_uart_driver.cons->flags & CON_ENABLED)) { 1600 1598 console_port = NULL; 1599 + cdns_uart_console.index = -1; 1600 + } 1601 1601 #endif 1602 1602 1603 1603 cdns_uart_data->cts_override = of_property_read_bool(pdev->dev.of_node,
+18 -11
drivers/tty/vt/vt.c
··· 1092 1092 .destruct = vc_port_destruct, 1093 1093 }; 1094 1094 1095 + /* 1096 + * Change # of rows and columns (0 means unchanged/the size of fg_console) 1097 + * [this is to be used together with some user program 1098 + * like resize that changes the hardware videomode] 1099 + */ 1100 + #define VC_MAXCOL (32767) 1101 + #define VC_MAXROW (32767) 1102 + 1095 1103 int vc_allocate(unsigned int currcons) /* return 0 on success */ 1096 1104 { 1097 1105 struct vt_notifier_param param; 1098 1106 struct vc_data *vc; 1107 + int err; 1099 1108 1100 1109 WARN_CONSOLE_UNLOCKED(); 1101 1110 ··· 1134 1125 if (!*vc->vc_uni_pagedir_loc) 1135 1126 con_set_default_unimap(vc); 1136 1127 1128 + err = -EINVAL; 1129 + if (vc->vc_cols > VC_MAXCOL || vc->vc_rows > VC_MAXROW || 1130 + vc->vc_screenbuf_size > KMALLOC_MAX_SIZE || !vc->vc_screenbuf_size) 1131 + goto err_free; 1132 + err = -ENOMEM; 1137 1133 vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_KERNEL); 1138 1134 if (!vc->vc_screenbuf) 1139 1135 goto err_free; ··· 1157 1143 visual_deinit(vc); 1158 1144 kfree(vc); 1159 1145 vc_cons[currcons].d = NULL; 1160 - return -ENOMEM; 1146 + return err; 1161 1147 } 1162 1148 1163 1149 static inline int resize_screen(struct vc_data *vc, int width, int height, ··· 1171 1157 1172 1158 return err; 1173 1159 } 1174 - 1175 - /* 1176 - * Change # of rows and columns (0 means unchanged/the size of fg_console) 1177 - * [this is to be used together with some user program 1178 - * like resize that changes the hardware videomode] 1179 - */ 1180 - #define VC_RESIZE_MAXCOL (32767) 1181 - #define VC_RESIZE_MAXROW (32767) 1182 1160 1183 1161 /** 1184 1162 * vc_do_resize - resizing method for the tty ··· 1207 1201 user = vc->vc_resize_user; 1208 1202 vc->vc_resize_user = 0; 1209 1203 1210 - if (cols > VC_RESIZE_MAXCOL || lines > VC_RESIZE_MAXROW) 1204 + if (cols > VC_MAXCOL || lines > VC_MAXROW) 1211 1205 return -EINVAL; 1212 1206 1213 1207 new_cols = (cols ? cols : vc->vc_cols); ··· 1218 1212 if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) 1219 1213 return 0; 1220 1214 1221 - if (new_screen_size > KMALLOC_MAX_SIZE) 1215 + if (new_screen_size > KMALLOC_MAX_SIZE || !new_screen_size) 1222 1216 return -EINVAL; 1223 1217 newscreen = kzalloc(new_screen_size, GFP_USER); 1224 1218 if (!newscreen) ··· 3399 3393 INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK); 3400 3394 tty_port_init(&vc->port); 3401 3395 visual_init(vc, currcons, 1); 3396 + /* Assuming vc->vc_{cols,rows,screenbuf_size} are sane here. */ 3402 3397 vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT); 3403 3398 vc_init(vc, vc->vc_rows, vc->vc_cols, 3404 3399 currcons || !vc->vc_sw->con_save_screen);
+2 -2
drivers/video/fbdev/core/bitblit.c
··· 216 216 region.color = color; 217 217 region.rop = ROP_COPY; 218 218 219 - if (rw && !bottom_only) { 219 + if ((int) rw > 0 && !bottom_only) { 220 220 region.dx = info->var.xoffset + rs; 221 221 region.dy = 0; 222 222 region.width = rw; ··· 224 224 info->fbops->fb_fillrect(info, &region); 225 225 } 226 226 227 - if (bh) { 227 + if ((int) bh > 0) { 228 228 region.dx = info->var.xoffset; 229 229 region.dy = info->var.yoffset + bs; 230 230 region.width = rs;
+2 -2
drivers/video/fbdev/core/fbcon_ccw.c
··· 201 201 region.color = color; 202 202 region.rop = ROP_COPY; 203 203 204 - if (rw && !bottom_only) { 204 + if ((int) rw > 0 && !bottom_only) { 205 205 region.dx = 0; 206 206 region.dy = info->var.yoffset; 207 207 region.height = rw; ··· 209 209 info->fbops->fb_fillrect(info, &region); 210 210 } 211 211 212 - if (bh) { 212 + if ((int) bh > 0) { 213 213 region.dx = info->var.xoffset + bs; 214 214 region.dy = 0; 215 215 region.height = info->var.yres_virtual;
+2 -2
drivers/video/fbdev/core/fbcon_cw.c
··· 184 184 region.color = color; 185 185 region.rop = ROP_COPY; 186 186 187 - if (rw && !bottom_only) { 187 + if ((int) rw > 0 && !bottom_only) { 188 188 region.dx = 0; 189 189 region.dy = info->var.yoffset + rs; 190 190 region.height = rw; ··· 192 192 info->fbops->fb_fillrect(info, &region); 193 193 } 194 194 195 - if (bh) { 195 + if ((int) bh > 0) { 196 196 region.dx = info->var.xoffset; 197 197 region.dy = info->var.yoffset; 198 198 region.height = info->var.yres;
+2 -2
drivers/video/fbdev/core/fbcon_ud.c
··· 231 231 region.color = color; 232 232 region.rop = ROP_COPY; 233 233 234 - if (rw && !bottom_only) { 234 + if ((int) rw > 0 && !bottom_only) { 235 235 region.dy = 0; 236 236 region.dx = info->var.xoffset; 237 237 region.width = rw; ··· 239 239 info->fbops->fb_fillrect(info, &region); 240 240 } 241 241 242 - if (bh) { 242 + if ((int) bh > 0) { 243 243 region.dy = info->var.yoffset; 244 244 region.dx = info->var.xoffset; 245 245 region.height = bh;