Re: Bug in OSS/free in kernel 2.1.130

Oleg Drokin (green@ccssu.crimea.ua)
Mon, 30 Nov 1998 17:11:44 +0300 (MSK)


--ELM912435104-32029-0_
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hello!

It was nasty bug in performing audio output
See my quick fix attached.
(I do not know can this fix be considered a god one, or not, but it fixes
thing for me)

> I'm sorry if this has been posted before, but I am pretty sure I discovered a
> bug in the sound code of the 2.1.130 devel kernel. I am not sure if this
> affects earlier kernels, I crashed my computer enough just trying to track
> down what call causes it. In the 15-20 times my computer crashed, I only saw
> one kernel panic screen (kernel dereferenced null pointer), the other times it
> just locked completely or rebooted. I have an ESS1869 based sound card. This
> program does not crash the computer when using commercial OSS (demo), only
> OSS/free. Since the program is so short, I am including it in the message.
>
> #include <stdio.h>
> #include <netinet/in.h>
> #include <sys/soundcard.h>
> #include <sys/ioctl.h>
> #include <fcntl.h>
> #include <errno.h>
>
> void sound_play() {
> int size = -1073742872;
> unsigned char *buf;
> int audio_fd;
> if( (audio_fd = open("/dev/dsp", O_WRONLY, 0)) == -1) {
> perror("/dev/dsp");
> exit(1);
> }
> buf = NULL;
> write(audio_fd, buf, size);
> }
> main( int argc, char **argv )
> {
> sound_play();
> }

Bye,
Oleg

-- 
 [RAVE *SUCKS* TEAM] [Team $Ui(iDE] [Trans-M Must Die!] [Sepultura Fans Team]
                         [Tolkien forever team]

--ELM912435104-32029-0_ Content-Type: text/plain Content-Disposition: attachment; filename=panic_fix.diff Content-Description: panic_fix.diff Content-Transfer-Encoding: 7bit

--- linux/drivers/sound/audio.c.orig Mon Nov 30 16:53:36 1998 +++ linux/drivers/sound/audio.c Mon Nov 30 16:50:18 1998 @@ -214,6 +214,9 @@ return 0; } + if (count < 0) + return -EFAULT; + while (c) { if ((err = DMAbuf_getwrbuffer(dev, &dma_buf, &buf_size, !!(file->f_flags & O_NONBLOCK))) < 0)

--ELM912435104-32029-0_--

- 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/