Commit fb615499 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: opti9xx: Fix conflicting driver object name

The recent commit to delay the release of kobject triggered NULL
dereferences of opti9xx drivers.  The cause is that all
snd-opti92x-ad1848, snd-opti92x-cs4231 and snd-opti93x drivers
register the PnP card driver with the very same name, and also
snd-opti92x-ad1848 and -cs4231 drivers register the ISA driver with
the same name, too.  When these drivers are built in, quick
"register-release-and-re-register" actions occur, and this results in
Oops because of the same name is assigned to the kobject.

The fix is simply to assign individual names.  As a bonus, by using
KBUILD_MODNAME, the patch reduces more lines than it adds.

The fix is based on the suggestion by Russell King.
Reported-and-tested-by: default avatarFengguang Wu <fengguang.wu@intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 2ca320e2
...@@ -173,11 +173,7 @@ MODULE_DEVICE_TABLE(pnp_card, snd_opti9xx_pnpids); ...@@ -173,11 +173,7 @@ MODULE_DEVICE_TABLE(pnp_card, snd_opti9xx_pnpids);
#endif /* CONFIG_PNP */ #endif /* CONFIG_PNP */
#ifdef OPTi93X #define DEV_NAME KBUILD_MODNAME
#define DEV_NAME "opti93x"
#else
#define DEV_NAME "opti92x"
#endif
static char * snd_opti9xx_names[] = { static char * snd_opti9xx_names[] = {
"unknown", "unknown",
...@@ -1167,7 +1163,7 @@ static int snd_opti9xx_pnp_resume(struct pnp_card_link *pcard) ...@@ -1167,7 +1163,7 @@ static int snd_opti9xx_pnp_resume(struct pnp_card_link *pcard)
static struct pnp_card_driver opti9xx_pnpc_driver = { static struct pnp_card_driver opti9xx_pnpc_driver = {
.flags = PNP_DRIVER_RES_DISABLE, .flags = PNP_DRIVER_RES_DISABLE,
.name = "opti9xx", .name = DEV_NAME,
.id_table = snd_opti9xx_pnpids, .id_table = snd_opti9xx_pnpids,
.probe = snd_opti9xx_pnp_probe, .probe = snd_opti9xx_pnp_probe,
.remove = snd_opti9xx_pnp_remove, .remove = snd_opti9xx_pnp_remove,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment