]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
.31 patch
authorGreg Kroah-Hartman <gregkh@suse.de>
Wed, 7 Apr 2010 22:30:26 +0000 (15:30 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 7 Apr 2010 22:30:26 +0000 (15:30 -0700)
queue-2.6.31/alsa-mixart-range-checking-proc-file.patch [new file with mode: 0644]
queue-2.6.31/series [new file with mode: 0644]

diff --git a/queue-2.6.31/alsa-mixart-range-checking-proc-file.patch b/queue-2.6.31/alsa-mixart-range-checking-proc-file.patch
new file mode 100644 (file)
index 0000000..0773423
--- /dev/null
@@ -0,0 +1,69 @@
+From b0cc58a25d04160d39a80e436847eaa2fbc5aa09 Mon Sep 17 00:00:00 2001
+From: Dan Carpenter <error27@gmail.com>
+Date: Tue, 6 Apr 2010 19:31:26 +0300
+Subject: ALSA: mixart: range checking proc file
+
+From: Dan Carpenter <error27@gmail.com>
+
+commit b0cc58a25d04160d39a80e436847eaa2fbc5aa09 upstream.
+
+The original code doesn't take into consideration that the value of
+MIXART_BA0_SIZE - pos can be less than zero which would lead to a large
+unsigned value for "count".
+
+Also I moved the check that read size is a multiple of 4 bytes below
+the code that adjusts "count".
+
+Signed-off-by: Dan Carpenter <error27@gmail.com>
+Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ sound/pci/mixart/mixart.c |   24 ++++++++++++++----------
+ 1 file changed, 14 insertions(+), 10 deletions(-)
+
+--- a/sound/pci/mixart/mixart.c
++++ b/sound/pci/mixart/mixart.c
+@@ -1161,13 +1161,15 @@ static long snd_mixart_BA0_read(struct s
+                               unsigned long count, unsigned long pos)
+ {
+       struct mixart_mgr *mgr = entry->private_data;
++      unsigned long maxsize;
+-      count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
+-      if(count <= 0)
++      if (pos >= MIXART_BA0_SIZE)
+               return 0;
+-      if(pos + count > MIXART_BA0_SIZE)
+-              count = (long)(MIXART_BA0_SIZE - pos);
+-      if(copy_to_user_fromio(buf, MIXART_MEM( mgr, pos ), count))
++      maxsize = MIXART_BA0_SIZE - pos;
++      if (count > maxsize)
++              count = maxsize;
++      count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
++      if (copy_to_user_fromio(buf, MIXART_MEM(mgr, pos), count))
+               return -EFAULT;
+       return count;
+ }
+@@ -1180,13 +1182,15 @@ static long snd_mixart_BA1_read(struct s
+                               unsigned long count, unsigned long pos)
+ {
+       struct mixart_mgr *mgr = entry->private_data;
++      unsigned long maxsize;
+-      count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
+-      if(count <= 0)
++      if (pos > MIXART_BA1_SIZE)
+               return 0;
+-      if(pos + count > MIXART_BA1_SIZE)
+-              count = (long)(MIXART_BA1_SIZE - pos);
+-      if(copy_to_user_fromio(buf, MIXART_REG( mgr, pos ), count))
++      maxsize = MIXART_BA1_SIZE - pos;
++      if (count > maxsize)
++              count = maxsize;
++      count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
++      if (copy_to_user_fromio(buf, MIXART_REG(mgr, pos), count))
+               return -EFAULT;
+       return count;
+ }
diff --git a/queue-2.6.31/series b/queue-2.6.31/series
new file mode 100644 (file)
index 0000000..9091fb0
--- /dev/null
@@ -0,0 +1 @@
+alsa-mixart-range-checking-proc-file.patch