public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Pratap Nirujogi <pratap.nirujogi@amd.com>,
	andi.shyti@kernel.org, mika.westerberg@linux.intel.com,
	andriy.shevchenko@linux.intel.com, jsd@semihalf.com
Cc: rafael.j.wysocki@intel.com, mlimonci@amd.com,
	benjamin.chan@amd.com, bin.du@amd.com, king.li@amd.com,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] i2c: designware: amdisp: Fix null pointer dereference in runtime resume
Date: Mon, 9 Mar 2026 20:29:04 -0500	[thread overview]
Message-ID: <4527c72d-bc59-4f5d-af94-4b2f37d75a96@amd.com> (raw)
In-Reply-To: <20260309220038.1420996-1-pratap.nirujogi@amd.com>



On 3/9/2026 5:00 PM, Pratap Nirujogi wrote:
> Add NULL check for i_dev->map before calling i2c_dw_init() in the
> runtime resume path. The regmap may not be initialized yet when
> runtime PM tries to resume the device early in the probe sequence,
> leading to a NULL pointer dereference. Skip the i2c_dw_init() call
> if regmap is not yet created.
> 
> This race condition occurs when runtime PM resume is triggered before
> i2c_dw_probe() completes the regmap initialization and was observed in
> kernel v7.0 where the order of device enumeration has changed because
> of the changes in registering the device sources in the device hierarchy.
> 
> Co-developed-by: Bin Du <Bin.Du@amd.com>
> Fixes: 02c057ddefef ("ACPI: video: Convert the driver to a platform one")

Is this the right commit that introduced the race?  Did it change the 
timing?

Or was the race always there and we just got lucky until that commit 
went in?

> Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com>
> ---
>   drivers/i2c/busses/i2c-designware-amdisp.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-amdisp.c b/drivers/i2c/busses/i2c-designware-amdisp.c
> index c48728ad9f6f2..cd7ee55fbe1ee 100644
> --- a/drivers/i2c/busses/i2c-designware-amdisp.c
> +++ b/drivers/i2c/busses/i2c-designware-amdisp.c
> @@ -153,7 +153,10 @@ static int amd_isp_dw_i2c_plat_runtime_resume(struct device *dev)
>   		return -ENODEV;
>   
>   	i2c_dw_prepare_clk(i_dev, true);
> -	i2c_dw_init(i_dev);
> +
> +	/* Skip i2c_dw_init if regmap not yet created by i2c_dw_probe */
> +	if (i_dev->map)
> +		i2c_dw_init(i_dev);
>   
>   	return 0;
>   }


  reply	other threads:[~2026-03-10  1:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09 22:00 [PATCH v1] i2c: designware: amdisp: Fix null pointer dereference in runtime resume Pratap Nirujogi
2026-03-10  1:29 ` Mario Limonciello [this message]
2026-03-19 21:09   ` Nirujogi, Pratap
2026-03-20  7:59     ` Andy Shevchenko
2026-03-20 15:38       ` Nirujogi, Pratap
2026-03-20 13:56     ` Mario Limonciello
2026-03-20 15:40       ` Nirujogi, Pratap
2026-03-10 11:21 ` Andy Shevchenko
2026-03-19 21:24   ` Nirujogi, Pratap

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=4527c72d-bc59-4f5d-af94-4b2f37d75a96@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=andi.shyti@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=benjamin.chan@amd.com \
    --cc=bin.du@amd.com \
    --cc=jsd@semihalf.com \
    --cc=king.li@amd.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=mlimonci@amd.com \
    --cc=pratap.nirujogi@amd.com \
    --cc=rafael.j.wysocki@intel.com \
    /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