Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d37fbe4 authored by William Light's avatar William Light Committed by Takashi Iwai
Browse files

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: default avatarWilliam Light <wrl@illest.net>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent ffd3d5c6
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -664,15 +664,17 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev)
	for (i = 0; i < input->keycodemax; i++)
	for (i = 0; i < input->keycodemax; i++)
		__set_bit(dev->keycode[i], input->keybit);
		__set_bit(dev->keycode[i], input->keybit);


	dev->input_dev = input;

	ret = input_register_device(input);
	ret = input_register_device(input);
	if (ret < 0)
	if (ret < 0)
		goto exit_free_idev;
		goto exit_free_idev;


	dev->input_dev = input;
	return 0;
	return 0;


exit_free_idev:
exit_free_idev:
	input_free_device(input);
	input_free_device(input);
	dev->input_dev = NULL;
	return ret;
	return ret;
}
}