Skip to contentSkip to conversation

sound: sb8: add a check for request_region

PATCH Applied Kangjie Lu 2 participants 2 messages Mar 15, 2019 – Mar 16, 2019 Sound

lore
Share & tools
lore

Kangjie Lu

author
#0 lore raw

PATCH 1/1 sound: sb8: add a check for request_region

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

---
 sound/isa/sb/sb8.c | 4 ++++
 1 file changed, 4 insertions(+)
sound/isa/sb/sb8.c +4 -0
index aa2a83eb81a9..dc27a480c2d9 100644
@@ -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],
Signature · 1 line
2.17.1