ALSA: sb8: add a check for request_region
authorKangjie Lu <kjlu@umn.edu>
Fri, 15 Mar 2019 04:04:14 +0000 (23:04 -0500)
committerTakashi Iwai <tiwai@suse.de>
Sat, 16 Mar 2019 09:30:27 +0000 (10:30 +0100)
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>
sound/isa/sb/sb8.c

index aa2a83e..dc27a48 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],