Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2351305rdg; Mon, 16 Oct 2023 01:14:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFKe7YRsb5UKH8vihsL1pU26Pvkx/rcpQgVYldrjqpHTwCbS6hmgQcZn4WBNC+nwwsvuRNu X-Received: by 2002:a05:6a00:1807:b0:6b3:6bc6:68d1 with SMTP id y7-20020a056a00180700b006b36bc668d1mr6830753pfa.11.1697444096954; Mon, 16 Oct 2023 01:14:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697444096; cv=none; d=google.com; s=arc-20160816; b=TqS8UXO7+N36zre9Nl+U4Nbc1jZpp4b+fpO8/PQjzYe+pMaNdImhgiJZlIZ+HqAW3o e9en6UIalr3UHxSyeEzgT/rkEHF9NRGDhA4L98F2aUJrBGUF5lREe1c+U7XVCvcSmvpW S7348KVnX2I80l7HMcZMHRkce0nl5tYSz46en9kxZHaSrjolnbpVEwFjB9yOmyXIUEFz CsgrSiySTuAVCSUJgUfiHaZCe+DPVvx514GnIcUJkfSEM706+JSluG5bhitrNek6FLEz g5XYn5WteFRbuCb8zA3g+JaI/6EnXGq7vwwMYYHUHptngI9Bp6gqyqNSlZAg2ahB/jrQ jwvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=MhyzRd42J1nfjTwwUE0Sz5aWZ5vE46vGgoNRA/hodZ8=; fh=O6to00eV0mVPGt++8ZRC5SSzgsizpEe/DeAGOh5hpuk=; b=fAHoHne9osrfluKlQp6Gj3+eC+TQ9OzhhDEm/LJjuuI93LzJNOj1sCCKHSr4lRqHL2 Zrb+7j2KzmT1Hq4/Jt0q6jL72AhFLLb956DqzrmvgwQMB1H4n2XMlEwOmp8T2nT+F6uN YBfrs7kCjTNEta2/GhV7YGB3H1Vr1iPkT1rl4nqrIG59Xlty/bD/FXizmHL0kFS60H4D q/4OrFcgZlP27Iz+44BBw50OXKCiVuTixRaaHIHnEOn41xQxPu/tPxrSKUX7CVkH5KEz PMF/kdLHidzwPc7VmiU/4sV94tMWzdTOtufDKIqYBOxw9X2XCKZ7Qh79ZplEKh1yS27F jBzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=OEPhb+qf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id z190-20020a6333c7000000b005897813624fsi7555916pgz.476.2023.10.16.01.14.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 01:14:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=OEPhb+qf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 7778A8054BF2; Mon, 16 Oct 2023 01:14:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231149AbjJPIOq (ORCPT + 99 others); Mon, 16 Oct 2023 04:14:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbjJPIOp (ORCPT ); Mon, 16 Oct 2023 04:14:45 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14197B4 for ; Mon, 16 Oct 2023 01:14:41 -0700 (PDT) Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4E38957E; Mon, 16 Oct 2023 10:14:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1697444072; bh=X0qPY/ZLr+T1pIWB06XY/oU04miPkYzv4QR6qe8hHmE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OEPhb+qfjRVqR7D1DjR/E4Qs9EwjfcHt8zBmMXEBgHmGiLl1wKX0oqAr3SYY4QtqV qPTLmd/7cqLDNPiSZG5NARIWT+TbU4s+6EyMzvh4mOJFRByYRQsDZG9L5ctpTQRtkM GBcs5herAk57EUmN/IcNYyspYVC5+maSi2mZhSsE= Date: Mon, 16 Oct 2023 11:14:44 +0300 From: Laurent Pinchart To: Alvin =?utf-8?Q?=C5=A0ipraga?= Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Archit Taneja , Hans Verkuil , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Mads Bligaard Nielsen , Alvin =?utf-8?Q?=C5=A0ipraga?= Subject: Re: [PATCH] drm/bridge: adv7511: fix crash on irq during probe Message-ID: <20231016081444.GD23177@pendragon.ideasonboard.com> References: <20231014-adv7511-cec-irq-crash-fix-v1-1-3389486c8373@bang-olufsen.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231014-adv7511-cec-irq-crash-fix-v1-1-3389486c8373@bang-olufsen.dk> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 16 Oct 2023 01:14:54 -0700 (PDT) Hello Alvin, On Sat, Oct 14, 2023 at 08:46:12PM +0200, Alvin Šipraga wrote: > From: Mads Bligaard Nielsen > > 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") Isn't the issue older than that ? > Signed-off-by: Mads Bligaard Nielsen > Signed-off-by: Alvin Šipraga With the Fixes: tag updated, Reviewed-by: Laurent Pinchart > --- > 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 d518de88b5c3..71022cb8abe4 100644 > --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > @@ -1291,17 +1291,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); > @@ -1325,6 +1314,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->type == ADV7533 || adv7511->type == ADV7535) { > ret = adv7533_attach_dsi(adv7511); > if (ret) > -- Regards, Laurent Pinchart