Subject: kern/5592: old SCSI programming interface is broken
To: None <gnats-bugs@gnats.netbsd.org>
From: John F. Woods <jfw@jfwhome.funhouse.com>
List: netbsd-bugs
Date: 06/14/1998 23:14:57
>Number: 5592
>Category: kern
>Synopsis: old SCSI programming interface is broken
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people (Kernel Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Jun 14 20:20:01 1998
>Last-Modified:
>Originator: John F. Woods
>Organization:
Misanthropes-R-Us
>Release: Jun 12, 1998
>Environment:
System: NetBSD jfwhome.funhouse.com 1.3E NetBSD 1.3E (JFW) #1: Sat Mar 14 21:56:11 EST 1998 jfw@jfwhome.funhouse.com:/usr/src/sys/arch/i386/compile/JFW i386
>Description:
The backward compatibility for the old OSCIOCIDENTIFY ioctl is broken:
previously a read-only file descriptor was sufficient to issue the ioctl,
but now a writable file descriptor is required:
switch (cmd) {
case SCIOCIDENTIFY:
break;
case SCIOCCOMMAND:
if ((((scsireq_t *)addr)->flags & SCCMD_READ) == 0 &&
(flag & FWRITE) == 0)
return (EBADF);
break;
default:
if ((flag & FWRITE) == 0)
return (EBADF);
}
OSCIOIDENTIFY is not in the list, so it falls through the default: label.
>How-To-Repeat:
Read the code and/or run an old program.
>Fix:
Add the following lines:
switch (cmd) {
+ case OSCIOCIDENTIFY:
case SCIOCIDENTIFY:
break;
case SCIOCCOMMAND:
if ((((scsireq_t *)addr)->flags & SCCMD_READ) == 0 &&
(flag & FWRITE) == 0)
return (EBADF);
break;
default:
if ((flag & FWRITE) == 0)
return (EBADF);
}
>Audit-Trail:
>Unformatted: