linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sound: sb8: add a check for request_region
@ 2019-03-15  4:04 Kangjie Lu
  2019-03-16  9:32 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2019-03-15  4:04 UTC (permalink / raw)
  To: kjlu; +Cc: pakki001, Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel

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

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 sound/isa/sb/sb8.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c
index aa2a83eb81a9..dc27a480c2d9 100644
--- a/sound/isa/sb/sb8.c
+++ b/sound/isa/sb/sb8.c
@@ -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],
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sound: sb8: add a check for request_region
  2019-03-15  4:04 [PATCH] sound: sb8: add a check for request_region Kangjie Lu
@ 2019-03-16  9:32 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2019-03-16  9:32 UTC (permalink / raw)
  To: Kangjie Lu; +Cc: alsa-devel, Jaroslav Kysela, pakki001, linux-kernel

On Fri, 15 Mar 2019 05:04:14 +0100,
Kangjie Lu wrote:
> 
> In case request_region fails, the fix returns an error code to
> avoid NULL pointer dereference.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>

Applied, thanks.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-16  9:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15  4:04 [PATCH] sound: sb8: add a check for request_region Kangjie Lu
2019-03-16  9:32 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).