From patchwork Wed Nov 8 21:32:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 118354 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5932657qgn; Wed, 8 Nov 2017 16:15:35 -0800 (PST) X-Google-Smtp-Source: ABhQp+RZmSL7Ynptcpcf0LMBUj1zeCGjtmPS4eVrEPQnMlHear9dpo9qBXfLneV522j9BZaOzXfk X-Received: by 10.223.153.20 with SMTP id x20mr1714046wrb.219.1510186535539; Wed, 08 Nov 2017 16:15:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510186535; cv=none; d=google.com; s=arc-20160816; b=lmZTjthcOGBMjJDDtpoqgWh9G3h9tBo7mAPWE0//GTvuFMiQv9vXA+C6rQHQ65WJHX SA10gWNKKbcZ3eFr0vVtBmm23xhm6I52RkqkssZcoD+ie06SkHPu24b7fAR4T0mzNnKq Qw/bQLAEkXc/CycKs8x0HJXgo5BLppaHFG6GO/EDxAHceJQ86BzzWGGvdAOhEETYrK8V dak237Sf276JkE6tm5Vdmqli1059I9lDqDq+IFNgepav5mbGHwe+CNeo9zfMprXbLM0m fJH5InpFNsNpAflweAB5+xK7aEgNhpOl37oE/RehLpmUxgzsnXP6MKLx+oooT90MpVz6 OJTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=LP4a8hqEBu7xDV4+J/RSzAyIsZQ7WA7DLi63nr20owM=; b=bq53UMVRwEBW3TsviJlQ2X4mcjnS8JJWh3kmsnKPQAFi08nXpuszvgYzl/vdCaevjS mXsr6SVFFg24JnkJyttbrtKsB6yhT3LPt+SvTp3MvFS8YpvN56eA58LMtA4add1Hsj+h IASFOloKLc6LEZItyxVNYYWnVQV6bNo0LnrQZbUSWvyWvS2UQE7iKW/MaVQePQeBax94 /V1XaMpXVk1nTa18fLVq9f50fQsWIfml14tof4S7AnYBZJqBvjlIswf96XeEsCDhevCy 4JJVaZky8/BxW+A/S33gzly9wXQT6HCaix0I7cPkVVrgt3XNHdrVSFIFt+MjDSNiEuK2 Zr9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=Bov24kwf; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id e187si4489819wma.75.2017.11.08.16.15.34; Wed, 08 Nov 2017 16:15:35 -0800 (PST) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=Bov24kwf; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 276B22676A5; Thu, 9 Nov 2017 01:12:47 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 548072676E1; Wed, 8 Nov 2017 22:38:42 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 81A5C267665 for ; Wed, 8 Nov 2017 22:33:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=gd98HcLv7CdW7b2cNcyPKfklmIdCudkud8YuS1H0u74=; b=Bov24kwf2Q5g tzmL0cGDuTTwtDRoQCUE8/yBUSdFSd3+fXvVX5OI1k73Nm8yK3rkg6+ZWevSKncWrMxx9I/q9fhwY Lx1EGresKhZDdEiuMtU0xK3LVW96DF2qZGGRKh8Fag6lPQqKx47svEFLRIcyMlsElBJS6DI5sNqex PRefI=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1eCXxi-0003gi-LX; Wed, 08 Nov 2017 21:32:42 +0000 Received: from broonie by debutante with local (Exim 4.89) (envelope-from ) id 1eCXxh-0005SB-Ql; Wed, 08 Nov 2017 21:32:41 +0000 From: Mark Brown To: Subhransu S. Prusty In-Reply-To: <20171107104626.25800-11-guneshwor.o.singh@intel.com> Message-Id: Date: Wed, 08 Nov 2017 21:32:41 +0000 Cc: alsa-devel@alsa-project.org, Takashi Iwai , Guneshwor Singh , Liam Girdwood , Patches Audio , Mark Brown , Vinod Koul , "Subhransu S. Prusty" Subject: [alsa-devel] Applied "ASoC: hdac_hdmi: Fix possible NULL pointer dereference" to the asoc tree X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org The patch ASoC: hdac_hdmi: Fix possible NULL pointer dereference has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From eb50fa1739a63cc4b202b40a62d71055a2d7b80c Mon Sep 17 00:00:00 2001 From: "Subhransu S. Prusty" Date: Tue, 7 Nov 2017 16:16:25 +0530 Subject: [PATCH] ASoC: hdac_hdmi: Fix possible NULL pointer dereference Pointers hdac_hdmi_pcm and hda_device_id can be NULL, so add check for valid pointer to avoid NULL pointer dereference. Signed-off-by: Subhransu S. Prusty Signed-off-by: Guneshwor Singh Acked-By: Vinod Koul Signed-off-by: Mark Brown --- sound/soc/codecs/hdac_hdmi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 2.15.0 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c index 6f3ff15c0962..0c0aa6182502 100644 --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c @@ -1895,6 +1895,9 @@ static void hdac_hdmi_set_chmap(struct hdac_device *hdac, int pcm_idx, struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx); struct hdac_hdmi_port *port; + if (!pcm) + return; + if (list_empty(&pcm->port_list)) return; @@ -1913,6 +1916,9 @@ static bool is_hdac_hdmi_pcm_attached(struct hdac_device *hdac, int pcm_idx) struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx); + if (!pcm) + return false; + if (list_empty(&pcm->port_list)) return false; @@ -1926,6 +1932,9 @@ static int hdac_hdmi_get_spk_alloc(struct hdac_device *hdac, int pcm_idx) struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx); struct hdac_hdmi_port *port; + if (!pcm) + return 0; + if (list_empty(&pcm->port_list)) return 0; @@ -1979,6 +1988,9 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev) hdmi_priv->chmap.ops.is_pcm_attached = is_hdac_hdmi_pcm_attached; hdmi_priv->chmap.ops.get_spk_alloc = hdac_hdmi_get_spk_alloc; + if (!hdac_id) + return -ENODEV; + if (hdac_id->driver_data) hdmi_priv->drv_data = (struct hdac_hdmi_drv_data *)hdac_id->driver_data;