[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CACPK8Xf6YssamEmHB5XDf8JYk+_=hnG8Yzqn4kCikseqg6rqOA@mail.gmail.com>
Date: Mon, 31 Jul 2023 04:21:18 +0000
From: Joel Stanley <joel@....id.au>
To: Lixue Liang <lianglixuehao@....com>,
Eddie James <eajames@...ux.ibm.com>
Cc: brendan.higgins@...ux.dev, benh@...nel.crashing.org,
p.zabel@...gutronix.de, linux-i2c@...r.kernel.org,
openbmc@...ts.ozlabs.org, linux-arm-kernel@...ts.infradead.org,
linux-aspeed@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
Lixue Liang <lianglixue@...atwall.com.cn>
Subject: Re: [PATCH] i2c: aspeed: Avoid accessing freed buffers during i2c transfers.
On Fri, 28 Jul 2023 at 12:40, Lixue Liang <lianglixuehao@....com> wrote:
>
> From: Lixue Liang <lianglixue@...atwall.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.
>
> Signed-off-by: Lixue Liang <lianglixue@...atwall.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;
Eddie, is this the same issue you were debugging?
> spin_unlock_irqrestore(&bus->lock, flags);
>
> return -ETIMEDOUT;
> --
> 2.27.0
>
Powered by blists - more mailing lists