* [patch] staging: line6: add bounds check in snd_toneport_source_put()
@ 2013-09-13 8:07 Dan Carpenter
2013-09-14 6:11 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-09-13 8:07 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Stefan Hajnoczi, devel, linux-kernel, kernel-janitors
"source" comes from the user in snd_ctl_elem_write() so it needs to be
checked.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c
index 2f44d56..776d363 100644
--- a/drivers/staging/line6/toneport.c
+++ b/drivers/staging/line6/toneport.c
@@ -244,13 +244,17 @@ static int snd_toneport_source_put(struct snd_kcontrol *kcontrol,
struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol);
struct usb_line6_toneport *toneport =
(struct usb_line6_toneport *)line6pcm->line6;
+ unsigned int source;
- if (ucontrol->value.enumerated.item[0] == toneport->source)
+ source = ucontrol->value.enumerated.item[0];
+ if (source >= ARRAY_SIZE(toneport_source_info))
+ return -EINVAL;
+ if (source == toneport->source)
return 0;
- toneport->source = ucontrol->value.enumerated.item[0];
+ toneport->source = source;
toneport_send_cmd(toneport->line6.usbdev,
- toneport_source_info[toneport->source].code, 0x0000);
+ toneport_source_info[source].code, 0x0000);
return 1;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] staging: line6: add bounds check in snd_toneport_source_put()
2013-09-13 8:07 [patch] staging: line6: add bounds check in snd_toneport_source_put() Dan Carpenter
@ 2013-09-14 6:11 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2013-09-14 6:11 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Greg Kroah-Hartman, devel, linux-kernel, kernel-janitors
On Fri, Sep 13, 2013 at 10:07 AM, Dan Carpenter
<dan.carpenter@oracle.com> wrote:
> "source" comes from the user in snd_ctl_elem_write() so it needs to be
> checked.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-09-14 6:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-13 8:07 [patch] staging: line6: add bounds check in snd_toneport_source_put() Dan Carpenter
2013-09-14 6:11 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®