The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Alvin Šipraga" <alvin@pqrs.dk>
Cc: "Andrzej Hajda" <andrzej.hajda@intel.com>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Robert Foss" <rfoss@kernel.org>,
	"Jonas Karlman" <jonas@kwiboo.se>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Archit Taneja" <architt@codeaurora.org>,
	"Hans Verkuil" <hans.verkuil@cisco.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	"Mads Bligaard Nielsen" <bli@bang-olufsen.dk>,
	"Alvin Šipraga" <alsi@bang-olufsen.dk>
Subject: Re: [PATCH] drm/bridge: adv7511: fix crash on irq during probe
Date: Mon, 16 Oct 2023 11:14:44 +0300	[thread overview]
Message-ID: <20231016081444.GD23177@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20231014-adv7511-cec-irq-crash-fix-v1-1-3389486c8373@bang-olufsen.dk>

Hello Alvin,

On Sat, Oct 14, 2023 at 08:46:12PM +0200, Alvin Šipraga wrote:
> From: Mads Bligaard Nielsen <bli@bang-olufsen.dk>
> 
> 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 <bli@bang-olufsen.dk>
> Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>

With the Fixes: tag updated,

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

> ---
>  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

  reply	other threads:[~2023-10-16  8:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-14 18:46 [PATCH] drm/bridge: adv7511: fix crash on irq during probe Alvin Šipraga
2023-10-16  8:14 ` Laurent Pinchart [this message]
2023-10-16  8:42   ` Alvin Šipraga
2023-11-24 13:33     ` Alvin Šipraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231016081444.GD23177@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=alsi@bang-olufsen.dk \
    --cc=alvin@pqrs.dk \
    --cc=andrzej.hajda@intel.com \
    --cc=architt@codeaurora.org \
    --cc=bli@bang-olufsen.dk \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hans.verkuil@cisco.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox