From: Andrew Jeffery <andrew@codeconstruct.com.au>
To: Eddie James <eajames@linux.ibm.com>, linux-i2c@vger.kernel.org
Cc: openbmc@lists.ozlabs.org, ryan_chen@aspeedtech.com,
benh@kernel.crashing.org, joel@jms.id.au, andi.shyti@kernel.org
Subject: Re: [PATCH] i2c: aspeed: Nullify bus messages after timeout
Date: Mon, 03 Feb 2025 14:01:28 +1030 [thread overview]
Message-ID: <8f51f0852317a28fc5cf1ba213902be838c9545e.camel@codeconstruct.com.au> (raw)
In-Reply-To: <20250131222941.798065-1-eajames@linux.ibm.com>
On Fri, 2025-01-31 at 16:29 -0600, Eddie James wrote:
> For multimaster case, it's conceivable that an interrupt comes
> in after the transfer times out and attempts to use bus messages
> that have already been freed by the i2c core.
This description seems a little vague. Did you hit this case in
practice?
>
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
> ---
> drivers/i2c/busses/i2c-aspeed.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/i2c/busses/i2c-aspeed.c
> b/drivers/i2c/busses/i2c-aspeed.c
> index 1550d3d552aed..e344dcc2233fe 100644
> --- a/drivers/i2c/busses/i2c-aspeed.c
> +++ b/drivers/i2c/busses/i2c-aspeed.c
> @@ -731,6 +731,7 @@ static int aspeed_i2c_master_xfer(struct
> i2c_adapter *adap,
> * master command.
> */
> spin_lock_irqsave(&bus->lock, flags);
> + bus->msgs = NULL;
It feels like there's buggy code elsewhere in the driver that this is
protecting (broken state machine)? I've had a look at the
aspeed_i2c_master_irq() implementation and can't see what though, as we
take an early-exit (before indexing into bus->msgs) if bus-
>master_state is INACTIVE or PENDING.
Can you be a bit more specific about where the issue lies?
Andrew
> if (bus->master_state == ASPEED_I2C_MASTER_PENDING)
> bus->master_state =
> ASPEED_I2C_MASTER_INACTIVE;
> spin_unlock_irqrestore(&bus->lock, flags);
next prev parent reply other threads:[~2025-02-03 3:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-31 22:29 [PATCH] i2c: aspeed: Nullify bus messages after timeout Eddie James
2025-02-03 3:31 ` Andrew Jeffery [this message]
2025-02-03 20:29 ` Eddie James
2025-02-04 4:13 ` Andrew Jeffery
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=8f51f0852317a28fc5cf1ba213902be838c9545e.camel@codeconstruct.com.au \
--to=andrew@codeconstruct.com.au \
--cc=andi.shyti@kernel.org \
--cc=benh@kernel.crashing.org \
--cc=eajames@linux.ibm.com \
--cc=joel@jms.id.au \
--cc=linux-i2c@vger.kernel.org \
--cc=openbmc@lists.ozlabs.org \
--cc=ryan_chen@aspeedtech.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