patch-2.1.132 linux/drivers/sound/audio.c

Next file: linux/drivers/sound/cs4232.c
Previous file: linux/drivers/sound/ad1848.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.131/linux/drivers/sound/audio.c linux/drivers/sound/audio.c
@@ -199,6 +199,9 @@
 
 	p = 0;
 	c = count;
+	
+	if(count < 0)
+		return -EINVAL;
 
 	if (!(audio_devs[dev]->open_mode & OPEN_WRITE))
 		return -EPERM;
@@ -810,8 +813,10 @@
 			{
 				reorganize_buffers(dev, dmap_in, 1);
 				if ((err = audio_devs[dev]->d->prepare_for_input(dev,
-					     dmap_in->fragment_size, dmap_in->nbufs)) < 0)
+					     dmap_in->fragment_size, dmap_in->nbufs)) < 0) {
+					restore_flags(flags);
 					return -err;
+				}
 				dmap_in->dma_mode = DMODE_INPUT;
 				audio_devs[dev]->enable_bits = bits;
 				DMAbuf_activate_recording(dev, dmap_in);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov