Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2388434lqp; Sun, 24 Mar 2024 17:13:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXG4tb7BuCHKwm0bX2dL9CvejwHVLbVzk1c4YfxsBG/ZDIDUPpsZa0iumYzgnGxBa4+I14qKy7OgMLwZcbCR9co6/LkJN4udiKnz4D2lA== X-Google-Smtp-Source: AGHT+IHhFTIH4shtxqM5ajGOdvZ71Om7VDzkQQ8OEsO62EaD4wVlgXhoItc55FnF5I1yeQyzp544 X-Received: by 2002:a05:6808:257:b0:3c1:e8d4:e16f with SMTP id m23-20020a056808025700b003c1e8d4e16fmr6484490oie.24.1711325623803; Sun, 24 Mar 2024 17:13:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711325623; cv=pass; d=google.com; s=arc-20160816; b=VJScghKsGWWI4wwa3Pwn0pCGS3j5gqlaN3zWjJJ5shC5AP7UEVoSUjIC/Matc0o7vq cjiQZ1HO1OeHB7NMRDNmgwZhVjH2YVHE45hAkm8F8tbaTkUJzI7Q4ygyoc7VcPsOAjSN oMFhmEB5kQXUXgmVumB8AV6kUvRju5paYZ7zWzCOWk0a0VeEBdV9TCFV3Zz8m5vNzMZt Yw4GfEt8sgbJTcyan8MPWyvD84TURWO9H6bHdKpmz3zqszPFQME2k+hhzk7bJhIU7ZsU Nvq4g6FtsOHTqiSKtnDVfrQRGJ7F8GF9JETRfSaaz2gthlL65+93xF0RJQjOxqjknUD1 eNNA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=S6kC2uyWhr1tnJ2WnlMQay762R9gHmq+CFfDXT79yL4=; fh=5e8UMvN1dFq00O8h8x0gqbxh71gsFgRe9L1kmhuH6fU=; b=vYiJ2NwQ5Bw6byp0wpNzhuVIbAu2HZBW5jINYUGTBXwEpiaVcx9Q7qnAkxkGUR7YtF U6cfuHd7PIQxu1mdUZawTjKtzL6B4RJxclObHHalkwyX4EQZHkbaaH5aAb0snqIm8kVt 1zsPJS4Wh9m94U7ufr6/QrrXYwjmyjNdlNSyXbWb5lUzdVwxG3izRtmQPGgw6adaAe7w oPI0m5s0SL/0FG5CcDRARF1xTDCPz24SGvDOo2vSjjF1T7qXvni+THtKPuoCKdkTSVcw 3P2YDFLjw+kG/I4MVeSh7FfsPjiqd1GlpsEAYpwlC6psBafDMlZe15ozo7rlj5DrhHqc vRsA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YsYJ9LzV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113341-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113341-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d1-20020a05622a100100b00431472bcab9si3158224qte.357.2024.03.24.17.13.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:13:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113341-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YsYJ9LzV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113341-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113341-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 621281C221B7 for ; Mon, 25 Mar 2024 00:13:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5DA0B19757C; Sun, 24 Mar 2024 22:42:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YsYJ9LzV" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70CC1198324; Sun, 24 Mar 2024 22:42:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320142; cv=none; b=adoNOanJ+Mbndi2eW6Kj65bOgeVQ7jv9KjW3G+xESm5j11mzwqBQwSZe8XgDAj5QfoomW8EoNWriMYTI1Gf1hPNvkMNg7Yj0c+SiLaLPIu7O/YtgBh82r+ukJi7sZAwsax18tXqRKGzfoLwCvd1u3AhHu2zD3USV95O5RskTsRo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320142; c=relaxed/simple; bh=olyr5yeonu8HwmXycVe5CPG9wjhCKW83dLTgGlAk8GQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ELvWuO5aq/r+Xs8L8vN/3Umb6ph4PAuN2CTAn3RnPq7GvTOH4kXbFyVlEs5n4yeAh83POtomkm8dmPzjKnoBMq88ze6ISo9d8idexO9BrgQnEJBIReyEE5VcFc1Zn0vQaACZ4LXxj07wD1Te8Su6nbZmokvwPsaHRl4dyUNYPqk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YsYJ9LzV; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99C40C433B1; Sun, 24 Mar 2024 22:42:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320142; bh=olyr5yeonu8HwmXycVe5CPG9wjhCKW83dLTgGlAk8GQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YsYJ9LzVVD68/jP+bG4Qgh+OHrqW0bg0k8jzaE3tQjQJ3eWVqn4fuAIY/GYBlvupe lBXHkXtAW3CVDAQJJTl+3gfHiSpcq1+DmQ/7/q2WkiD2NEJske/vwkZi8sor1OLpdM uIGT+9+7r1D5/YjLX3GZFb0J04Wv6UU7vIDbwDhF7VdrGmjS4IVMm86e876riroD2V M+OmFwMwHXJou8RGMPKMNrNI0POrNM97VXoWejQCeDeAWIogseUe8h8q7E/6Trxnkx CQUIfaPBx24tX4KdxuD6Dz8SoLpGBZZEkpa+BACyNPyAaBIyREVY+ghGeweXLqyK72 lfhi7ujMnyssw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mads Bligaard Nielsen , =?UTF-8?q?Alvin=20=C5=A0ipraga?= , Robert Foss , Sasha Levin Subject: [PATCH 6.8 450/715] drm/bridge: adv7511: fix crash on irq during probe Date: Sun, 24 Mar 2024 18:30:29 -0400 Message-ID: <20240324223455.1342824-451-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Mads Bligaard Nielsen [ Upstream commit aeedaee5ef5468caf59e2bb1265c2116e0c9a924 ] Moved IRQ registration down to end of adv7511_probe(). If an IRQ already is pending during adv7511_probe (before adv7511_cec_init) then cec_received_msg_ts could crash using uninitialized data: Unable to handle kernel read from unreadable memory at virtual address 00000000000003d5 Internal error: Oops: 96000004 [#1] PREEMPT_RT SMP Call trace: cec_received_msg_ts+0x48/0x990 [cec] adv7511_cec_irq_process+0x1cc/0x308 [adv7511] adv7511_irq_process+0xd8/0x120 [adv7511] adv7511_irq_handler+0x1c/0x30 [adv7511] irq_thread_fn+0x30/0xa0 irq_thread+0x14c/0x238 kthread+0x190/0x1a8 Fixes: 3b1b975003e4 ("drm: adv7511/33: add HDMI CEC support") Signed-off-by: Mads Bligaard Nielsen Signed-off-by: Alvin Šipraga Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20240219-adv7511-cec-irq-crash-fix-v2-1-245e53c4b96f@bang-olufsen.dk Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 8be235144f6d9..6fc292393c674 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -1277,17 +1277,6 @@ static int adv7511_probe(struct i2c_client *i2c) INIT_WORK(&adv7511->hpd_work, adv7511_hpd_work); - if (i2c->irq) { - init_waitqueue_head(&adv7511->wq); - - ret = devm_request_threaded_irq(dev, i2c->irq, NULL, - adv7511_irq_handler, - IRQF_ONESHOT, dev_name(dev), - adv7511); - if (ret) - goto err_unregister_cec; - } - adv7511_power_off(adv7511); i2c_set_clientdata(i2c, adv7511); @@ -1311,6 +1300,17 @@ static int adv7511_probe(struct i2c_client *i2c) adv7511_audio_init(dev, adv7511); + if (i2c->irq) { + init_waitqueue_head(&adv7511->wq); + + ret = devm_request_threaded_irq(dev, i2c->irq, NULL, + adv7511_irq_handler, + IRQF_ONESHOT, dev_name(dev), + adv7511); + if (ret) + goto err_unregister_audio; + } + if (adv7511->info->has_dsi) { ret = adv7533_attach_dsi(adv7511); if (ret) -- 2.43.0