aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/pci/hda/hda_hwdep.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c
index 57df06e76968..cc009a4a3d1d 100644
--- a/sound/pci/hda/hda_hwdep.c
+++ b/sound/pci/hda/hda_hwdep.c
@@ -21,6 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/compat.h> 23#include <linux/compat.h>
24#include <linux/nospec.h>
24#include <sound/core.h> 25#include <sound/core.h>
25#include "hda_codec.h" 26#include "hda_codec.h"
26#include "hda_local.h" 27#include "hda_local.h"
@@ -51,7 +52,16 @@ static int get_wcap_ioctl(struct hda_codec *codec,
51 52
52 if (get_user(verb, &arg->verb)) 53 if (get_user(verb, &arg->verb))
53 return -EFAULT; 54 return -EFAULT;
54 res = get_wcaps(codec, verb >> 24); 55 /* open-code get_wcaps(verb>>24) with nospec */
56 verb >>= 24;
57 if (verb < codec->core.start_nid ||
58 verb >= codec->core.start_nid + codec->core.num_nodes) {
59 res = 0;
60 } else {
61 verb -= codec->core.start_nid;
62 verb = array_index_nospec(verb, codec->core.num_nodes);
63 res = codec->wcaps[verb];
64 }
55 if (put_user(res, &arg->res)) 65 if (put_user(res, &arg->res))
56 return -EFAULT; 66 return -EFAULT;
57 return 0; 67 return 0;