From owner-freebsd-bugs Tue Feb 20 17:50: 8 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id C481E37B503 for ; Tue, 20 Feb 2001 17:50:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f1L1o1V37281; Tue, 20 Feb 2001 17:50:01 -0800 (PST) (envelope-from gnats) Received: from hand.dotat.at (sfo-gw.covalent.net [207.44.198.62]) by hub.freebsd.org (Postfix) with ESMTP id E640437B401 for ; Tue, 20 Feb 2001 17:47:24 -0800 (PST) (envelope-from fanf@dotat.at) Received: from fanf by hand.dotat.at with local (Exim 3.20 #3) id 14VONA-0000FZ-00 for FreeBSD-gnats-submit@freebsd.org; Wed, 21 Feb 2001 01:47:16 +0000 Message-Id: Date: Wed, 21 Feb 2001 01:47:16 +0000 From: Tony Finch Reply-To: Tony Finch To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/25240: incomplete CDIOCREADSUBCHANNEL support in atapi-cd Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 25240 >Category: kern >Synopsis: incomplete CDIOCREADSUBCHANNEL support in atapi-cd >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Feb 20 17:50:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Tony Finch >Release: FreeBSD 4.2-STABLE i386 >Organization: Covalent Technologies, Inc. >Environment: FreeBSD hand.dotat.at 4.2-STABLE FreeBSD 4.2-STABLE #4: Wed Feb 21 00:26:12 GMT 2001 fanf@hand.dotat.at:/FreeBSD/obj/FreeBSD/releng4/sys/DELL-Latitude-CSx i386 >Description: The implementation of CDIOCREADSUBCHANNEL in sys/dev/ata/atapi-cd.c only supports the CD_CURRENT_POSITION data_format, but it doesn't actually check the data_format to ensure that it is CD_CURRENT_POSITION. This manifests as garbage printed by `cdcontrol status media`. >How-To-Repeat: `cdcontrol status media` with an audio CD in an ATAPI drive prints garbage for the catalogue number. >Fix: This patch just checks that the data_format is supported. I'm not sure if ENODEV is right: would EOPNOTSUPP (as suggested by bfumerola) be more appropriate or does the fact that it isn't mentioned in the ioctl(2) man page mean that isn't allowed? Index: atapi-cd.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ata/atapi-cd.c,v retrieving revision 1.48.2.9 diff -u -r1.48.2.9 atapi-cd.c --- atapi-cd.c 2001/01/29 18:07:18 1.48.2.9 +++ atapi-cd.c 2001/02/21 01:42:14 @@ -730,6 +730,11 @@ sizeof(cdp->subchan)>>8, sizeof(cdp->subchan), 0, 0, 0, 0, 0, 0, 0 }; + if (args->data_format != CD_CURRENT_POSITION) { + error = ENODEV; + break; + } + if (len > sizeof(data) || len < sizeof(struct cd_sub_channel_header)) { error = EINVAL; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message