Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4450751imw; Tue, 19 Jul 2022 06:54:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1voHRxPg0q+sj+m6NtfxlpZoZshwLiDXRMoegmaa0RPAvx9ytQRtSy832519xxTpMU61TpH X-Received: by 2002:a05:6402:3593:b0:43a:a259:2518 with SMTP id y19-20020a056402359300b0043aa2592518mr44201802edc.117.1658238857746; Tue, 19 Jul 2022 06:54:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238857; cv=none; d=google.com; s=arc-20160816; b=MVaPBR905sx5JSA6F09RJu3dI/daz5CUR+RRdl6VKHoTqHod8F1u3BcOu1qmxIqX5j xZsDd/gRI/SdIxerqQPDz92XLMlUVUDwa8Bm1mns+kHzPY2h30JG40EtLuLtqmKF4TD0 tNRMYH2UBYvF3YAH610lKfHxKNjwomSnaahsBsFfTSqC2tcIJoqjZc1cK2+Va7/ujUj0 9Yyrracv/q298Z5OuMX2iVseUqYL/txgHj7JOBuQMhR2YwqrpabnPxOyoXAj77kYeNvQ b40IRF+R1t4T7fmaftizBsas7HdmJVVehEoxRaDvyEFqvpGStaoycToIxronqkUPlg/R KVXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/t6JoAb1RJRfD1hLbSItlQPsT5Zb9ezgkVU/g5Ol9Uw=; b=u7U2/mcS0EIYbX5fGMLUpMINwPnjOCMVRkjnv9nLxF5OS1YrT5vhhfGpjl5XzsSbFx zxbiN+oLX4w1z1XOEY11T0OyiIyjY7Qog772KPgtQIRHBfi+q5zW8MDPu04vpH+IWH7R 9XRanVee4x2tgLxzBKqHoqOWww2AO2CjsLvpd1q1FI360NZn2CDmmVT6/uVC4dyxk9Yc WQZEKji1QKTy2novqX0Q8j+LxmTniYBAz66w5gUaTbT1s7f0rlZ+gmettChhgCaY/r+Y 2w1ijqGOrwbFxEM8DSxb+76+1n5lk6H2IqyX1ReUJuaAvWZMGBtFVEtTsJvJ3ceEfvPz gTJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qQmYPBen; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j30-20020a056402239e00b0043ba52ffd16si302576eda.453.2022.07.19.06.53.53; Tue, 19 Jul 2022 06:54:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qQmYPBen; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233792AbiGSNLg (ORCPT + 99 others); Tue, 19 Jul 2022 09:11:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243277AbiGSNJN (ORCPT ); Tue, 19 Jul 2022 09:09:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E14488127; Tue, 19 Jul 2022 05:28:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6DA87B81B29; Tue, 19 Jul 2022 12:27:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9D15C341CA; Tue, 19 Jul 2022 12:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233671; bh=Ss5Bd5y921XiglrVJj7GF+bCma+YJpq9Toc4NGFfIDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qQmYPBenb5qvPL93UFryWGn/nMtLUCfb5OqQJy8NrI9tLpMdleunKGPrhPEVI7LeG pT+LcvqWzWsBYcvVMbdNOGSKFLKzn9ffUq3ndzorMZK1MV6xv+1xZOqhW99hHpUiQk BfiLUnSQNXgMUtspk1HGYz64ubcGkFg6FNXLWUj4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuming Fan , Mark Brown , Sasha Levin Subject: [PATCH 5.18 201/231] ASoC: rt711-sdca: fix kernel NULL pointer dereference when IO error Date: Tue, 19 Jul 2022 13:54:46 +0200 Message-Id: <20220719114730.926631192@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shuming Fan [ Upstream commit 1df793d479bef546569fc2e409ff8bb3f0fb8e99 ] The initial settings will be written before the codec probe function. But, the rt711->component doesn't be assigned yet. If IO error happened during initial settings operations, it will cause the kernel panic. This patch changed component->dev to slave->dev to fix this issue. Signed-off-by: Shuming Fan Link: https://lore.kernel.org/r/20220621090719.30558-1-shumingf@realtek.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/rt711-sdca.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-sdca.c index dfe3c9299ebd..5ad53bbc8528 100644 --- a/sound/soc/codecs/rt711-sdca.c +++ b/sound/soc/codecs/rt711-sdca.c @@ -34,7 +34,7 @@ static int rt711_sdca_index_write(struct rt711_sdca_priv *rt711, ret = regmap_write(regmap, addr, value); if (ret < 0) - dev_err(rt711->component->dev, + dev_err(&rt711->slave->dev, "Failed to set private value: %06x <= %04x ret=%d\n", addr, value, ret); @@ -50,7 +50,7 @@ static int rt711_sdca_index_read(struct rt711_sdca_priv *rt711, ret = regmap_read(regmap, addr, value); if (ret < 0) - dev_err(rt711->component->dev, + dev_err(&rt711->slave->dev, "Failed to get private value: %06x => %04x ret=%d\n", addr, *value, ret); -- 2.35.1