public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@kernel.org>
To: Lixue Liang <lianglixuehao@126.com>
Cc: brendan.higgins@linux.dev, benh@kernel.crashing.org,
	joel@jms.id.au, Lixue Liang <lianglixue@greatwall.com.cn>,
	linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
	p.zabel@pengutronix.de, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] i2c: aspeed: Avoid accessing freed buffers during i2c transfers.
Date: Sat, 5 Aug 2023 12:10:04 +0200	[thread overview]
Message-ID: <20230805101004.dknxj7nqrt2aes5n@intel.intel> (raw)
In-Reply-To: <20230728122416.17782-1-lianglixuehao@126.com>

Hi Lixue,

On Fri, Jul 28, 2023 at 12:24:16PM +0000, Lixue Liang wrote:
> From: Lixue Liang <lianglixue@greatwall.com.cn>
> 
> After waiting for the transmission timeout, the I2C controller will
> continue to transmit data when the bus is idle. Clearing bus->msg will
> avoid kernel panic when accessing the freed msg->buf in
> aspeed_i2c_master_irq.

actually in aspeed_i2c_master_irq() you are already checking for
!bus->msgs.

What kind of panic are you referring to?

Andi

> Signed-off-by: Lixue Liang <lianglixue@greatwall.com.cn>
> ---
>  drivers/i2c/busses/i2c-aspeed.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
> index 2e5acfeb76c8..c83057497e26 100644
> --- a/drivers/i2c/busses/i2c-aspeed.c
> +++ b/drivers/i2c/busses/i2c-aspeed.c
> @@ -713,6 +713,8 @@ static int aspeed_i2c_master_xfer(struct i2c_adapter *adap,
>  		spin_lock_irqsave(&bus->lock, flags);
>  		if (bus->master_state == ASPEED_I2C_MASTER_PENDING)
>  			bus->master_state = ASPEED_I2C_MASTER_INACTIVE;
> +
> +		bus->msgs = NULL;
>  		spin_unlock_irqrestore(&bus->lock, flags);
>  
>  		return -ETIMEDOUT;
> -- 
> 2.27.0
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      parent reply	other threads:[~2023-08-05 10:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230728122416.17782-1-lianglixuehao@126.com>
2023-07-31  4:21 ` [PATCH] i2c: aspeed: Avoid accessing freed buffers during i2c transfers Joel Stanley
     [not found]   ` <CAARXrtmZbu3aabYJkEc25rHymRHDX4=zNdecHAs3LnQ259RkPg@mail.gmail.com>
2023-08-02 13:41     ` Eddie James
2023-08-05 10:10 ` Andi Shyti [this message]

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=20230805101004.dknxj7nqrt2aes5n@intel.intel \
    --to=andi.shyti@kernel.org \
    --cc=benh@kernel.crashing.org \
    --cc=brendan.higgins@linux.dev \
    --cc=joel@jms.id.au \
    --cc=lianglixue@greatwall.com.cn \
    --cc=lianglixuehao@126.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=p.zabel@pengutronix.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