Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp883749yba; Thu, 18 Apr 2019 11:09:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5lZ4VIO5cmbzdmPztKHA7+hE1UF/PElErY0NUJep9u+00AdUic9ktIA5Rf5q4U/Nikz1/ X-Received: by 2002:a62:a513:: with SMTP id v19mr96720706pfm.212.1555610997690; Thu, 18 Apr 2019 11:09:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555610997; cv=none; d=google.com; s=arc-20160816; b=lK2/rCr7eCJOo6k5CqinoaRI/xWoWORAtXNNwB3IpdDZQCRVRADskxatmx83X+b72t n8Y7WIMNe/QRPQwwhFN0nIZnGReGA3DZmLN8Te1QuQwm8pztTy6Intx+RgHxNH89Rbyz T6hRNccRw/PaD09ckzSB4Xm792/QUoEhykqvkqK0LM66b0G5uzxOyS8fXvK6rJzkCMTC xcwmapgJIN4c0eJ0IeEsGstRCfHB57DcuE93e/3iGWFcy628wVFzNzD2+a+c9HaDagsw uRBax7N4Xg60GJu0SygdjYjTgkRayf3IrSdtTqtWtTGBJC9Z45FuPBCp4gtNd74FM5j9 Lsag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pxm1vTgnN3xqC8nuhk5+M1dq3XLrLDH308lWcv4fd8I=; b=JyIHn1HMwqGKBBJsb1a8u/DfcL63HBLFCidN+6z/ZIc43DTkPHLHm3tVxKoDpzY+6Y +1yDV6jXn0mbhoxArLm1JD3Bs7GLEBRlBE5+ks27/w8UNY6dzRExyELHjpe4/yLaAGs4 jO9oZF4USkVBKZEud16ov9yzZ1GU0z0hMkJU+oNVAgUz181gbqDEaYG3tVh0Ub3siX7w ILCHBY3wFsK0RpVRp/NcZslu94CaQydD3H2bt/S4gs7CL0nNLI5/NtvFjZr3DqTISlM9 91EeE31/ZAtPDiXRGBUMIW+lGIznbcFHzcNgSVZ+/pDj7sruMFx1pvCOC2ypfOSYfUzO R04A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TM5OHnjc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m1si2306247pgh.8.2019.04.18.11.09.42; Thu, 18 Apr 2019 11:09:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TM5OHnjc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391704AbfDRSIA (ORCPT + 99 others); Thu, 18 Apr 2019 14:08:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:38988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389862AbfDRSH7 (ORCPT ); Thu, 18 Apr 2019 14:07:59 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 25EAC217FA; Thu, 18 Apr 2019 18:07:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555610878; bh=c36j3ZOAl3t5uAb8Jd/LozXTWRyantggM7gPj2CMmQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TM5OHnjc4FCoASoDkQr0ubhmUqkDmfx8D2eUjfjSIq+FvAwr32p0z4X38vd1z3ICW FyPZOHAav7viH4DnIOu/rYoMRIju/0SVp6/nrK+o3ck7erpEDbZrJpiS1jd0r/v7Kh ZMiqgTMp+g/fVgj5P3stoR4WuKSREZYWEifIZIYs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kangjie Lu , Takashi Iwai , Sasha Levin Subject: [PATCH 4.9 06/50] ALSA: sb8: add a check for request_region Date: Thu, 18 Apr 2019 19:57:17 +0200 Message-Id: <20190418160423.689257355@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160422.455656724@linuxfoundation.org> References: <20190418160422.455656724@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit dcd0feac9bab901d5739de51b3f69840851f8919 ] In case request_region fails, the fix returns an error code to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- 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 ad42d2364199..e75bfc511e3e 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.19.1