]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ALSA: sb8: add a check for request_region
authorKangjie Lu <kjlu@umn.edu>
Fri, 15 Mar 2019 04:04:14 +0000 (23:04 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Apr 2019 07:15:00 +0000 (09:15 +0200)
[ Upstream commit dcd0feac9bab901d5739de51b3f69840851f8919 ]

In case request_region fails, the fix returns an error code to
avoid NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/isa/sb/sb8.c

index d77dcba276b544b750c452b622981c6c7a0ff585..1eb8b61a185be87ae95212bcccd7417919b1befc 100644 (file)
@@ -111,6 +111,10 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev)
 
        /* block the 0x388 port to avoid PnP conflicts */
        acard->fm_res = request_region(0x388, 4, "SoundBlaster FM");
+       if (!acard->fm_res) {
+               err = -EBUSY;
+               goto _err;
+       }
 
        if (port[dev] != SNDRV_AUTO_PORT) {
                if ((err = snd_sbdsp_create(card, port[dev], irq[dev],