From patchwork Wed Jul 15 00:24:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mnlife qiao X-Patchwork-Id: 11666805 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D128C6C1 for ; Thu, 16 Jul 2020 07:20:40 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6453E2067D for ; Thu, 16 Jul 2020 07:20:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="WnPlDX13"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rawG1LNi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6453E2067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id DE6DF1675; Thu, 16 Jul 2020 09:19:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DE6DF1675 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1594884038; bh=0xQ/am6woNxh3DruGf+dAScKAPL+8zkB9Nmyj1htUOM=; h=References:In-Reply-To:From:Date:Subject:To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=WnPlDX130DYScRxZ2qdJ3Zan8IEohka3yARPrrouhAFooMvTzz1iMVhpW/dfTMgUK Q4uCuPynfYw23vcS6p+23FNsmad3tB2asPlD8RB8zfe2nBPugIFBQ3FgbZobszOVcs NdWMgVpnr91/wt4eRzW6OrhDeZS/OXNNKkyAT6BA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6C450F802BC; Thu, 16 Jul 2020 09:18:13 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 06A97F8019B; Wed, 15 Jul 2020 02:24:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, HTML_MESSAGE, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A9DE1F8014E for ; Wed, 15 Jul 2020 02:24:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A9DE1F8014E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rawG1LNi" Received: by mail-wr1-x442.google.com with SMTP id z13so571577wrw.5 for ; Tue, 14 Jul 2020 17:24:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=iewP6kBBGkoM+NWaS3DfjUXvQDRr2nJUEdxQPlIIFM0=; b=rawG1LNi+RAb1ZzCXDdwd32vQxg7rvvqBJiHSOWkRGlttzJ8pqTMEsWwmtvcFKTfvX Ut3tOUR0s/AkQSrZiCrJPS/biRHToPRz4/PNQCMbo0JXds3zuRERaseMpyG2TBD7mmJZ BUzLpGxAKG4ZT0HCOA0muhLorV7Hu7vPPmQiGiF7pNPAjvcTeyWcSRfL7IDCheONIV/d oQ37wF3EFBlLSQYn1ub1ASjtUacrWtnJSvc3YkreYTZRTpEgBOKJRvA21bNq1iARoA0k nbTjrN+yr10T/FQ9DTbEZylp45wl6ztXkPAb81ALO+Fp5ecOwRiEhvCHRGddgWsggOWK JWeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=iewP6kBBGkoM+NWaS3DfjUXvQDRr2nJUEdxQPlIIFM0=; b=SY9CcmTdaOFF0mHVmkvQIA4VZyuyoK5uCjnWjeuR4qb0yzg+oCqMLXNXZS5eVBydJt wg4tPcclqpwPrLQdhPprf1lnXFYdChTfHJbVJ09mP9a4DmefkLPOI3OmYBBPmuMaWafO HQwzMr2I0ddKgO9iVCtjTukFfmyYO78cqu5AsSMiC5YMeo0iORdviBnp3gXo1I33xOez 3da7NlrTwM5YtL9wVvNTFKyMGGBT0GSyusvbTcX/hRQaVh8wEGPk+Xt31f4uY+mc2MtT rjO+ZTYnpYaHQ67Gc9Dl/J/PQ6ZeR52yREqlRfdpcjxivOnCm5yg/OJn+/OeDKLtmYqu iYuw== X-Gm-Message-State: AOAM531rSyGDR2wu8SoY4HCsNoIo6JKeXSyzCbiQwF/HGv+/L9dTkA1K hxXnAGXv85UImfzCiKN1WuP/PrFuvLpdS70UjTk= X-Google-Smtp-Source: ABdhPJzMsiHuahVmxHGl1O1iCFxyz0OXaHxlhJ9mKuK/83xI4YCn4L7U1waH+DACUr56IBhQt1IiTWFEc/aRP/zNFCc= X-Received: by 2002:adf:82f5:: with SMTP id 108mr8356831wrc.218.1594772656307; Tue, 14 Jul 2020 17:24:16 -0700 (PDT) MIME-Version: 1.0 References: <5f0e49da.1c69fb81.1ede7.a8fbSMTPIN_ADDED_MISSING@mx.google.com> In-Reply-To: <5f0e49da.1c69fb81.1ede7.a8fbSMTPIN_ADDED_MISSING@mx.google.com> From: mnlife qiao Date: Wed, 15 Jul 2020 08:24:04 +0800 Message-ID: Subject: [PATCH] ASoC: soc-jack: calling snd_soc_jack_report causes a null pointer access To: lgirdwood@gmail.com, Jaroslav Kysela , open list , alsa-devel@alsa-project.org, broonie@kernel.org, mnlife qiao , mnlife X-Mailman-Approved-At: Thu, 16 Jul 2020 09:18:09 +0200 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" When snd_soc_card_jack_new is not called or the call fails, calling this function causes a null pointer access Signed-off-by: mnlife --- sound/soc/soc-jack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c index 0f1820f36b4d..51b799ee98b7 100644 --- a/sound/soc/soc-jack.c +++ b/sound/soc/soc-jack.c @@ -44,7 +44,7 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask) unsigned int sync = 0; int enable; - if (!jack) + if (!jack || !jack->jack) return; trace_snd_soc_jack_report(jack, mask, status);