Update of /cvsroot/alsa/alsa-kernel/isa In directory sc8-pr-cvs1:/tmp/cvs-serv28241/alsa-kernel/isa
Modified Files: sscape.c Log Message: - sync with the 2.6 tree (imajor, iminor) - fixed firmware ioctls for sscape and hdsp drivers (ioctl out of range) Index: sscape.c =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/isa/sscape.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- sscape.c 12 Aug 2003 14:10:11 -0000 1.4 +++ sscape.c 25 Sep 2003 18:55:43 -0000 1.5 @@ -5,10 +5,6 @@ * This driver was written in part using information obtained from * the OSS/Free SoundScape driver, written by Hannu Savolainen. * - * FIXME (deadlock for alsa-kernel): - * - use ISA PnP scheme used by all ALSA ISA drivers - * - add non-MODULE build option - * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -455,14 +451,14 @@ * Upload a byte-stream into the SoundScape using DMA channel A. */ static int upload_dma_data(struct soundscape *s, - const unsigned char *data, size_t size, - size_t dmasize) + const unsigned char *data, + size_t size) { unsigned long flags; struct dmabuf dma; int ret; - if (!get_dmabuf(&dma, dmasize)) + if (!get_dmabuf(&dma, PAGE_ALIGN(size))) return -ENOMEM; spin_lock_irqsave(&s->lock, flags); @@ -575,7 +571,7 @@ int data = 0; int ret; - ret = upload_dma_data(sscape, bb->code, sizeof(bb->code), PAGE_SIZE); + ret = upload_dma_data(sscape, bb->code, sizeof(bb->code)); spin_lock_irqsave(&sscape->lock, flags); if (ret == 0) { @@ -602,17 +598,28 @@ * it into a local variable then we will SMASH THE * KERNEL'S STACK! We therefore leave it in USER * SPACE, and save ourselves from copying it at all. - * - * We assume that the caller has already verified the - * userspace memory addresses. */ static int sscape_upload_microcode(struct soundscape *sscape, const struct sscape_microcode *mc) { unsigned long flags; - int ret; + char *code; + int err, ret; + + /* + * We are going to have to copy this data into a special + * DMA-able buffer before we can upload it. We shall therefore + * just check that the data pointer is valid for now. + * + * NOTE: This buffer is 64K long! That's WAY too big to + * copy into a stack-temporary anyway. + */ + if (get_user(code, &mc->code)) + return -EFAULT; + if ((err = verify_area(VERIFY_READ, code, 65536)) != 0) + return err; - if ((ret = upload_dma_data(sscape, mc->code, sizeof(mc->code), PAGE_SIZE * 16)) == 0) { + if ((ret = upload_dma_data(sscape, code, 65536)) == 0) { snd_printk(KERN_INFO "sscape: MIDI firmware loaded\n"); } @@ -695,17 +702,6 @@ case SND_SSCAPE_LOAD_MCODE: { register const struct sscape_microcode *mc = (const struct sscape_microcode *) arg; - - /* - * We are going to have to copy this data into a special - * DMA-able buffer before we can upload it. We shall therefore - * just check that the data pointer is valid for now. - * - * NOTE: This buffer is 64K long! That's WAY too big to - * copy into a stack-temporary anyway. - */ - if ((err = verify_area(VERIFY_READ, mc->code, sizeof(mc->code))) != 0) - return err; err = sscape_upload_microcode(sscape, mc); } ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Alsa-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-cvslog