lkml.org 
[lkml]   [1999]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectmemory leak in sr_ioctl.c in Linux 2.2.12/13


Hello,

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/

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.037 / U:17.788 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site