Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4025828ybl; Mon, 3 Feb 2020 11:05:57 -0800 (PST) X-Google-Smtp-Source: APXvYqybuDY5YzuF8+ZMUkmiMdJX5RwQAhwfipDW7sIguWJ5VnnwsowJrh6jpYwjHzLQyE3FB5DZ X-Received: by 2002:aca:d544:: with SMTP id m65mr336582oig.177.1580756757799; Mon, 03 Feb 2020 11:05:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580756757; cv=none; d=google.com; s=arc-20160816; b=IpsPGo7yYzGBfTuSEx3xeUbCLZUgm3KdHCaUnfYtBWPxa6s0atiI+gnApNSSDBPuWv Ay2882rigeOCFdpWKn3ONUUnLryW0w6QpkvXe4r/2jK7aweJrmAqhGa4zvoBCNL/Ij5l mt4z66+HfQ48hfwjFHAei54nSiG01YFj37AAStu0tzAHY6AczIyN4bARzeXCQ+D1ZPJs WHiLmfsIKHF+MwLAJQGpVaZksX32SY+b0RZJFuQKVoIQo7BgM4zKB2HxRfYmVsplt1fQ q//2G0rlT26P9kpGOQxuq3mkkTh92KxRPiiuhbKap4pztmsyaDuCUADtrZeARIywcLFr n5MA== 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=MR4C/m7rtf2n+YA9AUL6sucGTa9q1eIQq6QUhmTzSH4=; b=j3DKRT+42PXvb9SCJRidkX9iu3L3sH9OFPMvh5E9gopKOQKgTHS7CI0UpCzoXoYeb5 ZENwoEY3ir+zI8nWt+qnl8gXv4Rhb0fsZ7ekIPkVNHXgYeP9l30oWRCmf8Te1ujBPAUd bY85MwDNGnVjF6hfKAGLMfks1hZmOJUaeRWaLa4/eCHXhGpy0fxSgioroJo0pdS1/FJA gSs0E3IHrylVBJcPQ6bSaRtGsHFeXClz8lpgx9wya2fP3B6LPECt7By8wPYNGDFIBUcz A5FTob1SzODrpvo+bjcVRX+JLBfqb93mT9n0Qy3c/nIeydeLcVsM0PrngfAK4vWG/Wu4 qk8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="C6kd/Lcj"; 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 x11si8535630otp.285.2020.02.03.11.05.46; Mon, 03 Feb 2020 11:05:57 -0800 (PST) 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="C6kd/Lcj"; 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 S1730154AbgBCQfL (ORCPT + 99 others); Mon, 3 Feb 2020 11:35:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:49784 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730901AbgBCQfI (ORCPT ); Mon, 3 Feb 2020 11:35:08 -0500 Received: from localhost (unknown [104.132.45.99]) (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 A82B42087E; Mon, 3 Feb 2020 16:35:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580747708; bh=9ty3tMdqE5fKLEoeDFTtG79USBsuNwJvzjucfUNDR0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C6kd/Lcj4Y+37CyYYv76a1g7AReUEujwnsUnXXcwxZhUI/bJsO/cnlyXBcB9iqkL4 r81lV/R3FcckIuLUun1ThEWvnOWRsQXoBhv7CgQ+wA2qkQTZ6b7pECwhUPY9g0yROJ Ev8OhPcvv8Euej7gWrSEoN9+NjCG0IZpHBOFH0xA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Mark Brown , Sasha Levin Subject: [PATCH 5.4 36/90] ASoC: rt5640: Fix NULL dereference on module unload Date: Mon, 3 Feb 2020 16:19:39 +0000 Message-Id: <20200203161922.450876464@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200203161917.612554987@linuxfoundation.org> References: <20200203161917.612554987@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 From: Dmitry Osipenko [ Upstream commit 89b71b3f02d8ae5a08a1dd6f4a2098b7b868d498 ] The rt5640->jack is NULL if jack is already disabled at the time of driver's module unloading. Signed-off-by: Dmitry Osipenko Link: https://lore.kernel.org/r/20200106014707.11378-1-digetx@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/rt5640.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c index adbae1f36a8af..747ca248bf10c 100644 --- a/sound/soc/codecs/rt5640.c +++ b/sound/soc/codecs/rt5640.c @@ -2432,6 +2432,13 @@ static void rt5640_disable_jack_detect(struct snd_soc_component *component) { struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); + /* + * soc_remove_component() force-disables jack and thus rt5640->jack + * could be NULL at the time of driver's module unloading. + */ + if (!rt5640->jack) + return; + disable_irq(rt5640->irq); rt5640_cancel_work(rt5640); -- 2.20.1