All of lore.kernel.org
 help / color / mirror / Atom feed
* [CHECKER][PATCH] awe_wave.c user pointer dereference
@ 2003-06-05 21:34 Hollis Blanchard
  2003-06-05 22:07 ` Linus Torvalds
  0 siblings, 1 reply; 16+ messages in thread
From: Hollis Blanchard @ 2003-06-05 21:34 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 179 bytes --]

Two ioctl functions in sound/oss/awe_wave.c were directly dereferencing 
a user-supplied pointer in a few places. Please apply.

-- 
Hollis Blanchard
IBM Linux Technology Center


[-- Attachment #2: awe-userptr.txt --]
[-- Type: text/plain, Size: 1108 bytes --]

===== sound/oss/awe_wave.c 1.12 vs edited =====
--- 1.12/sound/oss/awe_wave.c	Thu Apr  3 16:35:48 2003
+++ edited/sound/oss/awe_wave.c	Thu Jun  5 16:16:53 2003
@@ -2046,7 +2046,8 @@
 			awe_info.nr_voices = awe_max_voices;
 		else
 			awe_info.nr_voices = AWE_MAX_CHANNELS;
-		memcpy((char*)arg, &awe_info, sizeof(awe_info));
+		if (copy_to_user((char*)arg, &awe_info, sizeof(awe_info)))
+			return -EFAULT;
 		return 0;
 		break;
 
@@ -2063,10 +2064,12 @@
 
 	case SNDCTL_SYNTH_MEMAVL:
 		return memsize - awe_free_mem_ptr() * 2;
+		break;
 
 	default:
 		printk(KERN_WARNING "AWE32: unsupported ioctl %d\n", cmd);
 		return -EINVAL;
+		break;
 	}
 }
 
@@ -4314,7 +4317,8 @@
 	if (((cmd >> 8) & 0xff) != 'M')
 		return -EINVAL;
 
-	level = *(int*)arg;
+	if (get_user(level, (int *)arg))
+		return -EFAULT;
 	level = ((level & 0xff) + (level >> 8)) / 2;
 	DEBUG(0,printk("AWEMix: cmd=%x val=%d\n", cmd & 0xff, level));
 
@@ -4370,7 +4374,9 @@
 		level = 0;
 		break;
 	}
-	return *(int*)arg = level;
+	if (put_user(level, (int *)arg))
+		return -EFAULT;
+	return level;
 }
 #endif /* CONFIG_AWE32_MIXER */
 

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2003-06-08  2:07 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-05 21:34 [CHECKER][PATCH] awe_wave.c user pointer dereference Hollis Blanchard
2003-06-05 22:07 ` Linus Torvalds
2003-06-06 16:46   ` __user annotations Hollis Blanchard
2003-06-06 17:28     ` Linus Torvalds
2003-06-07  0:32       ` Paul Mackerras
2003-06-07  0:42         ` Sam Ravnborg
2003-06-07  0:52           ` Paul Mackerras
2003-06-07  0:43         ` Linus Torvalds
2003-06-07  1:06           ` Arnaldo Carvalho de Melo
2003-06-07  1:09             ` Paul Mackerras
2003-06-07 16:49           ` Daniel Jacobowitz
2003-06-08  2:17             ` Paul Mackerras
2003-06-07 12:32       ` Ingo Oeser
2003-06-07 16:25         ` Linus Torvalds
2003-06-07 16:43           ` Sam Ravnborg
2003-06-07 16:48             ` Sam Ravnborg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.