android_kernel_xiaomi_sm8350/sound
Laurent Pinchart f41ced8f10 Check fops_get() return value
Several subsystem open handlers dereference the fops_get() return value
without checking it for nullness.  This opens a race condition between the
open handler and module unloading.

A module can be marked as being unloaded (MODULE_STATE_GOING) before its
exit function is called and gets the chance to unregister the driver.
During that window open handlers can still be called, and fops_get() will
fail in try_module_get() and return a NULL pointer.

This change checks the fops_get() return value and returns -ENODEV if NULL.

Reported-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Acked-by: Takashi Iwai <tiwai@suse.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Dave Airlie <airlied@linux.ie>
Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06 15:59:11 -08:00
..
aoa Merge branch 'topic/aoa' into to-push 2008-12-25 11:40:24 +01:00
arm
core Check fops_get() return value 2009-01-06 15:59:11 -08:00
drivers Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2008-12-30 16:16:21 -08:00
i2c V4L/DVB (10138): v4l2-ioctl: change to long return type to match unlocked_ioctl. 2009-01-02 17:11:34 -02:00
isa Merge branch 'topic/pcsp-fix' into topic/misc 2008-12-20 23:39:47 +01:00
mips
oss [ARM] netwinder: clean up GPIO naming 2008-12-13 09:12:07 +00:00
parisc
pci Merge branch 'topic/misc' into for-linus 2009-01-05 18:34:25 +01:00
pcmcia ALSA: hda - Convert from takslet_hi_schedule() to tasklet_schedule() 2008-12-18 12:17:55 +01:00
ppc
sh
soc Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound-2.6 into topic/asoc 2009-01-05 18:31:38 +01:00
sparc
spi
synth
usb ALSA: sound/usb: Use negated usb_endpoint_xfer_control, etc 2009-01-04 12:10:04 +01:00
ac97_bus.c
Kconfig
last.c
Makefile
sound_core.c ALSA: Fix declaration of sound_class 2008-12-15 16:55:27 +01:00
sound_firmware.c