From owner-freebsd-bugs@FreeBSD.ORG Mon Dec 15 17:50:20 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EBD6216A4D1 for ; Mon, 15 Dec 2003 17:50:19 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8F4A443D48 for ; Mon, 15 Dec 2003 17:50:14 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) hBG1oEFR001988 for ; Mon, 15 Dec 2003 17:50:14 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id hBG1oEAq001987; Mon, 15 Dec 2003 17:50:14 -0800 (PST) (envelope-from gnats) Resent-Date: Mon, 15 Dec 2003 17:50:14 -0800 (PST) Resent-Message-Id: <200312160150.hBG1oEAq001987@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Thomas Sandford Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 07E8C16A4CE for ; Mon, 15 Dec 2003 17:48:08 -0800 (PST) Received: from mail.paradise-green.co.uk (161-86-19-212-hpnt-t3-z2.wireless.as15758.net [212.19.86.161]) by mx1.FreeBSD.org (Postfix) with ESMTP id 85B2943D36 for ; Mon, 15 Dec 2003 17:48:05 -0800 (PST) (envelope-from freebsduser@paradisegreen.co.uk) Received: from burs-sgs1.paradise (burs-sgs1.paradise [10.0.0.33]) hBFMkV6G089836 for ; Mon, 15 Dec 2003 22:46:31 GMT (envelope-from tdgsandf@burs-sgs1.paradise) Received: from burs-sgs1.paradise (localhost.paradise [127.0.0.1]) by burs-sgs1.paradise (8.12.10/8.12.10) with ESMTP id hBFMiqLr000690 for ; Mon, 15 Dec 2003 22:44:52 GMT (envelope-from tdgsandf@burs-sgs1.paradise) Received: (from tdgsandf@localhost) by burs-sgs1.paradise (8.12.10/8.12.10/Submit) id hBFMilI7000689; Mon, 15 Dec 2003 22:44:47 GMT (envelope-from tdgsandf) Message-Id: <200312152244.hBFMilI7000689@burs-sgs1.paradise> Date: Mon, 15 Dec 2003 22:44:47 GMT From: Thomas Sandford To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/60284: uart driver fails report invalid parameters to caller X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Thomas Sandford List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Dec 2003 01:50:20 -0000 >Number: 60284 >Category: kern >Synopsis: uart driver fails report invalid parameters to caller >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Dec 15 17:50:14 PST 2003 >Closed-Date: >Last-Modified: >Originator: Thomas Sandford >Release: FreeBSD 5.1-CURRENT-20031116-JPSNAP i386 >Organization: Paradise Green Technical Services >Environment: System: FreeBSD burs-sgs1.paradise 5.1-CURRENT-20031116-JPSNAP FreeBSD 5.1-CURRENT-20031116-JPSNAP #1: Mon Dec 15 22:15:29 GMT 2003 root@burs-sgs1.paradise:/usr/src/sys/i386/compile/UART i386 Discovered on an i386 machine with GENERIC + puc + uart devices. However problem is system independant. >Description: uart_tty_param in /sys/dev/uart/uart_tty.c calls the UART_PARAM method without checking the return value. This means that invalid parameters (in particular impossible baud rates for the device in question) never get reported back to the caller. >How-To-Repeat: Include the uart driver in your kernel stty 12345678 Fix: Apply the following patch: Index: uart_tty.c =================================================================== RCS file: /home/ncvs/src/sys/dev/uart/uart_tty.c,v retrieving revision 1.4 diff -u -r1.4 uart_tty.c --- uart_tty.c 28 Sep 2003 18:20:42 -0000 1.4 +++ uart_tty.c 15 Dec 2003 22:42:48 -0000 @@ -225,7 +225,8 @@ : UART_PARITY_EVEN; else parity = UART_PARITY_NONE; - UART_PARAM(sc, t->c_ospeed, databits, stopbits, parity); + if (UART_PARAM(sc, t->c_ospeed, databits, stopbits, parity) != 0) + return EINVAL; UART_SETSIG(sc, UART_SIG_DDTR | UART_SIG_DTR); /* Set input flow control state. */ if (!sc->sc_hwiflow) { >Release-Note: >Audit-Trail: >Unformatted: