aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/caiaq
diff options
context:
space:
mode:
authorWilliam Light <wrl@illest.net>2011-10-10 11:54:22 -0400
committerTakashi Iwai <tiwai@suse.de>2011-10-13 02:16:42 -0400
commit3d37fbe44112b06279efa04ad91a0e4b7a0c600c (patch)
tree630491400d6a8362fa57f8dfc293ee39ea1f6dbf /sound/usb/caiaq
parentffd3d5c6c7a20fb718daf98a6c8a476d228f3995 (diff)
ALSA: snd-usb-caiaq: Fix NULL dereference in input.c
There was a case where a newly-registered input device could be opened before a necessary variable in the device structure was set. When code tried to use the variable in the URB reply callback, it would cause an Oops. This fix sets the aforementioned variable before calling input_register_device. Signed-off-by: William Light <wrl@illest.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/caiaq')
-rw-r--r--sound/usb/caiaq/input.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/usb/caiaq/input.c b/sound/usb/caiaq/input.c
index a213813487bd..9efb92e4090d 100644
--- a/sound/usb/caiaq/input.c
+++ b/sound/usb/caiaq/input.c
@@ -664,15 +664,17 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev)
664 for (i = 0; i < input->keycodemax; i++) 664 for (i = 0; i < input->keycodemax; i++)
665 __set_bit(dev->keycode[i], input->keybit); 665 __set_bit(dev->keycode[i], input->keybit);
666 666
667 dev->input_dev = input;
668
667 ret = input_register_device(input); 669 ret = input_register_device(input);
668 if (ret < 0) 670 if (ret < 0)
669 goto exit_free_idev; 671 goto exit_free_idev;
670 672
671 dev->input_dev = input;
672 return 0; 673 return 0;
673 674
674exit_free_idev: 675exit_free_idev:
675 input_free_device(input); 676 input_free_device(input);
677 dev->input_dev = NULL;
676 return ret; 678 return ret;
677} 679}
678 680