The following program produces a few EINVAL errors
and then only ENOMEM erros, because the file
sr_ioctl.c has a memory leak.
(It does not free the memory, when returning EINVAL)
Reproduce the bug:
-----------------
The point is to find a cd on which you
can do a CDROMREADRAW. I have tested it with
a VCD (Video CD), but the bug is very "visible"
if you look at the file drivers/scsi/sr_ioctl.c around line 790.
regards,
Martin
/*
This program triggers a kernel bug in the file
sr_ioctl.c around line 790 in Linux 2.2.12/13
//
// SCSI Adapter: Adaptec AHA-294X Ultra SCSI host adapter
// Ultra Wide Controller
//
// Linux 2.2.12-20 (RedHat 6.1) without changes to this kernel
// I did not have this problem with RedHat 6.0 2.2.5
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <linux/cdrom.h>
struct cdsector {
char sync[12],
seader[4],
subheader[8],
data[2324],
spare[4];
} ;
int main() {
struct cdsector buf;
int fd=open("/dev/cdrom",O_RDONLY);
if (fd == -1) {
perror("open");
exit(0);
}
buf.sync[0]=(char)0;
buf.sync[1]=(char)0;
buf.sync[2]=(char)0;
// now trigger the bug
while(1) {
if (ioctl(fd, CDROMREADRAW, &buf) == -1 ) {
perror("CDROMREADRAW");
}
}
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/